[Zope] Optimization and speed

Martijn Pieters mj@digicool.com
Sat, 15 Jul 2000 21:52:00 +0200


On Sat, Jul 15, 2000 at 12:18:23PM -0700, Stephan Richter wrote:
> I have a pretty big site with quiet a big database (PostGreSQL) in the 
> background. When a site loads I can tell that after about 5 seconds the 
> site is ready to download. The site downloads quickly thereafter if I am on 
> a T1, DSL or Cable Modem connection. But since most of our users have 28.8k 
> and 56k modem connection, we have to optimize for them too.
> When accessing the site over a modem, it takes a long time to load the site 
> and then it pops up all at once (in IE (AOL) and Netscape). Is there a way 
> that I can send parts of the HTML as it is generated, so that the customer 
> starts seeing information before the entire site is loaded. Our site is 
> about 50% slower than our competitors sites (we are serving 62kB and the 
> competitor has up to 203kB and is 50% faster!!!) which use PHP and 
> ColdFusion. I know that Zope is not slower. I strongly believe it is the 
> HTML output which is not optimized (we are going to speed up the DB 
> connection very soon by dedicating a NIC only for the DB communication).
> 
> Technical Facts:
> - Zope 2.1.6+PCGI+Apache - Virtual Hosts for HTTP and HTTPS
> - PostGreSQL 7.0 (DB size: 50MB), ZPyGreSQLDA, UserDB
> - ZODB threads: 4
> - Web Server: Pentium 500, RH 6.1, 322MB RAM (not all used), 100 MBit NIC
> - DB Server: Pentium 500, RH 6.1, 322MB RAM (plenty left to use), 100 MBit NIC
> - dedicated subnet
> 
> If someone could give me some tips where I should start looking for speed 
> holes, please let me know. Do you think it is the DB which could be so slow 
> and I should cache search results more, are there ZServer/Apache options I 
> can set or anything else in Zope I should have a look at?

Hi Stephan,

This sounds like more of a HTML problem than a Zope problem, especially since
the fast links have no trouble with the server. Zope obviously is fast enough
to serve them.

I bet your site heavily uses tables and images This will cause the browser to not
display anything until it knows how to lay out the table. If your whole page
is contained in one table, this means that your page won't pop up until the
browser has seen the table end tag and knows the sizes of all images.

You can help the browser a bit by making sure all IMG tags have a width and
height attribute so the browser won't have to wait for the images to start to
load. IIRC, Internet Explorer will even show the table without that
information, and reflow the table if needed. It still will wait until it has
the whole table.

Only Mozilla reflows all incoming HTML on the fly, even before the end of the
table is seen. When they the optimisations come in for Netscape 6 preview 3,
it'll beat the hell out of Internet Explorer with this.

So, if you want to make sure that your clients see something before all HTML
is in, split up the table into a header and the rest, if possible. Then the
browser has something to show while loading the rest of the page. This is what
sites like www.cnet.com do; they show you a banner while waiting.

-- 
Martijn Pieters
| Software Engineer            mailto:mj@digicool.com
| Digital Creations          http://www.digicool.com/
| Creators of Zope               http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-----------------------------------------------------