crow
crow copied to clipboard
Crow being "very fast"
Hi, I have been using Crow for a real time project in which requests are made using HTTP post (REST + JSON) and a response is created on the fly (again JSON).
The size of the json object is about 1000 bytes. With a single connected user (using Apache AB/Jemeter etc) I get consistent results with an average of only ~2500 requests per second on a strong 10 CPU machine on EC2.
No business logic is involved, only parsing JSON and creating a JSON object back. Has anyone had better results? I am using the jsonxx lib since the default json lib was even slower.
I really need around 20,000 RPS at the bare minimum. Using netty/vertx.io with the same JSON I get around 25,000 RPS.
Any insights would be appreciated.
You really need to show us (or, maybe, stackoverflow) some code / build options / etc. it could be aggressive string caching with netty, or something like this. http://kellabyte.com/2013/08/20/http-response-caching-in-haywire/ here's a related interesting article, btw.
If you need a serious real-time performance, how about writing a server over binary protocols using FlatBuffer or CapNProto ? HTTP and JSON encoding/decoding affect the performance.
It seems like that asio
and crow
copying send buffers more times than netty.
btw @GP-GPU did you try rapidjson? (benchmarks: https://github.com/miloyip/nativejson-benchmark)
Thank you for the replies. I am going to investigate further and come back. Best,
@GP-GPU how's investigation going?
I moved to using RapidJson when handling req.body which is much faster than the default json lib. Also, when producing json, i use fmt::fromat lib which is also much faster.
thanks, I was wondering about fmt::format too.
Guess this issue can be closed now, though maybe you should make a pull request with edited README .md
with a note about rapidjson.
@QuantScientist3 or anyone else
Could you show a simple example of how you used RapidJson in the crow endpoint? Thanks a lot!