You are here

README.txt in Performance Logging and Monitoring 6

Same filename and directory in other branches
  1. 5 README.txt
  2. 6.2 README.txt
  3. 7.2 README.txt
  4. 7 README.txt
By Khalid Baheyeldin

Copyright 2008 http://2bits.com

Description
-----------
This module provides performance statistics logging for a site, such as page
generation times, and memory usage, for each page load.

This module is useful for developers and site administrators alike to identify
pages that are slow to generate or use excessive memory.

Features include:
* Settings to enable detailed logging or summary logging. The module defaults to
  no logging at all.

* Detailed logging causes one database row to be written for each page load of
  the site. The data includes page generation time in milliseconds, and the
  number of bytes allocated to PHP, time stamp, etc.

* Summary logging logs the average and maximum page generation time, average and
  maximum memory usage, last access time, and number of accesses for each path.

* Summary can be logged to memcache, if configured, so as to not cause extra
  load on the database. This works when APC cannot be used (e.g. certain FastCGI
  configurations, or when you have many web servers on different boxes. This
  mode is recommended for live sites.

* Summary can be logged to APC, if installed, and the APC data cache is shared,
  so as to not cause extra load on the database. This mode is recommended for
  live sites.

* A settings option is available when using summary mode with APC, to exclude
  pages with less than a certain number of accesses. Useful for large sites.

* Support for normal page cache.

Note that detailed logging is only suitable for a site that is in development or
testing. Do NOT enable detailed logging on a live site.

The memory measurement feature of this module depends on the
memory_get_peak_usage() function, available only in PHP 5.2.x or later.

Only summary logging with Memcache or APC are recommended mode for live sites,
with a threshold of 2 or more.

Note on Completeness:
---------------------
Please note that when summary logging to APC or Memcache, the data captured in
the summary will not be comprehensive reflecting every single page view for
every URL.

The reason for this is that there is no atomic locking when updating the data
structures that store per-URL statistics in this module.

This means that the values you get when using these storage caches are only
samples, and would miss some page views, depending on how busy the site is.

For memcache, there is way to implement locking using the $mc->increment and/or
$mc->add as well. However, there is a risk if these are implemented, that there
will be less concurrency and we can cause a site to slow down.

Configuration:
--------------
To configure the Performance Logging and Monitoring module, navigate to
/admin/settings/performance-logging. By default, this module creates a
key for each entry based off of the hostname of the site being accessed. If you
have a site with multiple domains, it is recommended to specify a shared key
between all sites in your settings.php file:

  $conf['performance_key'] = 'example_key';

If you are using memcache, then you need to configure an extra bin for
performance. If you have multiple web server boxes, then it is best to
centralize this bin for all the boxes, so you get combined statistics.

Your settings.php looks like this:

  $conf = array(
    'cache_inc' => './sites/all/modules/memcache/memcache.inc',

    'memcache_servers' => array(
      '127.0.0.1:11211' => 'default',
      // More bins here ....
      '127.0.0.1:11311' => 'performance',
    ),

    'memcache_bins' => array(
      'cache_performance' => 'performance',
    ),
  );

Statistics:
-----------
You can view the recorded performance statistics (summary and details) at
/admin/reports/performance-logging

Drush support
-------------
Drush support has been integrated as well. You can check the summary and detail
logs using the performance-summary (aliased as perf-sm) and performance-detail
(aliased as perf-dt) commands. Some examples:

  Retrieve last 15 entries from the detail log:
    drush performance-detail 15

  Retrieve last 20 summary log entries sorted by the number of queries,
  descending:
    drush performance-summary 20 query_count

  Retrieve last 35 entries from the detail log sorted by size, ascending:
    drush performance-detail 35 bytes asc

Use drush perf-sm --help or drush perf-dt --help to see a full explanation.

NOTE: the arguments on the summary pages currently work ONLY when logging to the
database! With other sources (memcache, Zend, APC) you will see a summary of
the last 15 minutes!

Bugs/Features/Patches:
----------------------
If you want to report bugs, feature requests, or submit a patch, please do so at
the project page on the Drupal web site at http://drupal.org/project/performance

Author
------
Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com)

If you use this module, find it useful, and want to send the author a thank you
note, then use the Feedback/Contact page at the URL above.

The author can also be contacted for paid customizations of this and other
modules.

File

README.txt
View source
  1. By Khalid Baheyeldin
  2. Copyright 2008 http://2bits.com
  3. Description
  4. -----------
  5. This module provides performance statistics logging for a site, such as page
  6. generation times, and memory usage, for each page load.
  7. This module is useful for developers and site administrators alike to identify
  8. pages that are slow to generate or use excessive memory.
  9. Features include:
  10. * Settings to enable detailed logging or summary logging. The module defaults to
  11. no logging at all.
  12. * Detailed logging causes one database row to be written for each page load of
  13. the site. The data includes page generation time in milliseconds, and the
  14. number of bytes allocated to PHP, time stamp, etc.
  15. * Summary logging logs the average and maximum page generation time, average and
  16. maximum memory usage, last access time, and number of accesses for each path.
  17. * Summary can be logged to memcache, if configured, so as to not cause extra
  18. load on the database. This works when APC cannot be used (e.g. certain FastCGI
  19. configurations, or when you have many web servers on different boxes. This
  20. mode is recommended for live sites.
  21. * Summary can be logged to APC, if installed, and the APC data cache is shared,
  22. so as to not cause extra load on the database. This mode is recommended for
  23. live sites.
  24. * A settings option is available when using summary mode with APC, to exclude
  25. pages with less than a certain number of accesses. Useful for large sites.
  26. * Support for normal page cache.
  27. Note that detailed logging is only suitable for a site that is in development or
  28. testing. Do NOT enable detailed logging on a live site.
  29. The memory measurement feature of this module depends on the
  30. memory_get_peak_usage() function, available only in PHP 5.2.x or later.
  31. Only summary logging with Memcache or APC are recommended mode for live sites,
  32. with a threshold of 2 or more.
  33. Note on Completeness:
  34. ---------------------
  35. Please note that when summary logging to APC or Memcache, the data captured in
  36. the summary will not be comprehensive reflecting every single page view for
  37. every URL.
  38. The reason for this is that there is no atomic locking when updating the data
  39. structures that store per-URL statistics in this module.
  40. This means that the values you get when using these storage caches are only
  41. samples, and would miss some page views, depending on how busy the site is.
  42. For memcache, there is way to implement locking using the $mc->increment and/or
  43. $mc->add as well. However, there is a risk if these are implemented, that there
  44. will be less concurrency and we can cause a site to slow down.
  45. Configuration:
  46. --------------
  47. To configure the Performance Logging and Monitoring module, navigate to
  48. /admin/settings/performance-logging. By default, this module creates a
  49. key for each entry based off of the hostname of the site being accessed. If you
  50. have a site with multiple domains, it is recommended to specify a shared key
  51. between all sites in your settings.php file:
  52. $conf['performance_key'] = 'example_key';
  53. If you are using memcache, then you need to configure an extra bin for
  54. performance. If you have multiple web server boxes, then it is best to
  55. centralize this bin for all the boxes, so you get combined statistics.
  56. Your settings.php looks like this:
  57. $conf = array(
  58. 'cache_inc' => './sites/all/modules/memcache/memcache.inc',
  59. 'memcache_servers' => array(
  60. '127.0.0.1:11211' => 'default',
  61. // More bins here ....
  62. '127.0.0.1:11311' => 'performance',
  63. ),
  64. 'memcache_bins' => array(
  65. 'cache_performance' => 'performance',
  66. ),
  67. );
  68. Statistics:
  69. -----------
  70. You can view the recorded performance statistics (summary and details) at
  71. /admin/reports/performance-logging
  72. Drush support
  73. -------------
  74. Drush support has been integrated as well. You can check the summary and detail
  75. logs using the performance-summary (aliased as perf-sm) and performance-detail
  76. (aliased as perf-dt) commands. Some examples:
  77. Retrieve last 15 entries from the detail log:
  78. drush performance-detail 15
  79. Retrieve last 20 summary log entries sorted by the number of queries,
  80. descending:
  81. drush performance-summary 20 query_count
  82. Retrieve last 35 entries from the detail log sorted by size, ascending:
  83. drush performance-detail 35 bytes asc
  84. Use drush perf-sm --help or drush perf-dt --help to see a full explanation.
  85. NOTE: the arguments on the summary pages currently work ONLY when logging to the
  86. database! With other sources (memcache, Zend, APC) you will see a summary of
  87. the last 15 minutes!
  88. Bugs/Features/Patches:
  89. ----------------------
  90. If you want to report bugs, feature requests, or submit a patch, please do so at
  91. the project page on the Drupal web site at http://drupal.org/project/performance
  92. Author
  93. ------
  94. Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com)
  95. If you use this module, find it useful, and want to send the author a thank you
  96. note, then use the Feedback/Contact page at the URL above.
  97. The author can also be contacted for paid customizations of this and other
  98. modules.