From I/O To RAM
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

From I/O To RAM

on

  • 4,446 views

IO is slow, memory is fast. For many applications, the main performance and scalability bottleneck is disk and network access. This session will cover strategies that can help you utilize your RAM ...

IO is slow, memory is fast. For many applications, the main performance and scalability bottleneck is disk and network access. This session will cover strategies that can help you utilize your RAM efficiently even in a distributed environment.
Discover how a clustering solution like Terracotta can help you reduce overall application latency.

Statistics

Views

Total Views
4,446
Views on SlideShare
4,425
Embed Views
21

Actions

Likes
6
Downloads
80
Comments
0

5 Embeds 21

http://www.slideshare.net 13
http://www.slideee.com 3
http://www.techgig.com 2
http://115.112.206.131 2
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

From I/O To RAM Presentation Transcript

  • 1. Riding The Memory Bus
    Ophir Radnitz
  • 2. Agenda
    RAM vs. IO
    Tools of the Trade
    Introducing Terracotta
    RAM Patterns with Terracotta
  • 3. Anatomy of an Application
    Get a DB connection, start transactioning
    Start a request
    Network
    Get a bunch of data
    Access disk,
    Serialization
    Release resources
    Render stuff
  • 4. I/O Issues
    Scalability issues
    Excessive network chatter
    How do you scale the database?
    Only as fast as your slowest query
    Implies serialization/deserialization
  • 5. Bandwidths (1 of 2)
  • 6. Bandwidths (1 of 2)
  • 7. RAM vs. Disk
    Internet: ~80ms
  • 8. RAM Goodness
    RAM = High Bandwidth & Low Latency
    No serialization costs
    Less network
  • 9. Use Cases
    Low level cache
    SQL, HTTP
    Application cache
    Hibernate 2nd level cache
    Short lived entities
    Queues
  • 10. Generic Tools
    Memcached
    A high-performance, distributed memory caching system
    Used EVRYWHERE: Facebook, Twitter, Digg, Wikipedia, Slashdot, LiveJournal, Sourceforge etc.
    Squid
    Routing and load balancing
    HTTP cache
  • 11. Memcached Limitations for Java
    Remote cache
    Serialization
    2Gb limit
  • 12. Java In-Memory Tools
    Prevayler, Space4J
    Persist objects in memory, supports ACID and file system journaling
    Db4O in memory, Perst
    Object oriented database
    Jofti
    A high-performance object indexing and searching solution. Supports Map.
  • 13. In-Memory Considerations
    Reliability requires redundancy
    And/or durability
    In a cluster state must be synced
    Requires state distribution
  • 14. Java Distribution Tools
    Coherence
    GigaSpace
    Ehcache
    Infinispan
    Terracotta
    Hazelcast
  • 15. Introducing Terracotta
    Network-Attached Memory infrastructure for the JVM
    Open source
    (TPL, based on Mozilla License)
    Current version: 3.0.1
  • 16. Terracotta Customers
  • 17. Introducing Terracotta
    Highly Available
    Highly Scalable
    Avoids excessive state replication
    Hub and spoke architecture
  • 18. A Nice Diagram
    Application
    Application
    Application
    Terracotta
    Server
    Terracotta
    Server
    Terracotta
    Server
    Application
    Application
  • 19. How Terracotta Works
    Application
    Terracotta
    Client
    Bootjarinstrumenting your application
    Terracotta Libraries
    JVM
    Terracotta
    Server
    TC handles
    JVM locks and
    data access
  • 20. How Terracotta Works, take 2
    Application
    Application
    Application
    Terracotta Server
    Reference
    Actual instance
  • 21. Terracotta Features
    Cross-JVM object identity
    Automatic Persistence to disk
    Virtual Memory
    spill heap to TC and/or to disk, transparently
    Cluster profiling & visualization
    JMX-based monitoring and management
  • 22. Terracotta Advantages
    Easy to integrate, Maven support
    Great scalability
    No proprietary API (optional)
    Ready made integration modules
    Great diagnostics
    In/out of process
  • 23. Terracotta Development Console
  • 24. Integrating Terracotta
    Download & extract
    Write a tc-config.xml
    Create a bootjar
    Run your app with the bootjar
    Add elements & refactor
  • 25. TIM - Terracotta Integration Modules
    Packaged functionality
    Easy to integrate
    Handles locks details
    Examples:
    Concurrent collections, Ehcache
    Lucene/Compass, Spring Security
    Pipes, Wicket, Tomcat, Jetty
    Hibernate, JBoss, Spring etc.
  • 26. Terracotta Elements
    HTTP Session Replication
    Cache Evictor
    Queues
    Master-Worker
    Asynchronous Processor
    Cluster membership events
  • 27. Terracotta Patterns
    Data Cache
    Intermediate persistence
    Queues / work distribution
    Write behind to database
  • 28. Data Cache Considerations
    Figure out data lifecycle
    Read-only, metadata, configuration, session
    Where cache is applicable
    Single point of update
    Set eviction policies
    LRU, FIFO
  • 29. Data Cache
    Session cache is easier, entity cache needs real distribution
    Use a generic cache
    ConcurrentMap + Map Evictor (+ Jofti)
    Or a Hibernate 2nd level cache
    ehcache, TC-Cache
  • 30. Where Should My Objects Live?
    Memory
    Database
    Appropriateness
    dies quickly
    stays forever
    Data Lifetime
  • 31. Intermediate Data Lifetime
    Some data doesn’t have to be stored in the database
    Session information
    Messages / Tokens
    Transaction
    Unfinished stuff
    Data Lifetime
  • 32. TIM Pipes: Queues
    Execute time consuming tasks asynchronously
    In a reliable way
    Load balanced
    Examples:
    Send emails, process images
    Supports pub/sub, routing
    No need for JMS
  • 33. CommonJ – Work Distribution
    A joint API spec by Oracle and IBM
    Provides interfaces for:
    Worker / WorkItem / WorkManager
    Scheduler
    etc…
    TIM-Messaging provides an implementation
    Pipes
    Master / Worker
  • 34. Write Behind to System Of Record
    Asynchronously persist to DB
    Work queue
    “1.5 phase commit”
    Flags objects as dirty
    Avoids syncing dirty objects
    Flushes objects
    Flags objects as clean
  • 35. Terracotta Drawbacks
    Concurrency awareness
    Massive scalability is a commercial feature
    Requires another machine(s)
    Sharing objects across applications requires configuration
    TIMs documentation
  • 36. Terracotta Pros
    Concurrency awareness
    Fits into your application
    Provides great visibility
    Very versatile usage
    Scales massively
    Doesn’t use serialization
    Great community
  • 37. Summary
    Ask yourself:
    Does it belong in the DB?
    Do I have to go to the DB for that?
    Do I have to do it now?
  • 38. Terracotta Pros
    Any Questions?