-
Notifications
You must be signed in to change notification settings - Fork 12k
perf(@angular/ssr): optimized request handling performance #29909
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28f111a
to
b369eea
Compare
This commit refactors request handling logic, leading to significant performance improvements. **Benchmark** | Metric | 19.2.x Branch | Main Branch | After Optimization | Improvement vs 19.2.x | Improvement vs Main | |--------------------|-----------------------|----------------------|---------------------|-----------------------|-----------------------| | Latency (Avg) | 2473.94 ms | 2655.35 ms | 2385.85 ms | ~3.6% | ~10.1% | | Latency (50%) | 2445.67 ms | 2615 ms | 2416.33 ms | ~1.2% | ~7.6% | | Latency (97.5%) | 2640.5 ms | 3309 ms | 2561.5 ms | ~3.0% | ~22.6% | | Req/Sec (Avg) | 398.32 | 364.54 | 400.12 | ~0.4% | ~9.8% | | Bytes/Sec (Avg) | 8.41 MB | 7.7 MB | 8.45 MB | ~0.5% | ~9.7% | | Total Requests | 13,000 | 12,000 | 13,000 | 0% | ~8.3% | **Test Details:** * **Command:** `npx autocannon -c 100 -d 30 -p 10 http://localhost:<port>` * **Parameters:** * `-c 100`: 100 concurrent connections * `-d 30`: 30 seconds duration * `-p 10`: 10 pipelining factor * **Iterations:** 3 tests were run on each of the Main Branch and the 19.2.x Branch, and 3 tests were run after optimization. Average of each set of tests was used for the comparison. * **Samples:** 30 samples were collected per test run for Req/Bytes counts. The optimized request handling logic (After Optimization) shows significant improvements across all key performance metrics compared to the original logic on the Main Branch. The regression observed in the Main Branch is attributed to the newly added header flushing logic. When compared to the 19.2.x branch, the optimized code delivers similar performance. Latency is slightly reduced, while request throughput (Req/Sec) and data transfer rate (Bytes/Sec) have seen a slight increase. The total number of requests handled remains consistent with the 19.2.x branch.
b369eea
to
ce0a56b
Compare
jkrems
approved these changes
Mar 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! 🎉
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
area: @angular/ssr
area: performance
Issues related to performance
target: major
This PR is targeted for the next major release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit refactors request handling logic, leading to significant performance improvements.
Benchmark
Test Details:
npx autocannon -c 100 -d 30 -p 10 http://localhost:<port>
-c 100
: 100 concurrent connections-d 30
: 30 seconds duration-p 10
: 10 pipelining factorThe optimized request handling logic (After Optimization) shows significant improvements across all key performance metrics compared to the original logic on the Main Branch. The regression observed in the Main Branch is attributed to the newly added header flushing logic.
When compared to the 19.2.x branch, the optimized code delivers similar performance. Latency is slightly reduced, while request throughput (Req/Sec) and data transfer rate (Bytes/Sec) have seen a slight increase. The total number of requests handled remains consistent with the 19.2.x branch.