Specifically the GreenPool class in Eventlet. I have tested some code to upload large files to S3 as individual pieces of a multipart upload. What I have noticed so far is that when using eventlet the CPU usage is much lower. Just looking for other pros and cons for Eventlet over just using threading. Thanks.
Eventlet is a concurrent networking library for Python that allows you to change how you run your code, not how you write it. It uses epoll or libevent for highly scalable non-blocking I/O.
The module "thread" treats a thread as a function, while the module "threading" is implemented in an object oriented way, i.e. every thread corresponds to an object.
A threading. Event object wraps a boolean variable that can either be “set” (True) or “not set” (False). Threads sharing the event instance can check if the event is set, set the event, clear the event (make it not set), or wait for the event to be set.
Practical Data Science using Python The newer threading module included with Python 2.4 provides much more powerful, high-level support for threads than the thread module discussed in the previous section. threading. activeCount() − Returns the number of thread objects that are active.
Basically, Eventlet green threads are to be considered a lightweight analog of OS threads for all practical purposes. Pros:
Cons:
You may also find this answer useful: Is a greenthread equal to a "real" thread
[1] "threading" library used by Eventlet https://github.com/python-greenlet/greenlet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With