Recently I integrate Drupal with a custom simple script (which contains a little error) and I found that slow down too much! after debugging, it seems error_reporting bring performance down.
In drupal, there is no way to close error reporting completely? (set Error messages to display to NONE or init in settings.php in Drupal backend isn't really turn off error_reporting)
the problem seems happen on custom error handler:
set_error_handler('_drupal_error_handler');
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
echo $test;
Before:
Requests per second: 483.19 [#/sec] (mean)
After Comment out set_error_handler:
Requests per second: 725.56 [#/sec] (mean)
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
echo $test;
Before:
Requests per second: 53.77 [#/sec] (mean)
After Comment out set_error_handler:
Requests per second: 61.88 [#/sec] (mean)
Comments
Comment #1
damien tournoud commentedThe standard Drupal handler logs the errors to the MySQL database. No doubt it is slightly slower then not doing anything. This looks very much by design, but you could try switching to syslog.
Comment #2
droplet commentedhmm..syslog can be slightly help when DB server under load.
can't it disable watchdog ?? always logging isn't a bad idea but not every site need it.
Comment #3
dawehnerYou can disable the dblog module and the syslog module. Then nothing will be fired.
If you need some custom logic you can implement hook_watchdog for your own
Comment #4
droplet commentedthe problem here isn't how watchdog handle the error (write to DB or Disk or memory..)..
above test start Drupal without any module & DB, no ??
The problem is drupal enforce error reporting in D7 now.
so if we start with DRUPAL_BOOTSTRAP_CONFIGURATION, error_reporting always be "TRUE", _drupal_error_handler_real includes common.inc, its bright the druapl slow down.
anway, I can set it my self,