ez3.4 beta2 / template compiler / experience ...

Author Message

Georg Franz

Thursday 20 May 2004 6:07:19 am

Hi,
ez3.4 beta2:
I am a man without fear and so I switched my sites to use the template compiling feature. (Okay, I have no fear, but I am not silly, I made this at 2:00 am in the night ...)

Some experience report:
My environment:
redhat 7.1 / php 4.3.6 / mysql 4.1.1a / turck accelarator
Installed siteaccesses: 8

All site accesses uses the same var-dir and the same db. There are around 35.000 content objects, most of them are user-accounts.

I turned on the template-compiling feature at all sites but one because of a strange bug (I've reported that in the bug reports already) - only at this specific site, the output of $module_result.content don't work, if the current page is uncached.

So, I uploaded the changed site.ini.appends, turned the feature on. (Before I do this, I made a big grin because I know what will happens to my server ... and - of course - my server would shot me, if he could.)

Okay, I was right. Server load: 25 - rien ne va plus. A page creation lasted 7 up to 10 minutes. My server runs slightly mad.

It lasts about 2 hours at my installation to calm down the server load. (At 4:00 am, server load was down at 0.5 up to 1.0)

The reason of that high-load was the creation of the "compiled template files". (I mentionend that already some times ago in the bug report. Because of that behaviour that feature isn't usable at a production sites).

So, at 4:00am there were around 1.400 files (!) in the template/compiled directory. Total size: 50 MB (!). (So you can't use any php-accellarator for that directory, too many files, too large)

The file size from that cache files are 1KB up to 516KB (!).

Now (at 15:00pm) I made a quick check at the system, the server load is down at 0.5. So, that is "stable".

Some notes:
-----------
a) If you want to use that feature, only activate it at night and only activate it if you have some sadistic or masochistic minds)

b) There is a change to optimize that feature, some comments:
Reduce the amount of "compiled" files:
At my installation I use mostly the standard-template files which are in the standard template directory. But the template-compiler produces versions for each site-access.
Example:
The compiled version of the "<br />"-ezxml-tag is
$text .= "<br />";
In the template-compile-directory, there are 7 br.php files which has the same content.

So I am sure that you can reduce the total amount of template-cache-files from 1.400 down to around 600 (in my case).

-) Content of the cache file.
As I mentionend, there are some files which has a size of 500KB (6.200 lines of code!)
I examined the code of that files. They also contain "redundant data". The most lines of that "mega" files are array-definitions of $phpScriptArray.

The content of that $phpScriptArray-variable is mostly the same. If you strip off the $phpScriptArray definitions of that compiled-file, you save around 2.000 lines (!)

So, my suggestion is: Put all file-locations which are defined in that $phpScriptArray to an external include-file.

-) A "precompiler" script is necerssary. That script should do the compilation job e.g. in a cron-job.

I hope that report helps ...

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Alex Jones

Thursday 20 May 2004 6:23:49 am

Wow! Thanks for the detailed write-up Emil. It is very useful. :) Sadly, I was looking forward to implementing the template-compile soon, but I think I shall now wait until these issues are resolved.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.