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

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>

eZ debug

Timing: Jan 31 2025 08:07:44
Script start
Timing: Jan 31 2025 08:07:44
Module start 'content'
Timing: Jan 31 2025 08:07:44
Module end 'content'
Timing: Jan 31 2025 08:07:45
Script end

Main resources:

Total runtime0.2461 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 588.0625180.8125
Module start 'content' 0.00700.0056 768.875097.9297
Module end 'content' 0.01260.2334 866.8047533.3750
Script end 0.2460  1,400.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00301.2188200.0001
Check MTime0.00110.4589200.0001
Mysql Total
Database connection0.00060.249510.0006
Mysqli_queries0.202882.40811410.0014
Looping result0.00120.48781390.0000
Template Total0.233194.710.2331
Template load0.00070.271410.0007
Template processing0.232594.440810.2325
Override
Cache load0.00050.192210.0005
Sytem overhead
Fetch class attribute can translate value0.00050.187710.0005
XML
Image XML parsing0.00030.108910.0003
General
dbfile0.00722.9445200.0004
String conversion0.00000.001330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs