Database Reference
In-Depth Information
algorithms, including random hashing, but we need something more consistent. The
Ketama algorithm, an open-source hashing algorithm and library written at Last.fm, 4
provides a strategy known as consistent hashing . 5 We'll choose this option as our default
Twemproxy hashing strategy for our pool of Redis servers.
Twemproxy runs as a daemon and can be configured using a file in YAML format.
In Listing 3.5, we demonstrate a configuration file for a pool called redispool1 ,
which consists of Redis instances.
Listing 3.5 Configuring Twemproxy for using two Redis instances on a single machine
redispool1:
listen: 127.0.0.1:22121
hash: fnv1a_64
distribution: ketama
auto_eject_hosts: true
redis: true
server_retry_timeout: 1000
server_failure_limit: 1
servers:
- 127.0.0.1:6379:1
- 127.0.0.1:6379:2
Alternatives to Using Redis
Redis, although a very good choice for high-throughput applications that require good
performance, is not the best choice for all large data applications. As we've seen, the
simplicity and memory-based design of Redis means that performance is optimized
towards read/write performance, not for consistency.
Furthermore, as we've seen in the previous example, sharding is not an automatic
process. The key-value design of Redis makes sharding across many machines a much
easier task than with a relational database, but deploying an application reliably across a
pool of instances, even with Twemproxy, takes some configuration work.
Project Voldemort is another open-source key-value data store, inspired by Ama-
zon's Dynamo database. It has a simple interface, much like Redis, but a great deal of
built-in features to help scale pools of machines as linearly as possible. Although Redis
generally exhibits less latency, Voldemort is also a great choice for key-value store
applications that require scaling.
Apache Cassandra blends the properties of a key-value store with that of a tabular
architecture reminiscent of relational databases. Unlike most key-value stores, Cas-
sandra allows users to query data based on value. Like Voldemort, Cassandra also
emphasizes scalability. Cassandra doesn't generally perform database reads and writes
4. www.last.fm/user/RJ/journal/2007/04/10/rz_libketama_-_a_consistent_hashing_algo_for_
memcache_clients
5. www8.org/w8-papers/2a-webserver/caching/paper2.html
 
 
Search WWH ::




Custom Search