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.

eZ debug

Timing: Jan 19 2025 11:42:19
Script start
Timing: Jan 19 2025 11:42:19
Module start 'layout'
Timing: Jan 19 2025 11:42:19
Module start 'content'
Timing: Jan 19 2025 11:42:20
Module end 'content'
Timing: Jan 19 2025 11:42:20
Script end

Main resources:

Total runtime1.5179 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.2891152.6406
Module start 'layout' 0.00660.0040 741.929739.4766
Module start 'content' 0.01061.5057 781.4063546.1172
Module end 'content' 1.51630.0015 1,327.523412.1250
Script end 1.5178  1,339.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2189160.0002
Check MTime0.00130.0862160.0001
Mysql Total
Database connection0.00120.082210.0012
Mysqli_queries1.456195.9283540.0270
Looping result0.00070.0461520.0000
Template Total1.478997.420.7394
Template load0.00230.151520.0011
Template processing1.476597.276020.7383
Template load and register function0.00010.008210.0001
states
state_id_array0.00110.071610.0011
state_identifier_array0.00270.175920.0013
Override
Cache load0.00190.1233440.0000
Sytem overhead
Fetch class attribute can translate value0.00100.066620.0005
Fetch class attribute name0.00140.094740.0004
XML
Image XML parsing0.00240.155920.0012
class_abstraction
Instantiating content class attribute0.00000.000540.0000
General
dbfile0.00330.2203220.0002
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs