MemcacheDB is a spin-off of memcahe which enhances it with several new capabilities, among which is the master-slave relationship within the cluster with the master being a read/write node and all slaves being read-only nodes (should a master fail, the slaves automatically elect new master).
A connector from NodeJS to memcacheDB has been designed and implemented with several unique features which distinguish it from publically available NodeJS-to-memcache connectors:
- Dynamic connection pools to each node (connections are added when needed and dropped when not needed).
- Master-slave detection upon startup.
- Send all write requests to the master.
- Send all read requests to slaves in a round-robin fashion (if the cluster is reduced to only one member, it will receive both read and write requests).
- Check which is the new master when the old one fails (i.e. when a write request fails).
- Automatically repeat failed write requests to the newly elected master.
- Automatically repeat failed read requests to another slave (or to the master if no other slaves are available) and stop using the failed slave.
- Periodically update the list of slaves from the current master (which allows new slaves to be added on-the-fly without restarting the connector).
The code was developed for a proprietary product and therefore cannot be disclosed.
Automated audit summary (generated using David A. Wheeler’s SLOCCount):
- Development Effort Estimate: 1.14 Person-Months
- Total Estimated Cost to Develop: $ 12,884