benchmark: add a large JSON body scenario - #358
Merged
Conversation
The only scenario that exercises the body parsers, body-urlencoded, posts 57 bytes. uWS hands a body that small over in a single chunk, so the suite never measures the work of collecting a body that arrives in pieces, and changes to that path cannot show up in the results. Post 512kb of JSON instead, which is above the ~512kb chunk size uWS delivers bodies in, so the parser has to put several chunks together.
This was referenced Jul 31, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The suite has one scenario that goes through a body parser,
middlewares/body-urlencoded, and it posts 57 bytes. uWS hands a body that small to JS in a single chunk, so the parser never has to put anything together and the scenario cannot show the cost of collecting a body.This adds
middlewares/body-json-512kb, which posts 512kb of JSON throughexpress.json(). That is above the ~512kb chunk size uWS delivers bodies in, so the body arrives in several pieces and the accumulate path is actually exercised.The scenario validates on both frameworks (same status, same body hash). I could not run wrk locally since I am on Windows, so the numbers will come from this job.
I am also opening this separately from #357 on purpose: that PR changes how bodies are collected, and having this scenario measured on
mainfirst gives a baseline to compare it against.