Zen Cart custom software development, Zen Cart modules, Zen Cart Expert eCommerce with Zen Cart!


Zen Cart Perfmon

A Zen Cart™ mod which allows you to identify hotspots (performance bottlenecks) in your Zen Cart processing.

Donate: This is free software. Show your appreciation by supporting my efforts. Donate

Relevance: Zen Cart™ 1.3.9, 1.5.x

Current Version: 1.1 (version history)

Support Thread: Perfmon Support Thread

Cost: Free, but donation appreciated

Installation Instructions: See README.txt file in mod.

Location: Zen Cart Plugins, under Admin Tools

Download: Perfmon in Zen Cart Plugins

FAQ: click here


If your Zen Cart has the slows, don't just guess at what's wrong; track it down with Perfmon!

Perfmon uses the Zen Cart notifier system, which provides a convenient way of timestamping chunks of work during a page load cycle. Looking at the differences between times in the actions in the execution of a page load can provide indications of where the slowdown is occurring.

Perfmon tracks the activity of a single logged in user, the customer id specified in Admin > Configuration > My Store > Perfmon Customer ID. Every time that customer loads a Zen Cart page, a log file is created in the logs directory (or in the cache directory in Zen Cart 1.3.9) with the times of each notifier event.

For example, consider this log of the checkout confirmation page submission:
[21-May-2013 10:30:34 UTC] ,61,NOTIFIER_CART_GET_PRODUCTS_END
[21-May-2013 10:30:34 UTC] ,0,NOTIFY_EMAIL_READY_TO_SEND
[21-May-2013 10:30:35 UTC] ,11010,NOTIFY_EMAIL_AFTER_SEND
This shows it took just over 1 second (1101 milliseconds) to send the order confirmation email to the customer.

Now look at this log:
[21-May-2013 10:40:23 UTC] ,6,NOTIFIER_CART_GET_PRODUCTS_END
[21-May-2013 10:40:23 UTC] ,0,NOTIFY_EMAIL_READY_TO_SEND
[21-May-2013 10:40:34 UTC] ,108442,NOTIFY_EMAIL_AFTER_SEND
This shows it took 11 seconds (10844 milliseconds) to send the order confirmation email to the customer, so this would be a good place to investigate when trying to figure out how to make checkout confirmation faster.

Perfmon outputs its data in CSV format and can easily be pulled into Excel for graphing.

Perfmon output in Excel

Major Versions

  • 1.1 07/19/2014 - Updates for 1.5.2 and 1.5.3
  • 1.0 06/01/2013 - First Release


Q: Hey, this doesn't work!
A: If Perfmon doesn't work for you, the most likely explanations are:
  • You have already overridden includes/auto_loaders/overrides/config.core.php in includes/auto_loaders/overrides/config.core.php You must merge the file in the overrides directory or delete it.
  • Your logs directory (1.5.x) or cache directory (1.3.9) are not writable.

Q: I'd like to display the log in the browser instead of creating a file. How do I do this?
A: It's not difficult. Make these changes:
  • At the top of includes/application_top.php, add the line
    $perfmon_log = array();
  • In includes/classes/observers/class.perfmon.php, replace
           global $perfmon_log; 
           $perfmon_log[] = $timediff . "   " . $eventID;
  • At the bottom of includes/templates/YOUR_TEMPLATE/common/tpl_footer.php, add
    if (isset($perfmon_log)) { 
       foreach ($perfmon_log as $p) { 
          echo $p . "<br />"; 
Now the log will be shown at the bottom of your site's pages (when you are logged in and Admin > Configuration > My Store > Perfmon Customer ID is set to your customer id).