I'm having a bit of trouble understanding the differences between these three frameworks:
These three frameworks can be used to run code at the same time but do this in different way using a different amount of threads/processes or codestyle. This is how I'm understanding the differences right now:
- Tornado/Twisted use asynchronous code controlled by an I/O loop. This allows the code to be ran on a single thread (multiple threads are useless because if you have non-blocking code this is unnecessary)
- Celery uses a task based system to run code asynchronously, the code in itself is still synchronous. A main process exists that is able to distribute the different tasks between other workers on different processes.
- Gevent uses a thread based system and spawns a thread to process different incomming connections.
The Questions I'm having right now are:
- Is my understanding of these frameworks correct?
- The major difference between a thread and process is that different threads use the same memory whereas processes do not. Is one process normally run on one server core? (And thus making Celery hard to implement on a small server)
- If we are talking about webapplications and sockets:
Tornado/Twisted Are able to accept (almost) any amount of sockets because they use asyncronous code and queue the request in the I/O loop.
Are Celery/Gevent able to this? Do they have to spawn a new process/thread to be able to accept a new socket?
I'm trying to figure out which of these technologies is best suited to built a real-time web application.