-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Performance is a bit strange #875
Comments
There could be two reasons - assigning the strings or res.end(). |
Why res.end() is so expensive? |
I don't know, if it is. Did you test it? |
I will test and report back
…On Mon, Aug 26, 2024, 10:00 AM gittiver ***@***.***> wrote:
I don't know, if it is. Did you test it?
—
Reply to this email directly, view it on GitHub
<#875 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJQHCMXL37RUPUQAP7WJSTZTLHCTAVCNFSM6AAAAABMZQIYUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZGQ3TSNBVHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I test the following two codes: CROW_ROUTE(app, "/hello")
([](const crow::request&) {
crow::response res;
res.add_header("Content-Type", "plain/text");
res.body = "hello world";
return res;
}); and CROW_ROUTE(app, "/hello")
([](const crow::request&) {
crow::json::wvalue x({{"zmessage", "Hello, World!"},
{"amessage", "Hello, World2!"}});
return x;
}); The Request/Sec is just 9580 Running 30s test @ http://127.0.0.1:18080/hello
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 41.24ms 2.16ms 43.05ms 99.72%
Req/Sec 802.88 79.81 1.29k 70.67%
287816 requests in 30.04s, 57.42MB read
Requests/sec: 9580.85
Transfer/sec: 1.91MB I have no idea about the test result. |
I did another test, use code CROW_ROUTE(app, "/hello")
([](const crow::request&) {
return "hello world";
}); The Requests/sec is 337253.80, the cpu usage is 485% CROW_ROUTE(app, "/hello")
([](const crow::request&) {
crow::response res;
res.add_header("Content-Type", "plain/text");
res.body = "hello world";
return res;
}); The Requests/sec is 9586.31, the cpu usage is 25% Is there some locks to block? |
For me, it looks like res.add_header(...) let the handler run much longer.
Just to get sure for the function. |
btw. what is the used hardware? In the logs should be visible how many concurrent accesses are possible. |
That is. I test this code, and the Requests/sec is 334266.41. |
I've set the logging level to Warning for the purpose of stress testing. The test results should have nothing to do with the hardware, I think. |
self_t& multithreaded() multithreaded is using the hardware_concurrency level, thats why I am asking. |
I have 8 concurrency threads. 11th Gen Intel® Core™ i7-1165G7 × 8, 40GiB RAM, Ubuntu 24.04 |
I test Crow performance using the blowing code
Then run wrk
wrk -t12 -c400 -d30s http://127.0.0.1:18080/hello
The result shows
I changed the code like blow
Then run the same wrk command
wrk -t12 -c400 -d30s http://127.0.0.1:18080/hello
Why is there such a big difference in performance?
The text was updated successfully, but these errors were encountered: