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

perf: reuse Request in a session #249

Merged
merged 5 commits into from
Aug 21, 2024
Merged

Conversation

kanarus
Copy link
Member

@kanarus kanarus commented Aug 21, 2024

Before Session created one pair of Request/Response for each incoming request, this means it performs Drop and initialization 2N times.

This PR changes this into initialize Request only once per one Session and clear & reuse it through one session.

Benchmark example

cargo run --bin param --no-default-features --release
wrk -H 'Connection: keep-alive' --connections 32 --threads 16 --duration 3s --timeout 1s 'http://localhost:3000/user/1234567890987654321'

Requests/sec

before after
1 705338.20 717771.62
2 709623.03 715556.64
3 705485.43 724493.01

@kanarus kanarus merged commit 5927256 into main Aug 21, 2024
3 checks passed
@kanarus kanarus deleted the perf/reuse_Request_in_session branch August 21, 2024 18:01
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.

1 participant