2010-04-19

Syncless: Non-blocking WSGI server and networking library for Stackless Python

This blog post is a release announcement of the software named Syncless I've been developing recently for high-performance, low-memory, single-process, single-threaded, lock-free network communication (TCP/IP client and server) in Python, using coroutines for apperent parallel processing. I needed something which needs less memory than pre-forking worker instances, but doesn't require complicated and error-prone synchronization mechanisms (such as mutexes in a multi-threaded program).

Syncless is an experimental, lightweight, non-blocking (asynchronous) client and server socket network communication library for Stackless Python 2.6. For high speed, Syncless uses libevent, and parts of Syncless' code is implemented in C (Pyrex). Thus Syncless can be faster than many other non-blocking Python communication libraries. Syncless contains an asynchronous DNS resolver (using evdns) and a HTTP server capable of serving WSGI applications. Syncless aims to be a coroutine-based alternative of event-driven networking engines (such as Twisted and FriendFeed's Tornado), and it's a competitor of gevent, pyevent, Eventlet and Concurrence.

Version 0.03 of Syncless has been released. It is a complete rewrite so it has drop-in replacements for built-in Python socket.socket, socket.gethostbyname (etc.), ssl.SSLSocket, time.sleep and select.select. The replacement implementations... is easily monkey-patchable, so legacy (blocking) pure Python I/O code can be made non-blocking without a code change. Core functionality is now written in Pyrex/Cython for greater speed.

No comments:

Post a Comment