Chinaunix首页 | 论坛 | 博客
  • 博客访问: 421690
  • 博文数量: 83
  • 博客积分: 2622
  • 博客等级: 少校
  • 技术积分: 1345
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-17 08:59
个人简介

一直在努力

文章分类

全部博文(83)

文章存档

2014年(3)

2013年(9)

2012年(46)

2010年(25)

分类: Python/Ruby

2013-07-23 12:42:05

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


阅读(3377) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~