HandlerSocket is a NoSQL plugin for MySQL, working as a daemon inside the mysqld process, to accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries; instead it supports simple CRUD operations on tables.
Other
1.14k
stars
151
forks
source link
Atomic increment, decrement and replace operations? #27
I am trying to implement a drop-in replacement PHP Class for Memcache using HandlerSocket, but there are a few technical problems that I can't seem to work around without using external locking mechanisms which hurt performance.
Memcache supports atomic increment and decrement. Since HandlerSocket uses different connections for reading and writing, I can't figure out how to increment/decrement a value without a race condition.
Memcache also supports replace operations. If pipelined operations act as a transaction, then replace can be mapped to delete followed by insert, but it is unclear from the documentation if this is the case. Can you please clarify this?
You can't implement atomic increment nor atomic replace ops using the current version of HandlerSocket. A bunch of pipelined requests does not act as a transaction.
I am trying to implement a drop-in replacement PHP Class for Memcache using HandlerSocket, but there are a few technical problems that I can't seem to work around without using external locking mechanisms which hurt performance.
Memcache supports atomic increment and decrement. Since HandlerSocket uses different connections for reading and writing, I can't figure out how to increment/decrement a value without a race condition.
Memcache also supports replace operations. If pipelined operations act as a transaction, then replace can be mapped to delete followed by insert, but it is unclear from the documentation if this is the case. Can you please clarify this?
Thanks.