3 ms·
What matters is that the server app uses as much CPU as it can when it needs it. With a sync server, a worker is inactive as long as it is waiting on IO, so yo
by martius 6y ago
What matters is that the server app uses as much CPU as it can when it needs it.
With a sync server, a worker is inactive as long as it is waiting on IO, so you need enough workers to maximize the chance that all workers are busy, else, some clients are waiting even if you've got the CPU to deal with them.
With an async server, a single worker handles many clients simultaneously, in theory, a single worker per core is sufficient to eat all the CPU available.
- jordic 6y agowith asyncio we deploy a thread per worker (loop), and a worker per core. We also move cpu bound functions to a thread pool