Bug 1677951 - Add telemetry about low level HTTP3 performance. r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D97422
This commit is contained in:
Dragana Damjanovic 2021-01-15 09:15:59 +00:00
Родитель a29e207781
Коммит 6bdc6718ef
4 изменённых файлов: 161 добавлений и 2 удалений

Просмотреть файл

@ -46,6 +46,7 @@ const uint64_t HTTP3_APP_ERROR_CONNECT_ERROR = 0x10f;
const uint64_t HTTP3_APP_ERROR_VERSION_FALLBACK = 0x110;
const uint32_t UDP_MAX_PACKET_SIZE = 4096;
const uint32_t MAX_PTO_COUNTS = 16;
NS_IMPL_ADDREF(Http3Session)
NS_IMPL_RELEASE(Http3Session)
@ -1641,6 +1642,39 @@ void Http3Session::CloseConnectionTelemetry(CloseError& aError, bool aClosing) {
// connection, this will map to "closing" key and 37 in the graph.
Telemetry::Accumulate(Telemetry::HTTP3_CONNECTTION_CLOSE_CODE,
aClosing ? "closing"_ns : "closed"_ns, value);
Http3Stats stats;
mHttp3Connection->GetStats(&stats);
if (stats.packets_tx > 0) {
unsigned long loss = (stats.lost * 10000) / stats.packets_tx;
Telemetry::Accumulate(Telemetry::HTTP3_LOSS_RATIO, loss);
Telemetry::Accumulate(Telemetry::HTTP3_LATE_ACK, "ack"_ns, stats.late_ack);
Telemetry::Accumulate(Telemetry::HTTP3_LATE_ACK, "pto"_ns, stats.pto_ack);
unsigned long late_ack_ratio = (stats.late_ack * 10000) / stats.packets_tx;
unsigned long pto_ack_ratio = (stats.pto_ack * 10000) / stats.packets_tx;
Telemetry::Accumulate(Telemetry::HTTP3_LATE_ACK_RATIO, "ack"_ns,
late_ack_ratio);
Telemetry::Accumulate(Telemetry::HTTP3_LATE_ACK_RATIO, "pto"_ns,
pto_ack_ratio);
for (uint32_t i = 0; i < MAX_PTO_COUNTS; i++) {
nsAutoCString key;
key.AppendInt(i);
Telemetry::Accumulate(Telemetry::HTTP3_COUNTS_PTO, key,
stats.pto_counts[i]);
}
Telemetry::Accumulate(Telemetry::HTTP3_DROP_DGRAMS, stats.dropped_rx);
Telemetry::Accumulate(Telemetry::HTTP3_SAVED_DGRAMS, stats.saved_datagrams);
}
Telemetry::Accumulate(Telemetry::HTTP3_RECEIVED_SENT_DGRAMS, "received"_ns,
stats.packets_rx);
Telemetry::Accumulate(Telemetry::HTTP3_RECEIVED_SENT_DGRAMS, "sent"_ns,
stats.packets_tx);
}
void Http3Session::Finish0Rtt(bool aRestart) {

Просмотреть файл

@ -90,6 +90,10 @@ class NeqoHttp3Conn final {
nsrefcnt AddRef() { return neqo_http3conn_addref(this); }
nsrefcnt Release() { return neqo_http3conn_release(this); }
void GetStats(Http3Stats* aStats) {
return neqo_http3conn_get_stats(this, aStats);
}
private:
NeqoHttp3Conn() = delete;
~NeqoHttp3Conn() = delete;

Просмотреть файл

@ -8,8 +8,9 @@ use neqo_crypto::{init, PRErrorCode};
use neqo_http3::Error as Http3Error;
use neqo_http3::{Http3Client, Http3ClientEvent, Http3Parameters, Http3State};
use neqo_qpack::QpackSettings;
use neqo_transport::Error as TransportError;
use neqo_transport::{ConnectionParameters, FixedConnectionIdManager, Output, QuicVersion};
use neqo_transport::{
ConnectionParameters, Error as TransportError, FixedConnectionIdManager, Output, QuicVersion,
};
use nserror::*;
use nsstring::*;
use qlog::QlogStreamer;
@ -774,3 +775,42 @@ pub extern "C" fn neqo_http3conn_set_resumption_token(
pub extern "C" fn neqo_http3conn_is_zero_rtt(conn: &mut NeqoHttp3Conn) -> bool {
conn.conn.state() == Http3State::ZeroRtt
}
#[repr(C)]
#[derive(Default)]
pub struct Http3Stats {
/// Total packets received, including all the bad ones.
pub packets_rx: usize,
/// Duplicate packets received.
pub dups_rx: usize,
/// Dropped packets or dropped garbage.
pub dropped_rx: usize,
/// The number of packet that were saved for later processing.
pub saved_datagrams: usize,
/// Total packets sent.
pub packets_tx: usize,
/// Total number of packets that are declared lost.
pub lost: usize,
/// Late acknowledgments, for packets that were declared lost already.
pub late_ack: usize,
/// Acknowledgments for packets that contained data that was marked
/// for retransmission when the PTO timer popped.
pub pto_ack: usize,
/// Count PTOs. Single PTOs, 2 PTOs in a row, 3 PTOs in row, etc. are counted
/// separately.
pub pto_counts: [usize; 16],
}
#[no_mangle]
pub extern "C" fn neqo_http3conn_get_stats(conn: &mut NeqoHttp3Conn, stats: &mut Http3Stats) {
let t_stats = conn.conn.transport_stats();
stats.packets_rx = t_stats.packets_rx;
stats.dups_rx = t_stats.dups_rx;
stats.dropped_rx = t_stats.dropped_rx;
stats.saved_datagrams = t_stats.saved_datagrams;
stats.packets_tx = t_stats.packets_tx;
stats.lost = t_stats.lost;
stats.late_ack = t_stats.late_ack;
stats.pto_ack = t_stats.pto_ack;
stats.pto_counts = t_stats.pto_counts;
}

Просмотреть файл

@ -3450,6 +3450,87 @@
"bug_numbers": [1655566],
"description": "HTTP3: number of times when a stream is blocked by the flow control while sendnig data."
},
"HTTP3_LOSS_RATIO": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 2000,
"n_buckets": 100,
"bug_numbers": [1677951],
"description": "HTTP3: packet loss ratio (multiply by 10000)."
},
"HTTP3_LATE_ACK_RATIO": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 2000,
"n_buckets": 100,
"keyed": true,
"bug_numbers": [1677951],
"description": "HTTP3: spurious retransmissions ratio (spurios_retransmission / packet sent * 10000)."
},
"HTTP3_LATE_ACK": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 10000,
"n_buckets": 100,
"keyed": true,
"bug_numbers": [1677951],
"description": "HTTP3: the number of spurious retransmissions."
},
"HTTP3_COUNTS_PTO": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 5000,
"n_buckets": 100,
"keyed": true,
"bug_numbers": [1677951],
"description": "HTTP3: the number of PTOs."
},
"HTTP3_DROP_DGRAMS": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 5000,
"n_buckets": 100,
"bug_numbers": [1677951],
"description": "HTTP3: the number of dropped datagrams."
},
"HTTP3_SAVED_DGRAMS": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 5000,
"n_buckets": 100,
"bug_numbers": [1677951],
"description": "HTTP3: the number of saved datagrams that are waiting for keys to be available."
},
"HTTP3_RECEIVED_SENT_DGRAMS": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "ddamjanovic@mozilla.com"],
"expires_in_version": "never",
"kind": "exponential",
"high": 100000,
"n_buckets": 100,
"keyed": true,
"bug_numbers": [1677951],
"description": "HTTP3: the number of received/sent packets."
},
"HTTP_CONTENT_ENCODING": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],