Re:Asynchronous Programming in Python: Asyncio
by petre on Monday May 01, 2017 @04:22PM
(#14241176)
You can do async/event based programming using coroutines instead of threads, thus achieving non blocking behaviour. Nginx does that for instance.
[ Parent
| on HN ]
Re:Asynchronous Programming in Python: Asyncio
by bullen on Monday May 01, 2017 @04:30PM
(#14241242)
Sure, but then you are not having all cores contributing to the same solution. Each nginx request is then distinct from every other request. And really then it's easier to scale with separate machines like google does in it's completely synchronous environment.
So you start a number of workers and distribute the load among them. At least that's one way to solve the problem in Perl/Python/Ruby. You can contribute to the same solution by passing data to a master process, or using shared memory.
In Erlang and Scala you can solve it even more ellegantly using actors and chanels. Go has goroutines and channels. All of these can span multiple cores.