Commit Graph

50 Commits

Author SHA1 Message Date
Benjamin Saunders b42e21e74d Make SendStream::finish synchronous
`await`ing on this was error-prone and not very useful, since it gave
little insight into application state, and was redundant to `stopped`.
2024-05-03 11:52:44 -07:00
Dirkjan Ochtman 3be1ab5ab2 Upgrade to rcgen 0.13 2024-04-22 09:45:53 +02:00
Dirkjan Ochtman a85a4c12ee Update rustls to 0.23 and ring to 0.17 2024-04-22 09:45:53 +02:00
Dirkjan Ochtman 07e428169b proto: deduplicate rustls ClientConfig setup 2024-04-22 09:45:53 +02:00
Benjamin Saunders 092a7686a4 Enable PMTUD by default when appropriate 2023-05-06 08:05:17 +02:00
Dirkjan Ochtman 3eb26361db quinn: take Arc<dyn Runtime> directly 2023-04-14 16:08:01 -07:00
Adolfo Ochagavía 2d48482180 Use PLPMTUD in bench, perf and examples
Sponsored by Stormshield
2023-04-04 17:40:20 -07:00
Benjamin Saunders 7d51d2e57e Remove Incoming stream in favor of Endpoint::accept 2022-10-23 08:18:42 +02:00
Benjamin Saunders 6e4bcbb2fc Drop NewConnection in favor of simpler API 2022-09-27 11:08:26 +02:00
Benjamin Saunders ffa85f2c43 Abstract out async runtime
Co-authored-by: Yureka <yuka@yuka.dev>
2022-07-05 09:06:31 -07:00
Benjamin Saunders 7ed94be3e4 Provide inherent next methods on streams
Allows for convenient use in async blocks by downstream code without a
futures_util dependency.
2021-12-21 07:03:27 +01:00
Benjamin Saunders b923c4c8b0 Pass SocketAddr by value
We always consume this by value in the end, and it's a little more
ergonomic.
2021-10-29 20:12:45 +02:00
Benjamin Saunders 5d1b6a101b Remove EndpointBuilder
Now that rustls configuration is more straightforward, this is not
adding significant value.
2021-10-29 20:12:45 +02:00
Benjamin Saunders 495d2927cb Remove certificate newtypes 2021-10-29 08:02:13 +02:00
Dirkjan Ochtman fed3c5cb39 Require explicit construction of ServerConfigs 2021-09-29 10:12:44 -07:00
Dirkjan Ochtman a7efd92044 Require explicit construction of ClientConfigs 2021-09-29 10:12:44 -07:00
Chris Connelly e63dd77376 Make TransportConfig setters infallible
For most setters this was just a case of changing the signature to take
a `VarInt`.

`max_idle_timeout` was a bit more involved in order to maintain a usable
conversion from `Duration`. The internal representation was changed from
`Duration` from `VarInt`, and an `IdleTimeout` newtype was introduced
for the setter signature. `IdleTimeout` contains a `VarInt`-encoded
millisecond value, and has a fallible conversion from `Duration`. The
use of a newtype is preferable to a direct `Duration` -> `VarInt`
encoding since there could be other `VarInt`-encoded values in future
that use a different resolution than milliseconds.

These changes allow callers to avoid the type-level possibility of error
if they have a `VarInt` (or a value that can be converted infallibly
into one). Fallible conversion from `VarInt` is still convenient with
`TryInto`, and callers can handle the conversion errors without the
indirection of `ConfigError`.

Closes #1176.

BREAKING CHANGE: The `max_concurrent_bidi_streams`,
`max_concurrent_uni_streams`, `stream_receive_window`, and
`receive_window` methods on `TransportConfig` now take `VarInt`
arguments and return `&mut Self`. `TransportConfig::max_idle_timeout`
now takes an `IdleTimeout` argument and returns `&mut Self`.
2021-09-19 18:30:43 -07:00
Marcel Märtens b224d1d0fa switch to futures_utils in tests and benches, also use futures_utils isntead of futures_core 2021-08-11 10:27:32 +02:00
Dirkjan Ochtman a280b7770f quinn: unify ordered and unordered read APIs 2021-01-30 10:09:09 +01:00
Dirkjan Ochtman 8b8f6401bf quinn: properly await client connection setup in benchmarks 2021-01-28 11:58:15 -08:00
Dirkjan Ochtman 51685fb760 Upgrade to tokio 1, bytes 1 and rustls 0.19 2021-01-25 08:53:00 +01:00
Benjamin Saunders 1e5a538221 Limit concurrent streams rather than accept queue size
Previously, we limited the number of streams that could be opened by
the peer but not `accept`ed by the application. However, to guarantee
bounded resource use, applications will typically want to limit the
number of streams they process concurrently. While this could
be *approximately* implemented at the application layer by controlling
calls to accept, that approach has a significant drawback: If streams
are slow to process, the worst-case per-stream latency observed by a
peer who opens the maximum number of streams can be arbitrarily bad,
because streams may be opened above the limit the local application is
willing to process. Reducing the number of unaccepted streams
tolerated can reduce the proportion of streams affected, but reducing
it too low will increase the number of round trips required to open
any given number of streams, increasing average latency significantly.

As a side benefit, this reduces the effort needed for applications to
limit concurrency to a fixed quantity, which is expected to be the
overwhelmingly common case. Should a use case for dynamic concurrency
limits arise, we can expose a setter.
2021-01-22 11:39:00 -08:00
Dirkjan Ochtman 17fe82b598 Apply clippy fixes for 1.49 2021-01-01 11:16:05 -08:00
Matthias Einwag 64c97b6af0 Extend benchmark for concurrent streams
This extends the "cargo bench" benchmark to test transmission of data
on multiple streams in parallel.

Ideally we would want all transmission to take a similar amount of time
(bandwidth shared fairly), and the overall throughput to stay the same
or increase (but never degrade) when multiple streams are in use.

The benchmark can not show the fairness aspect very well, since it only
prints an overall throughput. But it shows that performance with
multiple streams stays similar.

Output:

```
running 4 tests
test large_data_10_streams  ... bench: 180,761,260 ns/iter (+/- 12,090,679) = 58 MB/s
test large_data_1_stream    ... bench:  18,459,500 ns/iter (+/- 3,804,219) = 56 MB/s
test small_data_100_streams ... bench:   4,600,890 ns/iter (+/- 373,842)
test small_data_1_stream    ... bench:      71,019 ns/iter (+/- 34,298)
```

I also increased the size of the LARGE_DATA payload from 128kB to
1MB, since 128kB didn't show quinn peak performance.
2020-12-28 14:05:12 +01:00
Dirkjan Ochtman d5b47f601d Unwrap unused results from invalid config values 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman e391c5d05b Remove redundant pattern matching 2020-06-04 22:36:09 +02:00
Benjamin Saunders 0a62e093a6 Replace criterion with bencher 2020-03-31 13:20:30 +02:00
Benjamin Saunders 33a7eb49a4 Fix panic in criterion benchmarks 2020-02-03 06:44:36 +01:00
Benjamin Saunders 5774071b48 Spawn driver tasks implicitly 2020-01-13 09:54:26 +01:00
Benjamin Saunders 09729ebd23 Opaque config structs
Only exposing setters improves forwards compatibility and error
checking.
2020-01-13 08:53:05 +01:00
Benjamin Saunders 1bbb65b6a1 Lint cleanup 2019-12-22 21:13:31 +01:00
Benjamin Saunders 03cd3e27f2 Correct style for latest rustfmt 2019-12-22 09:30:02 +01:00
Benjamin Saunders 875de9f282 Remove datagram benchmarks
These don't make sense when sending always succeeds immediately. They should
return as a stand-alone benchmark that measures the number *received*.
2019-12-17 20:29:08 +01:00
Benjamin Saunders 07e1f33805 Simplified, synchronous datagram send API
Applications sending datagrams are expected to prioritize freshness, at
the cost of reliability if necessary. Blocking datagram sends when the
buffer is full is inconsistent with that, particularly if congestion
arises due to a low-priority bulk data stream. Instead, we should opt to
discard old data in favor of newly sent data. The significant API and
implementation simplification is a nice bonus.
2019-12-17 20:29:08 +01:00
daxpedda 7233455078 Update tokio, futures and bytes. (#528) 2019-12-02 10:42:05 +01:00
Timon Post ac810125c1 merge imports 2019-11-19 08:23:35 +01:00
Benjamin Saunders ec576047e0 Benchmark packet-sized application datagrams 2019-11-16 20:17:59 +01:00
Benjamin Saunders f91df78e77 Tweak benchmarks
Improves comparison between streams and datagrams
2019-11-02 21:11:33 +01:00
Benjamin Saunders a957bf4aa2 Replace slog with tracing 2019-10-29 10:36:50 +01:00
Benjamin Saunders 84d44e40a1 Clarify small stream benchmark character
Hopefully this will reduce apples-to-oranges comparisons with
datagrams.
2019-10-24 10:27:32 +02:00
Benjamin Saunders eba7b65bff Benchmark datagrams 2019-10-24 10:27:32 +02:00
Benjamin Saunders bc3e5af68b Refactor benchmarks 2019-10-22 10:10:55 +02:00
Benjamin Saunders 2dcb084347 Decouple incoming streams of differing directionalities 2019-09-29 07:38:30 +02:00
Benjamin Saunders 8e1c6b605e Remove ToSocketAddrs from EndpointBuilder::bind
Improves consistency with Endpoint::connect and removes the
possibility of silent blocking should the user pass in a domain
name. The generic API was originally motivated by the convenience of
passing in numeric addresses as strings, but `.parse().unwrap()` is
pretty easy too.
2019-09-29 07:21:06 +02:00
Benjamin Saunders d07dc907ad Update for async/await 2019-09-28 10:23:26 +02:00
Benjamin Saunders f50dd9f54a Restore NewConnection struct for parts of a connection
This enables forwards-compatibility with future extensions such as
a datagram stream.
2019-08-25 14:50:01 -07:00
Dirkjan Ochtman b70e939893 Upgrade to criterion 0.3 2019-08-25 13:29:44 -07:00
Dirkjan Ochtman 45ee97bd5a Upgrade to rcgen 0.4 2019-06-18 14:11:40 -07:00
Dirkjan Ochtman 658108729f Adapt to changes in unordered read API 2019-05-21 18:15:19 +02:00
Dirkjan Ochtman 7c35af9f04 Backport benchmarks from nightly branch 2019-05-20 21:25:38 +02:00