Skip to content

Commit

Permalink
Merge pull request #204 from alexrudy/feature/client/pool-key-arena
Browse files Browse the repository at this point in the history
feat: Client pool interns keys
  • Loading branch information
alexrudy authored Oct 24, 2024
2 parents 4777f52 + df080eb commit 80d15cb
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 298 deletions.
4 changes: 2 additions & 2 deletions examples/single_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ async fn http2_client(
) -> Result<(), Box<dyn std::error::Error>> {
let client = tower::ServiceBuilder::new()
.layer(
ConnectionPoolLayer::new(
ConnectionPoolLayer::<_, _, _, UriKey>::new(
TcpTransport::<_, TcpStream>::default().without_tls(),
auto::HttpConnectionBuilder::<Body>::default(),
)
.with_optional_pool(Some(Default::default())),
)
.service(RequestExecutor::<HttpConnection<Body>, _, UriKey>::new());
.service(RequestExecutor::<HttpConnection<Body>, _>::new());

let authority = url.authority().unwrap().clone();

Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ httpbin:
hurl *args='':
cargo +{{rust}} run --features client,tls,tls-ring --example hurl -- {{args}}

profile:
cargo +{{rust}} run --release --features client,tls,tls-ring --example profile

# Launch jaeger
jaeger:
docker run -d -p16686:16686 -p4317:4317 -e COLLECTOR_OTLP_ENABLED=true jaegertracing/all-in-one:latest
6 changes: 3 additions & 3 deletions src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use super::conn::transport::TransportExt;
use super::conn::Connection;
use super::conn::Protocol;
use super::conn::Transport;
use super::pool::{self, PoolableConnection, PoolableStream};
use super::pool::{PoolableConnection, PoolableStream, UriKey};
use super::ConnectionPoolLayer;
use crate::service::RequestExecutor;
use crate::service::{Http1ChecksLayer, Http2ChecksLayer, SetHostHeaderLayer};
Expand Down Expand Up @@ -459,11 +459,11 @@ where
))
.layer(IncomingResponseLayer::new())
.layer(
ConnectionPoolLayer::new(transport, self.protocol.build())
ConnectionPoolLayer::<_, _, _, UriKey>::new(transport, self.protocol.build())
.with_optional_pool(self.pool.clone()),
)
.layer(SetHostHeaderLayer::new())
.layer(Http2ChecksLayer::<_, _, pool::UriKey>::new())
.layer(Http2ChecksLayer::new())
.layer(Http1ChecksLayer::new())
.service(RequestExecutor::new());

Expand Down
Loading

0 comments on commit 80d15cb

Please sign in to comment.