Commit Graph

2755 Commits

Author SHA1 Message Date
Thomas de Zeeuw 49475c22b2 Update to socket2 v0.4 2021-03-21 14:39:11 +01:00
Matthias Einwag a5f8325ee7 Create ClientConfig lazily in EndpointBuilder
Creating a `ClientConfig` can on some platforms take an excessive amount
of time, likely due to rustls scanning the systems cert store.
This slows down all functions which make use of `quinn::Endpoint::builder()`,
even if the client config is known upfront and shared between mutliple connections.

In some tests I noticed an extra connection establishment time of 1s for
creating a client.

This changes will create the `ClientConfig` only if the Endpoint is built
when the `ClientConfig` hasn't been set by the application.

Server side code still suffers from the issue, since `ClientConfig`s there are not
known. However it might be less impacting, since a second of startup time for
a server matters less than for a client.
2021-03-20 11:14:31 -07:00
bstrie ab61ef89f5 Replace deprecated collections::Bound with ops::Bound 2021-03-18 15:06:07 -07:00
Matthias Einwag ff79550cd8 Print perf_client RPS in floating point format
For large requests and high latency connections the number
showed 0 most of the time which isn't too helpful.
2021-03-18 13:43:21 -07:00
Timon 99459cf64d Remove link to QUIC protocol page
This one is already mentioned under 'QUIC introduction'.
2021-03-15 21:22:17 +01:00
Timon 819eba6caa Update link to book. 2021-03-15 12:43:25 +01:00
Timon 1bf12365d0 Update SUMMARY.md 2021-03-15 11:12:26 +01:00
Timon c7d39b5bcc Make link point to correct md file. 2021-03-15 11:12:26 +01:00
daxpedda 3a6cf6bfc3 Re-export ConfigError
Specifically `TransportConfig::max_concurrent_bidi_streams` and `TransportConfig::max_concurrent_uni_streams` return `quinn_proto::ConfigError`.

This prevents consumers of `quinn` having to bring in `quinn-proto` just to use `ConfigError`, for example in their custom error type.
2021-03-12 10:28:50 -08:00
Benjamin Saunders 89e89d30fc Fix stream leak on stop after finish 2021-03-11 07:46:08 +01:00
Benjamin Saunders a471fd1849 Don't issue flow control credit for streams with known size
A stream's size is only known after we've issued at least that much
flow control credit, so the peer necessarily won't need any more. Our
logic to schedule credit issuing already uses similar judgement, so
this brings the last-minute sanity check into alignment.
2021-03-11 07:46:08 +01:00
Matthias Einwag f2bbc0e3fc Use a cheaper hash function
Rusts default HashMap and HashSet use siphash as a hash method to
protect again malicious input. The downside of siphash is that it is slightly
more expensive than a more primitive mechanism. The siphash operations
currently show up in quinn flamegraphs - even if they only act on 8byte
input data like Stream IDs.

The security properties of siphash are not really required in the context
of quic, where the hashmaps are used with 2 key types:
- Stream IDs: The valid range for those is predetermined by the maximum
  concurrent stream setting. The peer can't pick from a bigger range in
  order to get more hashes into the same bucket. Besides this, the risk of
  resource exhaustion via purely creating more requests/streams is already
  much higher than exhaustion of the pure maps.
- Connection IDs: Connection IDs which are inserted into tracking data
  structurues are created locally. The peer has no control over them.
2021-03-08 20:33:49 +01:00
Matthias Einwag 2870519f6e perf: Use dual stack socket for endpoints
Users found it rather confusing that binding to the default address
(::0) doesn't allow incoming connections via IPv4 on windows.
This change will allow for this, by using a IPv6 socket and
disabling IPv6-only on all platforms. This lets the windows and unix
implementations behave equally.
2021-03-08 06:38:34 +01:00
Matthias Einwag fe03f7d2de Rename perf server and client
The executable names conflicted with the interop server:

> The bin target `server` in package `perf v0.1.0 (C:\Users\matth\Code\rust\quinn\perf)` has the same output filename as the bin target `server` in package `interop v0.1.0 (C:\Users\matth\Code\rust\quinn\interop)`.
> Colliding filename is: C:\Users\matth\Code\rust\quinn\target\debug\server.pdb
> The targets should have unique names.
2021-03-08 06:38:34 +01:00
Matthias Einwag f1c7c561b9 Pass max_datagrams to poll transmit
This changes poll_transmit to accept the maximum number of datagrams
which are stored inside a single transmit.

The number wil be derived from the platforms capabilities. This will
automatically activate GSO on platforms which support it.
2021-03-08 06:36:37 +01:00
Matthias Einwag 6093956698 Store maximum segments in UdpCapabilities
This provides a bit more accurate information about a platforms limit
than just a boolean.
2021-03-08 06:36:37 +01:00
Dirkjan Ochtman 0f285bd751 perf: tweak style in bind_socket() 2021-03-04 12:36:49 -08:00
Dirkjan Ochtman 85dde101bd perf: adopt more convential crate layout 2021-03-04 12:36:49 -08:00
Dirkjan Ochtman 576ac22287 Update coverage workflow to run on main branch 2021-03-04 12:35:29 -08:00
Matthias Einwag da1014c913 Allow to set send and receive buffer sizes in perf application
Also default to 2MB, which provides reasonable baseline performance.
2021-03-04 11:01:42 +01:00
Matthias Einwag f38a877b76 Print perf server errors with context
This avoids losing error context
2021-03-04 11:01:42 +01:00
Matthias Einwag 516dcd8885 Use debug instead of trace messages in the perf server
This provides basic output without seeing all the quic packet info in between.
2021-03-04 11:01:42 +01:00
Dirkjan Ochtman dbbb4a9987 Enable CI for 0.6.x branch 2021-03-03 13:42:38 -08:00
Dirkjan Ochtman 70b7b298d7 Update Matrix link to point to current channel 2021-03-03 13:42:38 -08:00
Dirkjan Ochtman 25ba6f3c13 Update links to point to quinn-rs org 2021-03-03 13:42:38 -08:00
Benjamin Saunders b7e95fdba7 Pad ack-eliciting initial-bearing datagrams from servers
Quoth the spec: a server MUST expand the payload of all UDP datagrams
carrying ack-eliciting Initial packets to at least the smallest
allowed maximum datagram size of 1200 bytes.
2021-03-03 11:04:30 +01:00
Benjamin Saunders 9287a34d63 Remove obsolete safety asserts
These will cause spurious panics once
https://github.com/rust-lang/rust/pull/78802 is merged.
2021-03-03 07:49:21 +01:00
Matthias Einwag 5d4352a40d Wake up a stream only if stream window is not empty
This avoids a wakeup in case the connection window increased but the
stream window is still empty.
0.7.0
2021-03-02 10:08:06 +01:00
Matthias Einwag f16db0ba93 Wake up stream only if connection window is not empty
This avoids a wakeup in case the stream window increased but the
connection window is still empty.
2021-03-02 10:08:06 +01:00
Matthias Einwag 6c47d3a318 retry transmitting close frames
This changes makes sure we don't lose close frames when the first send attempt
is blocked by congestion control.
2021-03-02 09:16:01 +01:00
Matthias Einwag 312c0f041c Perf: Use owned buffers
Use zero-copy APIs when sending data in perf application.

Performance difference:
1. First line is before
2. Second line is after (but with only the download write change)

```
      │ Duration  │ FBL       | Upload Throughput | Download Throughput
──────┼───────────┼───────────┼───────────────────┼────────────────────
 AVG  │    5.00ms │    1.00ms │      332.82 MiB/s │        334.20 MiB/s
 AVG  │    5.00ms │    0.00ns │      332.64 MiB/s │        335.96 MiB/s
```

=> Makes less than 1%. Still neat to have
2021-03-02 09:13:00 +01:00
Benjamin Saunders bb6f76a7d9 Bump versions 2021-03-02 07:17:56 +01:00
Benjamin Saunders 61ee819d2a Remove version requirement for fuzzing
This subcrate isn't published, so it can use an unversioned path
dependency.
2021-03-02 07:17:56 +01:00
Matthias Einwag 3de2727b94 Perf: Prefer more efficient cipher suites
Prefer AES128 in order to maximize throughput
2021-03-02 07:01:16 +01:00
Matthias Einwag 82a065ac3e Make perf up and download more efficient
Pass a bigger buffer to write calls to minimize the amount of write calls.
2021-03-02 07:01:16 +01:00
Matthias Einwag 7700046af6 Aggregate perf stats and print them 2021-03-02 07:01:16 +01:00
Matthias Einwag 3bbb15181f Capture per request timings in perf client 2021-03-02 07:01:16 +01:00
Matthias Einwag f811d3635c Allow to specify the perf client to run for a certain amount of time 2021-03-02 07:01:16 +01:00
Matthias Einwag e8af8fd507 Make handling of uni and bidi streams equal
Uni response streams are now accepted as part of the
request lifecycle, which makes it easier to gather stats.
2021-03-02 07:01:16 +01:00
Matthias Einwag 12039602ae perf: use tokio::try_join instead of select
We want all subtasks to complete, and not only a single one.
2021-03-02 07:01:16 +01:00
Matthias Einwag 270016a1da Use owned buffer API for sending data in the bulk test
This avoids the allocation inside the the connection Mutex.
2021-03-02 06:49:34 +01:00
Matthias Einwag 31109bd16f Make owned bytes write APIs available in quinn
This extends the public quinn API to offer support for writing owned buffers.
Besides the universal `write_chunks` API which supports a variable amount
of buffers the API also offers convenience methods for writing either a
single buffer completely or an arbitrary amount of buffers completely.
2021-03-02 06:49:34 +01:00
Matthias Einwag 5ce48e1897 Account for offset=0 requiring no space
When a frame contained data for an offset of 0, the transmit logic did not
fully fill a packet. The reason for this is that the logic reserved 1 byte for
writing an offset. However storing offset 0 doesn't require 1 byte,
because it will be encoded with a special flag in the message header.

Without GSO, this isn't a huge issue. It mostly means we are wasting
1 byte per datagram.

However with GSO, this actually leads to data corruption:

When using GSO, and  packet isn't fully filled, it later gets padded
to MTU size. Padding a packet ending with a STREAM frame that
doesn't contain a length information is however invalid, and will let
the receiver assume the padding is part of part of the data. This means
the receiver will receive an extra `0` at the end of a stream - and
depending on the duplicate detection at the receiver either the 0
or the correct byte in the next packet will win.
2021-03-01 22:14:43 +01:00
Dirkjan Ochtman 62924202fa quinn-proto: reorder code from bytes_source module 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 4abf5a64e0 quinn-proto: merge bytes_source module into connection::streams::send 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 971265d9ff quinn-proto: provide datagrams API access through special-purpose type 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 61129c811e quinn-proto: move datagram write logic into DatagramState 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman 2637dfe575 quinn-proto: move incoming datagram frame handling into DatagramState 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman d25ce15239 quinn-proto: move datagram receive logic into DatagramState 2021-03-01 13:06:10 -08:00
Dirkjan Ochtman c6843a7c84 quinn-proto: derive Default for DatagramState 2021-03-01 13:06:10 -08:00