• Resolved andyphillips82

    (@andyphillips82)


    We upgraded to 4.8.2 a few days ago and we’ve been seeing some response spikes in New Relic.

    One of the clues we found are that select queries are going to our master DB.

    Anyone else experiencing this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andyphillips82

    (@andyphillips82)

    Did a bit more digging and saw selects going to the master DB before 4.8.2.

    Any idea why we’d be getting select queries to our master DB?

    Plugin Author Barry

    (@barry)

    Any idea why we’d be getting select queries to our master DB?

    There are a few reasons this could happen.

    1. Whe most obvious one is that the read priority for the master is set to something > 0. What do you have the read priority set to in your configuration?

    2. HyperDB sends reads to the master for a given table on a single pageload if there was an update to that table on the same pageload. So for example, if you UPDATE wp_options and then SELECT from wp_options 10 times on the same page, those 10 SELECTs would go to the master, even if the read priority is set to 0. This is because it’s very likely the latest changes haven’t been replicated if you are using asynchronous (the default) replication in MariaDB. If you’re interested how this part of the code works, look for where $this->srtm is set to true in the HyperDB source code.

    3. Your code is explicitly setting $this->srtm to true either by calling send_reads_to_masters() or some other way.

    Hope this is helpful, let us know what you find after reviewing your configuration and code.

    Thread Starter andyphillips82

    (@andyphillips82)

    Actually I think that does help.

    We’re seeing the issue around /feed/ and the_content.

    oEmbeds update post meta for a cache purpose, so possible that those selects are going to master because of the oEmbeds update_post_meta.

    Hoping the spikes are actually more around DB maintenance, as post_meta is the only table we’re having issues with.

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Selects going to Master DB – 4.8.2’ is closed to new replies.