3

We have a Django site (Django 1.4) running under NGINX and uwsgi. The site uses MYSQL 5.6.39 which runs on a separate AWS RDS instance. It runs fine for about a week but then suddenly we get the dreaded MYSQL 2006 error - MYSQL server has gone away. We have also noticed that there seems to be a sudden large increase in write IOPS around the time that this occurs.

After searching online, the following suggestions have been made:

  • increase max_allowed_packet to something like 128M
  • increase wait_timeout and interactive_timeout to 86400
  • use lazy=1 in our uwsgi config file on our webapp server

We are in the process of trying these, but this issue is hard to debug since we have to wait a week of running to replicate it. So:

  1. Are there any other parameters we should set to make this issue go away?
  2. Is there anything we can do in our Django app to make this issue go away? For example should we close the DB connection at the start of every view?
  3. Would this whole problem just go away if we switched to a different DB like Postgres?
Marc
  • 151
  • 2
  • Extended support for [Django 1.4 ended in 2015](https://www.djangoproject.com/download/#supported-versions). Are you sure that is the version you are using in 2018? – anx Apr 01 '18 at 05:17
  • @marc Have you resolved your 'MySQL has gone away' issue? If not, please post on pastebin.com or here. A) complete (not edited) my.cnf or my.ini Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) complete MySQLTuner report if readily available Optional very helpful information, if available includes - htop OR top OR mytop for most active apps, ulimit -a for a linux/unix list of limits, iostat -x when system is busy for IOPS by device, df -h for a linux/unix free space list by device, for server tuning analysis. – Wilson Hauck Aug 28 '18 at 05:45
  • I wasn't the one who fixed it, but this was something that we had to fix on our AWS MYSQL instance. It had something to do with setting tx-isolation to read-committed. That's all I know, sorry. – Marc Aug 29 '18 at 17:33
  • @marc Glad you are running. If you are still using MySQL, my offer to analyze your server is still available to improve performance. – Wilson Hauck Sep 02 '18 at 12:07
  • I’m voting to close this question because its comment implies it lacks details to be properly answered by anyone but OP. – anx Jun 23 '21 at 22:13

0 Answers0