This is an old revision of the document!


Identify scripts that are slowing down your server

When working with php, you will notice that your site is taking longer to load then expected. Learning why your site is loading so slow would be great. You can do an strace but sometimes that information is not always the best to read.

If you are a PHP programmer, you must have used PHP’s error_log function sometime. But PHP itself does not provide a way to find out slowly executing scripts. Slow scripts are not the ones which break your site but they slow-down everything. With PHP-FPM, there is a slow_log function, by which developers can get a trace of what functions are running longer than a specified time.

LiteSpeed uses more faster LiteSpeed API (LSPHP) instead of PHP-FPM. How to trace the slow script with LSWS and LSPHP?

There is a directive, which can be placed at external application settings (WebAdmin console > Configuration > External App> Environment ).

LSAPI_SLOW_REQ_MSECS=30000

LSAPI_SLOW_REQ_MSECS: If set to a non-zero number, LiteSpeed Web Server will log requests into an error log file if a request takes longer than the specified number of milliseconds. This can help identify scripts that are slowing down your server.

  • Admin
  • Last modified: 2017/12/12 16:51
  • by Jackson Zhang