Caching in the Cloud
       Alex Miller
       Terracotta



         Twitter: @puredanger
         Blog:    http://tech.puredanger.com
Clouds


• Blah blah blah scalability blah blah blah
  elasticity blah blah blah efficiency blah blah
  blah
Database Pain
•   Scale in cloud
    •   Born in enterprise -> doesn’t work at web scale
    •   Expensive (RAC) or complicated (MySQL
        sharding)
•   Elasticity in cloud
    •   Harder to migrate disk than to migrate
        processes
    •   Single coordination point constrains flexibility
Ideal Cloud Data Layer
• Protects “in-flight” data - durability
• Has low latency, high throughput
• Deploys elastically w/app tier
• Doesn’t require app changes
NoSQL

• Key-value stores
• Document databases
• And many other flavors...
Terracotta

• Open-source Java clustering technology
• Clustered - dynamically add/remove nodes
• High availability - server-based w/failover
• Data is redundant, copied to disk for backup
• In-memory speed
Don’t Change Your App!

• Hibernate Second Level Cache - ORM
• Ehcache - data caching
• Quartz - scheduling and job recovery
• HTTP Sessions - session availability
• Spring - app wiring and state
Database Offload

• Scale your app (use the cloud)
• Scale your data (use Terracotta)
• Don’t scale your db (use for historical)
Hotel company
•   Business
    •   Room reservation + loyalty points
    •   Multiple mainframe apps
•   Estimate: $12M, 5 years -> Oracle RAC
•   Instead:
    •   Private cloud
    •   VMWare, Spring, Terracotta
    •   Saving $11M / year on DB and App Server licenses
Deployment Approach
Travel Reservation
              System
•   Problem
    •   Mainframe costs >$5M / year in EDS fees
    •   Retain high reliability in lower cost env
•   Solution
    •   Private data cloud - Terracotta + Ehcache
    •   Saved $5M / year
    •   99.99% reliability
Gnip
•   Web feeds, message transformation, delivery
    •   Twitter, Delicious, Flickr, etc
•   Problem: large quantities of transient data
•   Solution:
    •   12 nodes on EC2
    •   Terracotta for data storage
    •   50k TPS
Scalability Continuum

• Write your app once using standard open
  source technologies
• Same app works on your machine, in your
  test env, in the cloud
• Change where and how you deploy, not
  your app

Caching In The Cloud

  • 1.
    Caching in theCloud Alex Miller Terracotta Twitter: @puredanger Blog: http://tech.puredanger.com
  • 2.
    Clouds • Blah blahblah scalability blah blah blah elasticity blah blah blah efficiency blah blah blah
  • 3.
    Database Pain • Scale in cloud • Born in enterprise -> doesn’t work at web scale • Expensive (RAC) or complicated (MySQL sharding) • Elasticity in cloud • Harder to migrate disk than to migrate processes • Single coordination point constrains flexibility
  • 4.
    Ideal Cloud DataLayer • Protects “in-flight” data - durability • Has low latency, high throughput • Deploys elastically w/app tier • Doesn’t require app changes
  • 5.
    NoSQL • Key-value stores •Document databases • And many other flavors...
  • 6.
    Terracotta • Open-source Javaclustering technology • Clustered - dynamically add/remove nodes • High availability - server-based w/failover • Data is redundant, copied to disk for backup • In-memory speed
  • 7.
    Don’t Change YourApp! • Hibernate Second Level Cache - ORM • Ehcache - data caching • Quartz - scheduling and job recovery • HTTP Sessions - session availability • Spring - app wiring and state
  • 8.
    Database Offload • Scaleyour app (use the cloud) • Scale your data (use Terracotta) • Don’t scale your db (use for historical)
  • 9.
    Hotel company • Business • Room reservation + loyalty points • Multiple mainframe apps • Estimate: $12M, 5 years -> Oracle RAC • Instead: • Private cloud • VMWare, Spring, Terracotta • Saving $11M / year on DB and App Server licenses
  • 10.
  • 11.
    Travel Reservation System • Problem • Mainframe costs >$5M / year in EDS fees • Retain high reliability in lower cost env • Solution • Private data cloud - Terracotta + Ehcache • Saved $5M / year • 99.99% reliability
  • 12.
    Gnip • Web feeds, message transformation, delivery • Twitter, Delicious, Flickr, etc • Problem: large quantities of transient data • Solution: • 12 nodes on EC2 • Terracotta for data storage • 50k TPS
  • 13.
    Scalability Continuum • Writeyour app once using standard open source technologies • Same app works on your machine, in your test env, in the cloud • Change where and how you deploy, not your app