PECL/mysqlnd_ms: automatic use of query cache if stale read (eventual consistent) is OK
| From: | Ulf Wendel | Date: | Tue, 17 May 2011 15:10:39 +0000 |
| Subject: | PECL/mysqlnd_ms: automatic use of query cache if stale read (eventual consistent) is OK | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-8270@lists.php.net to get a copy of this message | ||
Hi,
I've added a raw-bin-idea to the PECL/mysqlnd_ms wiki page at https://wiki.php.net/pecl/mysqlnd_ms#raw_bin_ideas_rfcs .
The idea is to introduce a formalized concept of service levels. If the service level set by the PHP application permits reading stale, eventual consistent data from a MySQL slave, the request may be served from a local TTL cache.
Accepting eventual consistent data from a MySQL slave is nothing unusual for a PHP application designed to work with MySQL replication. Slaves may serve stale data. They may be behind the master by a few seconds. If stale data is OK, it may be possible to replace the read from the slave with a read from a local TTL based cache.
Latency is usually lower for reading from the local cache. The saved slave request, lowers the slave server load. In a perfect world, your slaves could serve more read requests due to the caching. Or, you'd need less slaves for a given read load.
The local cache already exists: its called PECL/mysqlnd_qc ... we would "only" have to glue the two pieces PECL/mysqlnd_ms and PECL/mysqlnd_qc together and make PECL/mysqlnd_ms use PECL/mysqlnd_qc in a way that is sort of transparent from the applications point of view.
On the wiki page there is a lot of "could", "may", "might" and so forth - that's exactly how I want it to be read. No promises it will ever be implemented.
Ulf
(The idea is not mine. It is borrowed from Robert Hudges, Continuent, http://scale-out-blog.blogspot.com/2009/03/implementing-relaxed-consistency.html .)