Skip to content

Commit

Permalink
provide separate knob for doing jumpstart without previous information
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Nov 6, 2023
1 parent a05ec4e commit 52dd84a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
4 changes: 4 additions & 0 deletions include/quicly.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ struct st_quicly_context_t {
* the connection.
*/
uint64_t max_initial_handshake_packets;
/**
* jumpstart delivery rate to be used when there is no previous information
*/
uint32_t default_jumpstart_cwnd_bytes;
/**
* maximum CWND to be used by jumpstart
*/
Expand Down
6 changes: 4 additions & 2 deletions lib/defaults.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const quicly_context_t quicly_spec_context = {NULL,
0, /* ack_frequency */
DEFAULT_HANDSHAKE_TIMEOUT_RTT_MULTIPLIER,
DEFAULT_MAX_INITIAL_HANDSHAKE_PACKETS,
0, /* max_jumpstart_cwnd */
0, /* default_jumpstart_cwnd_bytes */
0, /* max_jumpstart_cwnd_bytes */
0, /* enlarge_client_hello */
1, /* enable_ecn */
0, /* use_pacing */
Expand Down Expand Up @@ -82,7 +83,8 @@ const quicly_context_t quicly_performant_context = {NULL,
0, /* ack_frequency */
DEFAULT_HANDSHAKE_TIMEOUT_RTT_MULTIPLIER,
DEFAULT_MAX_INITIAL_HANDSHAKE_PACKETS,
0, /* max_jumpstart_cwnd */
0, /* default_jumpstart_cwnd_bytes */
0, /* max_jumpstart_cwnd_bytes */
0, /* enlarge_client_hello */
1, /* enable_ecn */
0, /* use_pacing */
Expand Down
38 changes: 22 additions & 16 deletions lib/quicly.c
Original file line number Diff line number Diff line change
Expand Up @@ -6618,23 +6618,29 @@ int quicly_receive(quicly_conn_t *conn, struct sockaddr *dest_addr, struct socka
conn->super.remote.address_validation.validated = 1;
/* jumpstart if possible */
if (conn->super.ctx->max_jumpstart_cwnd_bytes != 0 && conn->egress.cc.type->cc_jumpstart != NULL &&
conn->super.ctx->use_pacing && conn->super.stats.jumpstart.prev_rate != 0 &&
conn->super.stats.jumpstart.prev_rtt != 0) {
/* For the purpose of calculating jumpstart CWND, we use minRTT if available. There could be cases where we do not
* have an RTT estimate (i.e., we receive no ACKs but handshake messages that pushes the handshake forward. If that
* is the case, we estimate the RTT based on the connection lifetime. This value might become larger than necessary
* but that is fine because that would reduce our send rate. */
uint64_t rtt = conn->egress.loss.rtt.minimum;
if (rtt == UINT32_MAX)
rtt = conn->stash.now - conn->created_at;
if (rtt <= UINT32_MAX) {
double jumpstart_cwnd =
derive_jumpstart_cwnd(conn->super.ctx, (uint32_t)rtt, conn->super.stats.jumpstart.prev_rate,
conn->super.stats.jumpstart.prev_rtt);
if (jumpstart_cwnd >= conn->egress.cc.cwnd * 2) {
conn->super.stats.jumpstart.cwnd = (uint32_t)jumpstart_cwnd;
conn->egress.cc.type->cc_jumpstart(&conn->egress.cc, jumpstart_cwnd, conn->egress.packet_number);
conn->super.ctx->use_pacing) {
uint32_t jumpstart_cwnd = 0;
if (conn->super.stats.jumpstart.prev_rate != 0 && conn->super.stats.jumpstart.prev_rtt != 0) {
/* Careful Resume: for the purpose of calculating jumpstart CWND, we use minRTT if available. There could be
* cases where we do not have an RTT estimate (i.e., we receive no ACKs but handshake messages that pushes the
* handshake forward. If that is the case, we estimate the RTT based on the connection lifetime. This value
* might become larger than necessary but that is fine because that would reduce our send rate. */
uint64_t rtt = conn->egress.loss.rtt.minimum;
if (rtt == UINT32_MAX)
rtt = conn->stash.now - conn->created_at;
if (rtt <= UINT32_MAX) {
jumpstart_cwnd =
derive_jumpstart_cwnd(conn->super.ctx, (uint32_t)rtt, conn->super.stats.jumpstart.prev_rate,
conn->super.stats.jumpstart.prev_rtt);
}
} else {
/* jumpstart without previous information */
jumpstart_cwnd = conn->super.ctx->default_jumpstart_cwnd_bytes;
}
/* jumpstart when it is likely to make difference */
if (jumpstart_cwnd >= conn->egress.cc.cwnd * 2) {
conn->super.stats.jumpstart.cwnd = (uint32_t)jumpstart_cwnd;
conn->egress.cc.type->cc_jumpstart(&conn->egress.cc, jumpstart_cwnd, conn->egress.packet_number);
}
}
}
Expand Down

0 comments on commit 52dd84a

Please sign in to comment.