Skip to content

Commit

Permalink
Better-behaved HBONE pooling (#931)
Browse files Browse the repository at this point in the history
* Attempt at smarter HBONE pooling between ztunnels

Signed-off-by: Benjamin Leggett <[email protected]>

* Lints

Signed-off-by: Benjamin Leggett <[email protected]>

* lints 2

Signed-off-by: Benjamin Leggett <[email protected]>

* Hmm

Signed-off-by: Benjamin Leggett <[email protected]>

* Fixup

Signed-off-by: Benjamin Leggett <[email protected]>

* Fixup

Signed-off-by: Benjamin Leggett <[email protected]>

* More comments

Signed-off-by: Benjamin Leggett <[email protected]>

* cleanup

Signed-off-by: Benjamin Leggett <[email protected]>

* fixup

Signed-off-by: Benjamin Leggett <[email protected]>

* Clean

Signed-off-by: Benjamin Leggett <[email protected]>

* Fix jemalloc

Signed-off-by: Benjamin Leggett <[email protected]>

* WIP: move out of proxyinfo

Signed-off-by: Benjamin Leggett <[email protected]>

* Evict pooled conns after $INTERVAL

Signed-off-by: Benjamin Leggett <[email protected]>

* Update src/proxy/pool.rs

Co-authored-by: Ian Rudie <[email protected]>

* Evict pooled conns after $INTERVAL

Signed-off-by: Benjamin Leggett <[email protected]>

* For now, just do the foolproof collision check

Signed-off-by: Benjamin Leggett <[email protected]>

* Don't be silly

Signed-off-by: Benjamin Leggett <[email protected]>

* Naming, review comments

Signed-off-by: Benjamin Leggett <[email protected]>

* Tidy Arcs+drains

Signed-off-by: Benjamin Leggett <[email protected]>

* Cleanups

Signed-off-by: Benjamin Leggett <[email protected]>

* Format

Signed-off-by: Benjamin Leggett <[email protected]>

* Use the fancy lockless outer map, drop realm-io

Signed-off-by: Benjamin Leggett <[email protected]>

* Cleanup comments

Signed-off-by: Benjamin Leggett <[email protected]>

* Fix outdent (review comment)

Signed-off-by: Benjamin Leggett <[email protected]>

* Fixups/review comments

Signed-off-by: Benjamin Leggett <[email protected]>

* resync

Signed-off-by: Benjamin Leggett <[email protected]>

* Droptests

Signed-off-by: Benjamin Leggett <[email protected]>

* fix testhang

Signed-off-by: Benjamin Leggett <[email protected]>

* add smarter evict test

Signed-off-by: Benjamin Leggett <[email protected]>

* Interesting failure

Signed-off-by: Benjamin Leggett <[email protected]>

* No, it's not

Signed-off-by: Benjamin Leggett <[email protected]>

* Make this a bit simpler

Signed-off-by: Benjamin Leggett <[email protected]>

* Separate out the connspawner

Signed-off-by: Benjamin Leggett <[email protected]>

* Tidy logging a bit

Signed-off-by: Benjamin Leggett <[email protected]>

* Add serverside keepalive

Signed-off-by: Benjamin Leggett <[email protected]>

* fixup

Signed-off-by: Benjamin Leggett <[email protected]>

* Just for kicks

Signed-off-by: Benjamin Leggett <[email protected]>

* D'oh - use mthread runtime for tests

Signed-off-by: Benjamin Leggett <[email protected]>

* Fix none race

Signed-off-by: Benjamin Leggett <[email protected]>

* Propagate connection establish errors

Signed-off-by: Benjamin Leggett <[email protected]>

* Cleanup

Signed-off-by: Benjamin Leggett <[email protected]>

* Work around local test server getting overloaded

Signed-off-by: Benjamin Leggett <[email protected]>

* Move the rest to multi_thread, chill out on iterations, work around test
rig flakes

Signed-off-by: Benjamin Leggett <[email protected]>

* Tidy comments

Signed-off-by: Benjamin Leggett <[email protected]>

* lints

Signed-off-by: Benjamin Leggett <[email protected]>

* Clarify comment

Signed-off-by: Benjamin Leggett <[email protected]>

---------

Signed-off-by: Benjamin Leggett <[email protected]>
Co-authored-by: Ian Rudie <[email protected]>
  • Loading branch information
bleggett and ilrudie authored Apr 26, 2024
1 parent 9e43a65 commit a44892b
Show file tree
Hide file tree
Showing 11 changed files with 1,697 additions and 279 deletions.
102 changes: 102 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ url = "2.2"
x509-parser = { version = "0.16", default-features = false }
tracing-log = "0.2"
backoff = "0.4.0"
pin-project-lite = "0.2"
pingora-pool = "0.1.0"
flurry = "0.5.0"

[target.'cfg(target_os = "linux")'.dependencies]
netns-rs = "0.1"
Expand Down
102 changes: 102 additions & 0 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ fn change_log_level(reset: bool, level: &str) -> Response<Full<Bytes>> {
async fn handle_jemalloc_pprof_heapgen(
_req: Request<Incoming>,
) -> anyhow::Result<Response<Full<Bytes>>> {
let mut prof_ctl = jemalloc_pprof::PROF_CTL.as_ref()?.lock().await;
let mut prof_ctl = jemalloc_pprof::PROF_CTL
.as_ref()
.expect("should init")
.lock()
.await;
if !prof_ctl.activated() {
return Ok(Response::builder()
.status(hyper::StatusCode::INTERNAL_SERVER_ERROR)
Expand All @@ -418,7 +422,7 @@ async fn handle_jemalloc_pprof_heapgen(
let pprof = prof_ctl.dump_pprof()?;
Ok(Response::builder()
.status(hyper::StatusCode::OK)
.body(Bytes::from(pprof?).into())
.body(Bytes::from(pprof).into())
.expect("builder with known status code should not fail"))
}

Expand Down
Loading

0 comments on commit a44892b

Please sign in to comment.