InfoQ

News

Scaling Web Applications using Cache Farms and Read Pools

Posted by Gavin Terrill on Nov 12, 2007 08:15 PM

Community
Architecture
Topics
Performance & Scalability,
Clustering & Caching
Tags
Database,
Load Balancing,
Memcache,
Deployment

Michael Nygard, author and No Fluff Just Stuff speaker, recently wrote on two alternative approaches to scaling web application performance and scalability: Cache Farms and Read Pools.

The idea behind Cache Farms is that application nodes in a cluster share an external cache instead of each maintaining their own. This eliminates redundancy and gives back heap space to the application server:

By moving the cache out of the app server process, you can access the same cache from multiple instances, reducing duplication. Getting those objects out of the heap, You can make the app server heap smaller, which will also reduce garbage collection pauses. If you make the cache distributed, as well as external, then you can reduce duplication even further.

Read Pools take advantage of the fact that most data driven applications perform many more read operations than writes. By having the reads performed against a dedicated set of read only replicated databases, you can relieve the burden on the write operation databases:

How do you create a read pool? Good news! It uses nothing more than built-in replication features of the database itself. Basically, you just configure the write master to ship its archive logs (or whatever your DB calls them) to the read pool databases.

Michael points out that updating the read hosts may not happen in real time depending on what database you are using, but notes that this might be a perfectly acceptable tradeoff. MySQL users can take advantage of Read/Write Splitting with MySQL-Proxy.

Michael concludes:

The reflexive answer to scaling is, "Scale out at the web and app tiers, scale up in the data tier." I hope this shows that there are other avenues to improving performance and capacity.

2 comments

Reply

Coherence cache farms by Cameron Purdy Posted Nov 13, 2007 12:35 AM
GigaSpaces recommended by Geva Perry Posted Nov 13, 2007 1:13 AM
  1. Back to top

    Coherence cache farms

    Nov 13, 2007 12:35 AM by Cameron Purdy

    The "cache farm" feature is a popular feature of Oracle Coherence. Benefits include: * Dynamic scale-out, i.e. easily adding and removing servers without interruption to the application (and without losing any data). * Configure any level of redundancy, including no redundancy. * By using dynamic partitioning, Coherence linearly scales out both cache capacity and throughput. * Read-through and read-coalescing for database access. * Write-through and write-behind for database updates, including write-coalescing. * Ability to layer caches, e.g. small on-heap caches layered on top of a large out-of-VM partitioned cache. Peace, Cameron Purdy Oracle Coherence: Clustered Caching for Java and .NET

  2. Back to top

    GigaSpaces recommended

    Nov 13, 2007 1:13 AM by Geva Perry

    Later in his post, Michael Nygard recommends GigaSpaces as a commercial cache farm implementation:

    On the commercial side, GigaSpaces provides distributed, external, clustered caching. It adapts to the "hot item" problem dynamically to keep a good distribution of traffic, and it can be configured to move cached items closer to the servers that use them, reducing network hops to the cache.
    And in another post he writes:
    What can I say about GigaSpaces? Anyone who's heard me speak knows that I adore tuple-spaces. GigaSpaces is a tuple-space in the same way that Tibco is a pub-sub messaging system. That is to say, the foundation is a tuple-space, but they've added high-level capabilities based on their core transport mechanism. So, they now have a distributed caching system. (They call it an "in-memory data grid". Um, OK.) There's a database gateway, so your front end can put a tuple into memory (fast) while a back-end process takes the tuple and writes it into the database. Just this week, they announced that their entire stack is free for startups. (Interesting twist: most companies offer the free stuff to open-source projects.)... I love the technology. I love the architecture.
    To check out our free offer to start-ups and individuals go here. Geva Perry GigaSpaces: The Scale-Out Application Platform

Exclusive Content

VMware Infrastructure 3 Book Excerpt and Author Interview

VMware Infrastructure 3: Advanced Technical Design Guide and Advanced Operations Guide provides a wealth of practical insights into setting up virtualization in todays corporate environments.

Architectures of extraordinarily large, self-sustaining systems

Can a system that is so large it cannot be comprehended be "designed" in a conventional sense? The foundations of computing are about to change. In this talk, Richard P. Gabriel explores why and how.

Using Ruby Fibers for Async I/O: NeverBlock and Revactor

Ruby 1.9's Fibers and non-blocking I/O are getting more attention - we talked to Mohammad A. Ali of the NeverBlock project and Tony Arcieri of the Revactor project.

Agile and Beyond - The Power of Aspirational Teams

Tim Mackinnon talks about the aspirations behind the Agile principles and practices, the desire to become efficient, to write quality code which does not end up being thrown away.

Concurrency: Past and Present

Brian Goetz discusses the difficulties of creating multithreaded programs correctly, incorrect synchronization, race conditions, deadlock, STM, concurrency, alternatives to threads, Erlang, Scala.

ActionScript 3 for Java Programmers

Often the hardest part of changing technologies is language syntax differences. This new article provides Java developers with a transition guide to Actionscript which forms the foundation of Flex.

Neal Ford On Programming Languages and Platforms

Neal Ford talks about having multiple languages running on one of the two major platforms: Java and .NET. He also presents the advantages offered by Ruby compared to static languages like Java or C#.

Future Directions for Agile

David Anderson talks about the history of Agile, the current status of it and his vision for the future. The role of Agile consists in finding ways to implement its principles.