Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internally Arc Router #2476

Closed
wants to merge 3 commits into from
Closed

Conversation

davidpdrsn
Copy link
Member

Based on #2473.

With Router being Sync we can now store it as an Arc internally which should help a lot with cloning it.

This might impact #2449.

TODO

  • Changelog
  • Benchmark it and see if there is a difference

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, do we have any benchmarks to check the before/after for?

edit: Oh I see you have a TODO for that in the PR description.

axum/src/routing/mod.rs Outdated Show resolved Hide resolved
@davidpdrsn
Copy link
Member Author

Nice, do we have any benchmarks to check the before/after for?

Yeah we have some benchmarks in this repo. I'm gonna try and run them. Also curious if it impacts #2449

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, curious about the benchmark results!

@davidpdrsn
Copy link
Member Author

davidpdrsn commented Dec 30, 2023

Tested with cargo bench -- routing which runs a benchmark of a router with 1000 routes.

On main:

Running "routing" benchmark
  Beginning round 1...
  Benchmarking 10 connections @ http://0.0.0.0:60849/foo/bar/baz for 10 second(s)
    Latencies:
      Avg      Stdev    Min      Max
      0.19ms   0.06ms   0.09ms   2.07ms
    Requests:
      Total: 515851  Req/Sec: 51581.42
    Transfer:
      Total: 36.90 MB Transfer Rate: 3.69 MB/Sec

On this branch

Running "routing" benchmark
  Beginning round 1...
  Benchmarking 10 connections @ http://0.0.0.0:60837/foo/bar/baz for 10 second(s)
    Latencies:
      Avg      Stdev    Min      Max
      0.07ms   0.02ms   0.01ms   0.77ms
    Requests:
      Total: 1366847 Req/Sec: 136678.29
    Transfer:
      Total: 97.76 MB Transfer Rate: 9.78 MB/Sec

So went from 51.581 rps to 136.678. Thats pretty nuts 😅

@jplatte
Copy link
Member

jplatte commented Dec 30, 2023

Your dots in those numbers are in a weird position but yay 😄

Maybe we should look into running some benches in CI (measuring instruction counts for reproducibility) to catch obvious regressions in perf?

@davidpdrsn
Copy link
Member Author

Your dots in those numbers are in a weird position but yay 😄

lol sorry about that 😂

Maybe we should look into running some benches in CI (measuring instruction counts for reproducibility) to catch obvious regressions in perf?

Never tried something like that but worth a shot!

@jplatte
Copy link
Member

jplatte commented Jan 13, 2024

Superseded by #2483, right?

@davidpdrsn
Copy link
Member Author

Yes!

Not sure if we still require Sync for services or if the mutex approach is fine.

@davidpdrsn davidpdrsn closed this Jan 13, 2024
@davidpdrsn davidpdrsn deleted the david/arc-router branch January 13, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants