Databases Reference
In-Depth Information
the underlying MySQL storage engine. The project is hosted online on github at https://github
.com/ahiguti/HandlerSocket-Plugin-for-MySQL .
The HandlerSocket plugin can be loaded into an existing MySQL server. Loading HandlerSocket
does not switch the SQL layer off. In fact both layers become available. HandlerSocket provides a
NoSQL-like interface to MySQL allowing faster access, especially for primary key-based fetches.
Figure 15-3 shows what a MySQL confi guration with HandlerSocket looks like.
SQL
layer
port 3306
MySQL
Client
Storage Engine
reader port -- 9998
write port -- 9999
Handler
Socket
FIGURE 15-3
HandlerSocket implements network protocol, API, and a lightweight connection to interface
directly with a MySQL storage engine, like InnoDB. It allows you to query the MySQL store in the
same fl exible and high-performance manner that NoSQL databases offer. Benchmarks published
online at http://yoshinorimatsunobu.blogspot.com/2010/10/using-mysql-as-nosql-story-
for.html show that up to 750,000 primary key lookup queries per second could be performed with
HandlerSocket. This seems extremely impressive.
HandlerSocket's API does not involve the overhead of opening, locking, unlocking, and closing
tables. Its API is very lightweight and NoSQL-centric as compared to the SQL layer. HandlerSocket
has C++ and Perl APIs available with the distribution. Additional implementations of the
HandlerSocket API for PHP, Java, Python, Ruby, JavaScript, and Scala are available from sources
other than the core distribution. You can get a list of sources of these additional libraries at
https://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL . HandlerSocket's network
packets are small and can support several concurrent connections.
Using HandlerSocket is better than using Memcached with the SQL layer, because it not only avoids the
SQL layer but also avoids duplicate caches and the possible inconsistencies in replication. HandlerSocket
interfaces directly with the storage engine, so there are not two replicas but a single store.
The HandlerSocket-based NoSQL solution is especially suitable for high-performance reads. The
base MySQL storage engine provides transactional support and recovery from a crash. You can also
Search WWH ::




Custom Search