• I have only two blogs in my multisite setup and it is not going to change for quite sometime.

    I was looking into the newrelic dashboard of my VPS server to debug performance issues and found that 24% of the db load is to the wp_domain_mapping table.

    Is there is a way to cache the domain mapping information so that I can reduce the load on the db, especially since the domain mapping is not going to change in my case.

    https://wordpress.org/plugins/wordpress-mu-domain-mapping/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    You might want to look and see what’s in the table. With only 2 sites a query on that table should take almost no time.

    Thread Starter Sudar Muthu

    (@sudar)

    > You might want to look and see what’s in the table.

    There is only one row in the table 🙂

    >With only 2 sites a query on that table should take almost no time.

    Yeah, it is taking very little time, but since this db call is happening for every request, if we can somehow cache the db results, then the performance could be improved a bit as well.

    Plugin Author Ron Rennick

    (@wpmuguru)

    There is work in process in WP core to add domain mapping functionality to core (at which time caching will be incorporated).

    Thread Starter Sudar Muthu

    (@sudar)

    > There is work in process in WP core to add domain mapping functionality to core (at which time caching will be incorporated).

    Ohh, will wait for it then. Thanks.

    Hello guys, and what about caching queries from the MySQL server? If you cache those hits from within the server may you can save some cpu usage?

    Alex Phelps

    (@alexphelps3)

    We forked Domain Mapping a bit to cache the queries in memcached for an install of about 1500 sites.

    Would be happy to share the code if someone was interested.

    Thread Starter Sudar Muthu

    (@sudar)

    @alexphelps3,

    I am interested. Would appreciate if you can share the code. Thanks.

    @sudar – sorry for the late reply.

    Here is a zip with our forked version of Domain Mapping to utilize Transients stored in Memached instead of querying the DB – https://www.dropbox.com/sh/8whw4a3rvdmixkx/AAAHLTHF80Spok4IAzX3SY5Wa

    You’ll need to be using Object-cache.php backend with Memcached

    Notes
    domain_mapping.php is a forked version of the original domain mapping file to store into trasnisents.
    sunrise.php is also forked to store into transients
    pronto-memcached-purge.php are the hooks to purge memcached transients when you change the domain on a site.

    Obviously I recommended testing this in a development environment before production.

    If you have any issues let me know.

    Thread Starter Sudar Muthu

    (@sudar)

    Thanks for sharing your changes. I will test it in my dev server before deploying it.

    Great, let me know how it goes. Interested to hear if works for others.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Caching domain mapping to save on DB queries?’ is closed to new replies.