<div dir="ltr">Hi Sukhdev,<div><br></div><div>I have struggled myself with similar issues. Not being a DBA and being more inclined to development activities, it's always a pain to troubleshoot database performance. I'd really like to have input from a knowledgeable Vtiger infrastructure expert or someone in the community who could shed some light on this topic and have general guidelines on database configuration and performance tuning.</div><div><br></div><div>Saludos<br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div>Rubén</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 30, 2021 at 3:08 PM Sukhdev Mohan <<a href="mailto:s.mohan@myti.it">s.mohan@myti.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div name="messageBodySection">
<div dir="auto">Hi,<br>
<br>
I came across a strange problem: in some php versions you may have persistent mysql connection, needless to say this is a pain in the back, since by default mysql will kill idle/sleepy connections after 28800 seconds (roughly 8 hours), and if unluckily it reaches 131 child process or around 100 process from mysql shell, it’ll freeze giving a blank white page until one of the following:<br>
a. Some of the process are killed automatically because timeout limit is reached or manually<br>
b. Complete reset of mysql service (systemctl restart/relaod mysql)<br>
<br>
The fix is in php.ini:<br>
Set mysqli.allow_persistent to Off and mysqli.max_persistent to 0. In some versions you’ll find their values respectively On and -1 which is limitless.<br>
<br>
After I set these new values, there were no sleepy process since mysql was killing them as soon as php-fpm ended.<br>
<br>
Final considerations:<br>
Why is the library AdoDB not closing the db pool explicitly? Relying on PHP is way too risky: prior to the solution in the best case scenario there were a couple of process brought up in mysql, in the worst case the were ten and refreshing 5 times the dashboard with some widget was enough to paralyse the system.<br>
<br>
You can check yourself by logging in to your mysql shell and giving this command:<br>
show processlist;<br>
<br>
Or from your shell (linux) give the pstree command and look at mysql and how many process it has spawned. On my system with 131 process it hanged (24gb ram).<br>
<br>
More at <a href="https://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.allow-persisten%20t" target="_blank">https://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.allow-persisten t</a><br>
<br></div>
</div>
<div name="messageSignatureSection"><br>
<div><font color="#C6C6C6"><b><span>Sukhdev Mohan</span></b></font><span></span><br>
<font color="#999999"><b><span>Developer</span></b></font><br></div>
</div>
</div>

_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>