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.
> 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.
There is work in process in WP core to add domain mapping functionality to core (at which time caching will be incorporated).
> 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?
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.
@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.
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.