[Zodb-checkins] CVS: ZODB3/Doc/guide/zodb - node22.html:1.1.2.1
Jeremy Hylton
jeremy@zope.com
Fri, 4 Oct 2002 15:39:20 -0400
Update of /cvs-repository/ZODB3/Doc/guide/zodb
In directory cvs.zope.org:/tmp/cvs-serv2383/Doc/guide/zodb
Added Files:
Tag: ZODB3-3_1-branch
node22.html
Log Message:
Where'd node22 come from?
=== Added File ZODB3/Doc/guide/zodb/node22.html ===
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>3.1 How ZEO Works</title>
<META NAME="description" CONTENT="3.1 How ZEO Works">
<META NAME="keywords" CONTENT="zodb">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="zodb.css" type='text/css'>
<link rel="first" href="zodb.html">
<link rel="contents" href="contents.html" title="Contents">
<LINK REL="next" HREF="node23.html">
<LINK REL="previous" href="zeo.html">
<LINK REL="up" href="zeo.html">
<LINK REL="next" HREF="node23.html">
<meta name='aesop' content='information'>
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="zeo.html"><img src="/python/writing/icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="zeo.html"><img src="/python/writing/icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node23.html"><img src="/python/writing/icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">ZODB/ZEO Programming Guide</td>
<td><A href="contents.html"><img src="/python/writing/icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="/python/writing/icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="/python/writing/icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="zeo.html">3 ZEO</A>
<b class="navlabel">Up:</b> <a class="sectref" href="zeo.html">3 ZEO</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node23.html">3.2 Installing ZEO</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION000410000000000000000">
3.1 How ZEO Works</A>
</H2>
<P>
The ZODB, as I've described it so far, can only be used within a
single Python process (though perhaps with multiple threads). ZEO,
Zope Enterprise Objects, extends the ZODB machinery to provide access
to objects over a network. The name "Zope Enterprise Objects" is a
bit misleading; ZEO can be used to store Python objects and access
them in a distributed fashion without Zope ever entering the picture.
The combination of ZEO and ZODB is essentially a Python-specific
object database.
<P>
ZEO consists of about 6000 lines of Python code, excluding tests. The
code is relatively small because it contains only code for a TCP/IP
server, and for a new type of Storage, <tt class="class">ClientStorage</tt>.
<tt class="class">ClientStorage</tt> simply makes remote procedure calls to the
server, which then passes them on a regular <tt class="class">Storage</tt> class such
as <tt class="class">FileStorage</tt>. The following diagram lays out the system:
<P>
XXX insert diagram here later
<P>
Any number of processes can create a <tt class="class">ClientStorage</tt>
instance, and any number of threads in each process can be using that
instance. <tt class="class">ClientStorage</tt> aggressively caches objects
locally, so in order to avoid using stale data. The ZEO server sends
an invalidation message to all the connected <tt class="class">ClientStorage</tt>
instances on every write operation. The invalidation message contains
the object ID for each object that's been modified, letting the
<tt class="class">ClientStorage</tt> instances delete the old data for the
given object from their caches.
<P>
This design decision has some consequences you should be aware of.
First, while ZEO isn't tied to Zope, it was first written for use with
Zope, which stores HTML, images, and program code in the database. As
a result, reads from the database are <i>far</i> more frequent than
writes, and ZEO is therefore better suited for read-intensive
applications. If every <tt class="class">ClientStorage</tt> is writing to the
database all the time, this will result in a storm of invalidate
messages being sent, and this might take up more processing time than
the actual database operations themselves.<A NAME="tex2html2"
HREF="#foot429"><SUP>2</SUP></A>
<P>
On the other hand, for applications that have few writes in comparison
to the number of read accesses, this aggressive caching can be a major
win. Consider a Slashdot-like discussion forum that divides the load
among several Web servers. If news items and postings are represented
by objects and accessed through ZEO, then the most heavily accessed
objects - the most recent or most popular postings - will very
quickly wind up in the caches of the
<tt class="class">ClientStorage</tt> instances on the front-end servers. The
back-end ZEO server will do relatively little work, only being called
upon to return the occasional older posting that's requested, and to
send the occasional invalidate message when a new posting is added.
The ZEO server isn't going to be contacted for every single request,
so its workload will remain manageable.
<P>
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot429">... themselves.</A><A NAME="foot429"
HREF="node22.html#tex2html2"><SUP>2</SUP></A>
<DD>These messages are
small and sent in batches, so there would need to be a lot of writes
before it became a problem.
</DL>
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="zeo.html"><img src="/python/writing/icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="zeo.html"><img src="/python/writing/icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node23.html"><img src="/python/writing/icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">ZODB/ZEO Programming Guide</td>
<td><A href="contents.html"><img src="/python/writing/icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="/python/writing/icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="/python/writing/icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="zeo.html">3 ZEO</A>
<b class="navlabel">Up:</b> <a class="sectref" href="zeo.html">3 ZEO</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node23.html">3.2 Installing ZEO</A>
<hr>
<span class="release-info">Release 0.04, documentation updated on October 4, 2002.</span>
</DIV>
<!--End of Navigation Panel-->
</BODY>
</HTML>