I am currently working on a lightweight php framework to use with some high ajax request for my site and ran into an interesting problem that completely surpassed me. Ajax is designed for a series of notifications, so javascript sends an ajax request for new information every 30 seconds. This ajax is active on every page of the entire site, so I implement a lot of requests, as several hundred users browse the site at any time, many of them open several windows.
The syntax is wise, everything is perfect. The problem is that when I activated ajax for my community, a command of 30-40 SLEEP is created in the MySQL database. All of them seem to ignore the set timeout of 10 seconds. As a result, this affects the entire performance of the site.
I understand that the remaining sleep commands are the result of a connection that was not closed. I use the object-oriented MySQLi class and have expanded it with several of my functions. Everything is in the tutorial and double checked for documentation, and I made sure that every small part of the MySQLi class is closed and released.
If anyone has any wisdom or experience with such an effect, I would be very grateful for any advice.
source share