Thanks for the great reply.
I love Redis -- it's so simple and yet very powerful. I wrote the AUTH command
for it, as well as a few open source clients for it (C++, Node.js). I maintain
the Perl client for Redis as well. These are all on GitHub. This is a little
OT but: I like Tokyo Cabinet/Tyrant because Redis keeps the entire dataset in
memory which just doesn't scale well since there's considerable memory overhead
per key/value pair on average. Also nice with TT is that one
can use an in-memory version of TT which has an in-memory database as master with a local disk-based slave; writes are
async to the original TT write. Thus, reads and writes fly and are disk-backed... Redis only
writes every so often to disk and that coupled with excessive memory usage is a
showstopper for me. Sure you can configure Redis to write sync/save to disk
but it's not optimized for that since it handles a single connection request at
a time. In other words, it blocks, and it would also block on disk I/O. Bad,
bad, bad.
I just learned about Linode's bandwidth pooling feature this morning actually
in another thread. It's killer! That does open some doors for running a
single linode as a dedicated "vip" or reverse proxy like nginx which routes
over the private network to other linodes (in the same data center). Nginx
ignores upstream processes that have stopped responding.
OK with your input, this is what I envision. This is in one data center:
Linode A - reverse-proxy (nginx) and datastore (tokyo tyrant)
Linode B - "upstream" processes (e.g. application logic)
Linode C - "upstream" processes (e.g. application logic)
Linode D - "upstream" processes (e.g. application logic)
...
Linode Z - "upstream" processes (e.g. application logic)
Linode A reverse-proxies to Linodes B-Z over the private network, and Linodes
B-Z talk to the datastore on Linode A, also over the private network. I'd
request Linode to put each Linode (as much as possible) on different physical
machines like you mentioned.
This seems like a nice solution because 1) nginx scales to many thousands of
simultaneous requests thanks to its use of async I/O (e.g. epoll) and 2) I can
scale horizontally by adding more linodes (e.g. E, F, G, ... Z) as needed.
Quote:
As for the second part, you'll need to set up an identical cluster in a
different location, make sure that each cluster is capable of operating while
the other is offline, but at the same time keep both in sync while both are
online. Tricky
Right! Tokyo Tyrant is nice here too. You can setup master-master
("dual-master") replication between instances. I suppose OpenVPN or a SSH
tunnel between the "linode A" in *each* data center would work.
See the "Replication" section here:
http://tokyocabinet.sourceforge.net/tyrantdoc/#tutorial
The only thing that I'm not sure about still is how to implement the redundancy
between the two data centers for web service requests -- the TT replication covers the datastore part.
For instance, if the VIP/reverse-proxy goes down
due to a hardware failure? I'd want all requests to go to the
VIP/reverse-proxy of the other data center until I get the reverse-proxy/datastore
up again in the first data center.
As I understand it, DNS round robin wouldn't really work for that. It would
just cause 50% of the requests to fail. How would you do this? Just point DNS
to data center one and if there's a problem, switch DNS to point to the other data
center? What do I need to know here? Is a short TTL all this requires? Have any
other ideas?