Well i decided to put all log action into queue, so i have something like this on some event dispatcher:
$message=PHP_EOL .
'URL: ' . $di->get('request')->getURI() . PHP_EOL .
'Module name:' . $dispatcher->getModuleName() . PHP_EOL .
'Controller name:' . $dispatcher->getControllerName() . PHP_EOL .
'Action name:' . $dispatcher->getActionName() . PHP_EOL .
'Params:' . json_encode($dispatcher->getParams()) . PHP_EOL .
'POST:' . json_encode($post) . PHP_EOL .
'JSON:' . json_encode($di->get('request')->getJsonRawBody(true)) . PHP_EOL .
'User id:' . $di->get('session')->get('admin') . PHP_EOL .
'=============================================================';
if(PHP_OS == "Linux"){
/** @var Beanstalk $queue */
$queue->choose('logger');
$queue->put(array(
'type'=>'beforeDispatch',
'message'=>$message
));
}
else {
$logger->info($message);
}
For some time it was working fine, but after reboot of vps it really slowed down, when using this code i have like +300ms on every request.
What's going on ? I don't have anything on php logs(or don't know where to look).