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

Made with Slides.com