Use ZEO with Zope
Created by kedai . Last modified 2003-11-16 07:08:26.
just realized that this howto didn't make it with the zope transition (from old to new). so, here is how to use zeo with zope < 2.7
Update 05/25/01 - remove ln -s cPickle and ln -s ZServer, add using zeo_start and zeo_stop.
Update 03/22/01 - security aspects, and ZEO frontends
This How-To covers the use of Zope Enterprise Objects(ZEO) to scale your Zope site.
Note: This is a note of what i did to scale my site, and is to be taken with a grain of salt. This may not be the best setup, but I'm using it and had no problems. Errors, pointers, experience sought!
Every small time web site dreams of getting big, but being big does not come without its own headaches and challenges. However, Zope will let you scale your site so that your site can take the load and still give users good response time.
What does it do?
ZEO will help you scale your site and give redundancy/high availability to your site too. Every Zope installation will be a Client Storage (CS) that talks to the Zope Storage Server (ZSS). Every CS will have its own object cache and will be able to work independently of other CS.
You can have the CS cache in-memory or on the file system. Every request will be taken from the cache, if available, and from the ZSS if not. Modifications and additions will be sync to the ZSS. ZSS will take care of the object validity.
The most basic setup is to have your ZSS and CS in the same machine. However, I will use two physically different machine to fully use ZEO capability. However, you can increase the number of physical machine to the nth.
Here, we have a machine that's acting as a ZSS and CS(the main server). We have other machines that will have a Zope instance and will be the other CSs(the client servers).
This may not be the only way to connect. This setup is quite flat, and you have a single point of failure, the ZSS. Check out the ZEO FactSheet.
SecuritySince there is no security measure taken when we serve ZEO server, we need to put it in a private network. We can achieve this by adding another NIC to each box, or create another private ip alias and serve ZEO server from the private ip alias.
Installing the main server
A better way to control your ZEO Server is to use the included zeo_start and zeo_stop.
If you start Zope without ZEO_CLIENT, the cache will be in-memory. To have the cache on your fs, start Zope with ZEO_CLIENT. Add ZEO_CLIENT=8800 in your start script e.g.
#! /bin/sh reldir=`dirname $0` PYTHONHOME=`cd $reldir; pwd` export PYTHONHOME exec /usr/bin/python \ $PYTHONHOME/z2.py -X -w 80 STUPID_LOG_FILE='var/stupid.log' \ -D '' "$@" ZEO_CLIENT=8800
I think it is good practice to have STUPID_LOG_FILE since it will really help point out errors and help in debugging.
You will now have the cache in Zope/path/var
You can test your ZSS and first CS.
Installing the other CSs
Repeat on other CS.
Now that we a few machines that have the same data, how do we serve it? There are few methods that can be used to front-end ZEO.
Also, look at a thread from Zope mailing list.
I'm using a combination of DNS Round robin and balance. And things couldn't have been better.
ZEO is not limited to the setup discussed above. ZEO can serve out many storages with ZSS. This, I have looked at only briefly.
One setup that i could think of is using External Mount for part of your site. For example, say we want to have polling available to users. Every vote casted will increase the Data.fs size.
A solution, mount Noundo, packless Database (Berkeley storage) on a poll mount point in the ZODB tree. Now, we don't need to worry about size increase.
I'll try and put something out soon. meanwhile, checkout ZEO Sessions How-to.
These are notes to what I encountered when using ZEO.