Eventlet
一直在研究openstack的代码,发现eventlet是openstack project中很重要的一个module,因此觉得很有必要把它详细的总结一下,好容易明白一些很magic的功能如何实现的,更加体现了python的简洁。
首先需要明白的是eventlet究竟是什么?
官网是如下描述的:
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 .
-
ensure that the developer uses a blocking style of programming that is
similar to threading, but provide the benefits of non-blocking I/O.
-
The event dispatch is implicit, which means you can easily use
Eventlet from the Python interpreter, or as a small part of a larger
application.
Eventlet其实是并发(concurrent)的网络库
Eventlet使用了 epoll或libevent实现了大规模非阻塞IO
使用协程保证开发正能够使用阻塞的开发模式,但是提供了no-blocking IO的效率。
Module Reference
-
backdoor – Python interactive interpreter within a running process
-
corolocal – Coroutine local storage
-
debug – Debugging tools for Eventlet
-
db_pool – DBAPI 2 database connection pooling
-
Constructor Arguments
-
DatabaseConnector
-
event – Cross-greenthread primitive
-
greenpool – Green Thread Pools
-
greenthread – Green Thread Implementation
-
pools - Generic pools of resources
-
queue – Queue class
-
semaphore – Semaphore classes
-
timeout – Universal Timeouts
-
websocket – Websocket Server
-
wsgi – WSGI server
-
SSL
-
Non-Standard Extension to Support Post Hooks
-
eventlet.green.zmq – ?MQ support
-
zmq – The pyzmq ?MQ python bindings
阅读(3465) | 评论(0) | 转发(0) |