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 15 2025 09:09:20
Script start
Timing: Jan 15 2025 09:09:20
Module start 'layout'
Timing: Jan 15 2025 09:09:20
Module start 'content'
Timing: Jan 15 2025 09:09:21
Module end 'content'
Timing: Jan 15 2025 09:09:21
Script end

Main resources:

Total runtime1.5032 sec
Peak memory usage6,144.0000 KB
Database Queries55

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 686.1641183.7188
Module start 'layout' 0.00790.0039 869.882852.6250
Module start 'content' 0.01181.4896 922.50781,862.5391
Module end 'content' 1.50150.0017 2,785.046968.4766
Script end 1.5032  2,853.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00590.3919160.0004
Check MTime0.00130.0851160.0001
Mysql Total
Database connection0.00060.042210.0006
Mysqli_queries1.441695.8993550.0262
Looping result0.00050.0345530.0000
Template Total1.449796.420.7249
Template load0.00340.226620.0017
Template processing1.446396.212320.7231
Template load and register function0.00120.082410.0012
states
state_id_array0.00190.127110.0019
state_identifier_array0.00260.171320.0013
Override
Cache load0.00310.2051230.0001
Sytem overhead
Fetch class attribute can translate value0.00080.051820.0004
Fetch class attribute name0.00260.173640.0007
XML
Image XML parsing0.00240.159220.0012
class_abstraction
Instantiating content class attribute0.00000.000540.0000
General
dbfile0.00330.2205220.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
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