How to check if any query to the website is stuck for a long time?
To determine whether a website query is stuck or taking too long, you’ll need to inspect both the web server and database server. Here’s what to check:
Check on stuck PHP processes
You may use this command to check if there is stuck PHP processes.
ps -eo user,pid,etime,cmd | grep '[p]hp'
Look for processes with high ETIME (elapsed time). Long-running process may indicate a stuck or slow request.
[irfan@ubuntu ~]$ ps -eo user,pid,etime,cmd | grep '[p]hp' irfanma+ 3734668 03:23 lsphp irfanma+ 3734670 03:23 lsphp:st.irfanmarsidek.life/private_html/sleep.php
In this example, the script sleep.php under the st.irfanmarsidek.life domain is still executing after 3+ minutes, which is unusually long for a typical web request.
Check active SQL queries
You may also check SQL queries that are currently running. You may refer to our Knowldege Base article on how to check current running SQL queries :
https://www.ipserverone.info/knowledge-base/how-to-check-current-running-sql-queries/
Identifying stuck or long-running website queries is essential for maintaining a responsive and reliable server. By checking active PHP processes, monitoring database queries, and reviewing server logs, you can quickly pinpoint and address the source of delays or hangs.
For continued issues or if you need expert assistance, feel free to contact our support team at support@ipserverone.com.