| Strange MySQL behavior [message #2067] |
Tue, 16 October 2007 03:42  |
AlexN Messages: 20 Registered: October 2007 Location: Moscow,Russia |
Junior Member |
|
|
Some days ago I encountered with a strange problem. MySQL and Apache resides both on the same server. In attempt to optimize MySQL someone increased the key buffer too much. Also the number of temp tables has been set too large.
At first it worked fine, but when the server load increased, Apache used some memory, while MySQL started to create temp tables on disk instead of memory. Queries took more time to complete, and new connections continued to arrive. In less than 20 minutes the whole server nearly stopped. There were about 20 running processes, all in the state "Copying to temp table".
The question is: how to avoid such situation ? In, for example, MSSQL this scenario is hardly possible.
|
|
|
|
|
|
|
|
|
|
|
| Re: Strange MySQL behavior [message #2098 is a reply to message #2097 ] |
Thu, 18 October 2007 08:26  |
sterin Messages: 324 Registered: March 2007 Location: Sweden |
Senior Member |
|
|
| AlexN wrote on Thu, 18 October 2007 12:26 |
Not really. Just PHP code will not cause that 'avalanche' scenario. The response time will increase more or less linear with increasing load.
|
As long as it is CPU bound yes, but the webserver with the PHP interpreter can also allocate a lot of memory and then you will experience the exact same thing.
Since the whole reason for the avalanche effect is that you have run out of RAM on the machine and it starts to swap.
And when that has happened it starts spending almost all CPU time (worst case) to just swap in and out all active processes to/from RAM trying to execute them and basically nothing gets done.
[Updated on: Thu, 18 October 2007 08:27]
|
|
|