4 ms·
It buys you the stack size of each thread which only matters if you have a stupid amount of connections. In this article[1] the author makes a comparison betwee
by matthewaveryusa 10y ago
It buys you the stack size of each thread which only matters if you have a stupid amount of connections.
In this article[1] the author makes a comparison between the 2 models and 7000 concurrent users will chew up 450MB of stack space. Of course this is adjustable.
[1] http://byteworm.com/evidence-based-research/2017/03/04/comparing-the-performance-of-synchronous-versus-asynchronous-network-io/ http://byteworm.com/evidence-based-research/2017/03/04/compa...
- davesque 10y agoHow do you save on stack space with asyncio? Don't you have to keep the coroutine object in memory somewhere?
- bschwindHN 10y agoI think the idea is that these "coroutine objects" (or the equivalent structure in whatever language) is smaller than the typical stack size for a thread. For example, the default stack size on Windows is 1 MB. So if you have a thread per connection, obviously this is going to take up a decent amount of memory. I'm guessing the answer to this is a thread pool so your memory usage doesn't blow up. https://msdn.microsoft.com/en-us/library/windows/desktop/ms686774(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...
- hawski 10y agoOn most Linux systems stack is allocated with mmap with overcommiting. Until first write all those pages will share same zeroed page AFAIK. Then only overwritten pages will be allocated. Am I wrong?