eZSessionGarbageCollector run by PHP during user http request

Author Message

Kevin Gaudin

Monday 17 May 2010 5:57:45 am

Hello there,

The method eZSessionGarbageCollector() is set by eZ as a PHP handler for cleaning sessions (session_set_save_handler php function) in eZ 4.0.

While investigating performance issues on our Intranet production clustered RHEL servers, it appears that an important amount of slow queries (from 3 to 6 seconds) are generated by the "DELETE * FROM ezsession... " which is launched by eZSessionGarbageCollector().

With these execution time, having the session garbage collection run during users http request is a nonsense...

Is this setting a recent addition to eZ Publish ?

Do you know of performance "best practices" about eZ Publish which would advise to deactivate session garbage collection in php.ini or a configuration item in eZ Publish which would have the same effect ?

My own analyse would be to set in php.ini the item session.gc_probability to 0 and run ez's cleanup.php as a daily cronjob script, as it was advised for Debian setups.

Any experience on this subject is welcome,

Thanks !

Kevin

Twitter: @kevingaudin

Gaetano Giunta

Monday 17 May 2010 9:08:01 am

- that query was altered in 4.2 so that it would not slow down db too much. Now it deletes 100 (or 50?) rows at a time. It's your best bet to fix the problem

- doing it randomly on a statistical basis is the way of php (not just the way of ez)

- you can increase in php.ini gc_probability and lower gc_divisor to have gc happen more frequently. That should make the queries faster if you have a site with lots of traffic (more frequency = fewer rows to delete)

- also diminishing session timeout (3 days by default!) can have a positive impact, as there will be fewer sessions in the db at any given time

- you can set in php.ini gc_probability = 0 and run the query via cronjob, so at least slow queries are not hitting live pages (see the cronjob session_gc.php, added in 4.1)

Principal Consultant International Business
Member of the Community Project Board

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 18 2025 02:14:52
Script start
Timing: Jan 18 2025 02:14:52
Module start 'layout'
Timing: Jan 18 2025 02:14:52
Module start 'content'
Timing: Jan 18 2025 02:14:53
Module end 'content'
Timing: Jan 18 2025 02:14:53
Script end

Main resources:

Total runtime0.7732 sec
Peak memory usage4,096.0000 KB
Database Queries55

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 589.5391153.8906
Module start 'layout' 0.00770.0042 743.429739.4531
Module start 'content' 0.01190.7599 782.8828534.5938
Module end 'content' 0.77180.0013 1,317.476612.0938
Script end 0.7731  1,329.5703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.4649160.0002
Check MTime0.00130.1731160.0001
Mysql Total
Database connection0.00070.093610.0007
Mysqli_queries0.724193.6510550.0132
Looping result0.00050.0636530.0000
Template Total0.742396.020.3711
Template load0.00190.245220.0009
Template processing0.740495.759620.3702
Template load and register function0.00010.011510.0001
states
state_id_array0.00080.098210.0008
state_identifier_array0.00160.202020.0008
Override
Cache load0.00160.2088230.0001
Sytem overhead
Fetch class attribute can translate value0.00060.083520.0003
Fetch class attribute name0.00120.152440.0003
XML
Image XML parsing0.00090.111820.0004
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00100.1255220.0000
String conversion0.00000.001340.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
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs