boazsegev / facil.io

Your high performance web application C framework
http://facil.io
MIT License
2.11k stars 139 forks source link

Unlimited threads in facil.io - 0.7.x HTTP / WebSockets Server #150

Open zkwasm opened 1 year ago

zkwasm commented 1 year ago

Hi All,

I have following the guide to create a HTTP server: https://facil.io/0.7.x/index

Then, I do a stress test on the created HTTP server. There are 5000 successful HTTP request/response on the server, it is OK, but when I check the status of the server, I found the server forked 5000 threads and these threads never terminate.

There is an option "max_clients", I set max_clients = 100 and test again, the server still forked 5000 threads and these threads never terminate.

Is something wrong? or I miss some important information...

Sincerely, Tom.

boazsegev commented 1 year ago

The server doesn't usually fork any threads. In the example the server uses 1 thread and it should be able to serve tens of thousands of concurrent clients.

Am I missing something? Are you spawning your own threads?