Skip to content

Performance Degradation due to the change to poll() from select() #2111

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

Open
yhirose opened this issue Mar 14, 2025 · 2 comments
Open

Performance Degradation due to the change to poll() from select() #2111

yhirose opened this issue Mar 14, 2025 · 2 comments

Comments

@yhirose
Copy link
Owner

yhirose commented Mar 14, 2025

From 6e73a63, the benchmark tells the server performance is degraded on my M1 MacBook Pro.

cdc2230

[(cdc2230...)] ~/cpp-httplib/benchmark$ make
--------------------
 cpp-httplib latest
--------------------

Bombarding http://localhost:8080 for 5s using 10 connection(s)
[========================================================================================] 5s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec     56801.52    2552.63   60463.11
  Latency      174.29us    30.21us     3.87ms
  HTTP codes:
    1xx - 0, 2xx - 283995, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     9.26MB/s

6e73a63

[(6e73a63...)] ~/cpp-httplib/benchmark$ make
g++ -o server -std=c++11 -O2 -I.. -DCPPHTTPLIB_THREAD_POOL_COUNT=16 cpp-httplib/main.cpp
--------------------
 cpp-httplib latest
--------------------

Bombarding http://localhost:8080 for 5s using 10 connection(s)
[========================================================================================] 5s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec     45686.36    4232.86   49142.01
  Latency      217.01us    54.15us     6.39ms
  HTTP codes:
    1xx - 0, 2xx - 225098, 3xx - 0, 4xx - 0, 5xx - 0
    others - 3339
  Errors:
    dial tcp [::1]:8080: connect: connection refused - 3339
  Throughput:     7.34MB/s
@falbrechtskirchinger
Copy link
Contributor

falbrechtskirchinger commented Mar 14, 2025

Ouch. I have 3 immediate ideas I want to try. My schedule is a bit uncertain over the next 4-5 days, and I don't know if I have time beyond the cpp-httplib issues I've already committed to. But I will look into it once I'm free. Thank you for your patience!

Edit: Oh, and seeing as this is on macOS, I'll first have to replicate it on Linux.

@yhirose
Copy link
Owner Author

yhirose commented Mar 14, 2025

@falbrechtskirchinger, No rush! It's totally fine to work on this whenever you are available. (I also work on this project in my spare time. 😃)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants