Contact Us
Python BlogDjango BlogBig DataSearch for Kubernetes AWS BlogCloud Services



High(er) Performance Single Server Hosting

October 14, 2010

The following post talks a bit about the hosting environment I built for my personal site. Please feel free to ask me questions about the following configuration and I will do my best to answer them. Now, let's light this candle. in the past has been a testbed I've used for getting more familiar with technologies used during my day job at Six Feet Up. I recently re-deployed the site on Plone4 Beta 3 with RelStorage using some of the technologies we deploy daily to create the best hosting environment possible for this site. 

At the head of the hosting chain, we have the Nginx web server. This is configured primarily to manage virtual hosting between and my soon-to-be-deprecated WordPress site. It also manages SSL for encrypted site access and authentication.

If the web request is for, it is passed to a FastCGI process, which in turn connects to the MySQL database on the back end. Nginx isn't able to parse PHP content by itself, which is the reason for the FastCGI process. I hope to move the content from that WordPress blog into Plone in the near future.

If the web request is for, it is passed to my varnish caching server. If varnish has the request in the cache, it will serve the request directly, which is very fast. If varnish did not have the request cached, it goes to its back end, which in this case is another running nginx process. This instance of nginx is where I have the VirtualHostMonster configured for Plone. The advantage here is that the URLs being processed by varnish are identical to the URLs the end user sees in his or her browser address bar.

The VirtualHostMonster proxypass sends traffic to HAProxy load balancer, which sets a cookie to help determine which backend any given session should be re-directed to on future requests. This balances traffic to four Zope 2.12 instances. These instances are configured to use RelStorage with PostgreSQL as the backend datastore for the ZODB. I have also configured RelStorage to use Memcached.

The method currently used by RelStorage to interact with Memcached isn't quite ideal, but it's functional. When a request comes in, the Zope instances first query Memcached. If the data is there, it serves it. If Memcached does not have the data, RelStorage sends the query to PostgreSQL. Once the response is received from PostgreSQL, RelStorage sends the response to Memcached so it's available for future requests. Simultaneously the request is processed by Zope and sent upstream towards the end user.

Hopefully, this makes sense and provides ideas to help solve your hosting needs as well. The specifications on this Virtual Private Server are as follows: I am running FreeBSD 8.0-Release (32bit) with 1.5gb of memory, 2 virtual CPUs, and 45Gb of disk space. I am using supervisord with memmon to manage the four running Zope instances. Memmon is configured to allow no more than 150mb of memory to be used per instance before restarting them. All other services are configured to run via the FreeBSD rc system.

Tell us about the goals you’re trying to accomplish.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.