3

We lately moved to MySQL V5.5 on CentOS release 6.7 with master and 2 slaves. Since then the replication process lags a lot behind the master with the line in the process list of:

invalidating query cache entries (table).

The global query_cache_type & size were set to 0.

I have checked around and I can see it's a known old bug in MySQL but could not find a workaround for this issue.

Any advice?

  • query_cache_type OFF in my.cnf before server restart.
  • query_cache_wlock_invalidate set to OFF.
  • using default % storage_engine as InnoDB.

We ran some more tests and we had an issue with disk IO - sar -u showed about 3-4 %iowait, disks infra changes help reduce this to about 1.5-2% but it still doesn't help the replication not lagging for 5000(!) seconds behind the master.

Paul White
95.4k30 gold badges440 silver badges689 bronze badges
asked Jan 26, 2016 at 9:52
0

2 Answers 2

2
  • Was query_cache_type OFF (0) in my.cnf, not merely turned off later? (This seems to be critical for having it really off.)

  • Another possible common thread in the bugs -- MyISAM. If you are using MyISAM, you really should convert to InnoDB. There are many reasons for converting. Here are some tips on doing the conversion: http://mysql.rjweb.org/doc.php/myisam2innodb

  • Make sure that query_cache_wlock_invalidate is OFF.

answered Jan 26, 2016 at 23:52
1
  • Well, I am stumped. You could consider writing a bug, or commenting on one of the existing bugs. But it might be considered just a dup. Commented Jan 27, 2016 at 17:56
1

Wiki answer generated from comments by AlonP and Rick James:

After some more tuning what helped was to update innodb_flush_log_at_trx_commit = 0. When value was set to 1 with sync_binlog=1 this can cause the slave delay.

=2 is arguably slightly better than =0. =1 leads to a lot of I/O for security. However, the slave is not the only source of the data, so a crash that corrupts stuff is not the end of the world.

2 does an fsync once a second. 0 hopes that the OS eventually flushes things. fsync flushes pending writes to disk.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.