Monthly Archives: January 2013

Concurrent connections to Redis with gevent and redis-py

Redis is a powerful, lightning-fast key-value store. Gevent (1.0) is an event-driven concurrency framework for Python (based on greenlet and libev) allowing for highly concurrent networking and tackling the C10K problem. Redis-py, the well-established Redis client for Python, makes Python talk to Redis. The communication takes place through sockets and is request-response-based. A typical Redis-based Python application therefore is I/O-bound rather than CPU-bound. Furthermore, various features of Redis implicate that a request is not immediately followed by a response, making certain requests block the calling thread for an arbitrary amount of time. This is where gevent comes into play: it allows for concurrent execution of these blocking requests within coroutines. In this blog post, I am presenting a short code example integrating gevent with redis-py. Continue reading

Email through custom domain without setting up your own mail server: the MX record is the key (and services like Zoho)

Setting up an email stack on a Linux box is a challenge. While it is quite possible to get things running, it requires a tremendous amount of care and overview to harden the system from the security point of view and to maintain it. I spent the last days configuring and re-configuring and re-re-configuring postfix, dovecot, squirrelmail, and the whole MySQL-databases-unix-user-permissions tail. I believe I managed to do this properly (at this point I would like to acknowledge this particularly well-written and complete article). But do I still understand the configuration in half a year? Would I be able to maintain it properly? At the moment, I don’t think so. That’s why I do not like having this mail stack on my Linux box. It frightens me. For very simple cases like mine, there is a more elegant solution: making an external service provider manage the mail sent to the custom domain. Continue reading

WordPress deployment: super simple and super fast with nginx caching

WordPress (+plugins) is not exactly the most resource-efficient content management system. In order to go easy on CPU and memory, to guarantee short website load times, and to be able to stand up to page requests with high frequency, WordPress must be served from a cache rather than answering each request via PHP and from the database. In this post, you can find my nginx config for deploying PHP-FPM-based WordPress behind nginx whereas most of the requests are served from the nginx FastCGI cache. No changes to WordPress and no WordPress plugins are required. Continue reading