Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Gevent gives you the ability to deal with blocking requests. It does not give you the ability to run on multi-core.</p> <p>There's only one greenlet (gevent's coroutine) running in a python process at any time. The real benefit of gevent is that it is very powerful when it deals with I/O bottlenecks (which is usually the case for general web apps, web apps serving API endpoints, web-based chat apps or backend and, in general, networked apps). When we do some CPU-heavy computations, there will be <em>no</em> performance-gain from using gevent. When an app is I/O bound, gevent is pure magic.</p> <p>There is one simple rule: Greenlets get switched away whenever an I/O-operation would block or when you do the switch explicitly (e.g. with gevent.sleep() )</p> <p>The built-in python threads actually behave in the same (pseudo) "concurrent" way as gevent's greenlets. </p> <p>The key difference is this - greenlets use cooperative multitasking, where threads use preemptive multitasking. What this means is that a greenlet will never stop executing and "yield" to another greenlet unless it uses certain "yielding" functions (like gevent.socket.socket.recv or gevent.sleep). </p> <p>Threads, on the other hand, will yield to other threads (sometimes unpredictably) based on when the operating system decides to swap them out.</p> <p>And finally, <em>to utilize multi-core in Python</em> - if that's what you want - we have to depend on the multiprocessing module (which is a built-in module in Python). This "gets around GIL". Other alternatives include using Jython or executing tasks in parallel (on different CPUs) using a task queue, e.g. Zeromq.</p> <p>I wrote a very long explanation here - <a href="http://learn-gevent-socketio.readthedocs.org/en/latest/">http://learn-gevent-socketio.readthedocs.org/en/latest/</a>. If you care to dive into the details. :-D</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload