Common MySQL errors
What are they?
How to fix them?
Best practice
Common errors
MySQL server has gone away
Too many connections
Got timeout reading communication packets
Error while sending QUERY packet
MySQL server has gone away
Server timed out and closed the connection
Increase
wait_timeout
Server dropped an incorrect or too large packet
Increase
max_allowed_packet
Too many connections
Open too many connections
Increase
max_connections
Or don't open too much connections e.g. limit number of queue messages (or worker) processing at the same time
Connection is not closed when the job is finish
$entityManager->close()
Got timeout reading communication packets
Connection is kept for too long
Increase
wait_timeout
$entityManager->close()
Error while sending QUERY packet
Because of
Got timeout reading communication packets
Solution in the previous slide
Best practice
Don't let your PHP worker work directly with MySQL
Create sub process for each message received
Limit number of workers
References
How to fix 'Mysql Server has gone away'
'MySQL server has gone away' part 1
How to fix 'Too many connections' #1
How to fix 'Too many connections' #2
'Got an error reading communication packet' error
Symfony and RabbitMQ: Lessions learned
PHP is meant to die
Made with Slides.com