• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
From I/O To RAM
 

From I/O To RAM

on

  • 4,297 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,297
Views on SlideShare
4,277
Embed Views
20

Actions

Likes
6
Downloads
79
Comments
0

5 Embeds 20

http://www.slideshare.net 13
http://www.techgig.com 2
http://115.112.206.131 2
http://www.slideee.com 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 From I/O To RAM Presentation Transcript

    • Riding The Memory Bus
      Ophir Radnitz
    • Agenda
      RAM vs. IO
      Tools of the Trade
      Introducing Terracotta
      RAM Patterns with Terracotta
    • 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
    • I/O Issues
      Scalability issues
      Excessive network chatter
      How do you scale the database?
      Only as fast as your slowest query
      Implies serialization/deserialization
    • Bandwidths (1 of 2)
    • Bandwidths (1 of 2)
    • RAM vs. Disk
      Internet: ~80ms
    • RAM Goodness
      RAM = High Bandwidth & Low Latency
      No serialization costs
      Less network
    • Use Cases
      Low level cache
      SQL, HTTP
      Application cache
      Hibernate 2nd level cache
      Short lived entities
      Queues
    • 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
    • Memcached Limitations for Java
      Remote cache
      Serialization
      2Gb limit
    • 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.
    • In-Memory Considerations
      Reliability requires redundancy
      And/or durability
      In a cluster state must be synced
      Requires state distribution
    • Java Distribution Tools
      Coherence
      GigaSpace
      Ehcache
      Infinispan
      Terracotta
      Hazelcast
    • Introducing Terracotta
      Network-Attached Memory infrastructure for the JVM
      Open source
      (TPL, based on Mozilla License)
      Current version: 3.0.1
    • Terracotta Customers
    • Introducing Terracotta
      Highly Available
      Highly Scalable
      Avoids excessive state replication
      Hub and spoke architecture
    • A Nice Diagram
      Application
      Application
      Application
      Terracotta
      Server
      Terracotta
      Server
      Terracotta
      Server
      Application
      Application
    • How Terracotta Works
      Application
      Terracotta
      Client
      Bootjarinstrumenting your application
      Terracotta Libraries
      JVM
      Terracotta
      Server
      TC handles
      JVM locks and
      data access
    • How Terracotta Works, take 2
      Application
      Application
      Application
      Terracotta Server
      Reference
      Actual instance
    • 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
    • Terracotta Advantages
      Easy to integrate, Maven support
      Great scalability
      No proprietary API (optional)
      Ready made integration modules
      Great diagnostics
      In/out of process
    • Terracotta Development Console
    • Integrating Terracotta
      Download & extract
      Write a tc-config.xml
      Create a bootjar
      Run your app with the bootjar
      Add elements & refactor
    • 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.
    • Terracotta Elements
      HTTP Session Replication
      Cache Evictor
      Queues
      Master-Worker
      Asynchronous Processor
      Cluster membership events
    • Terracotta Patterns
      Data Cache
      Intermediate persistence
      Queues / work distribution
      Write behind to database
    • 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
    • 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
    • Where Should My Objects Live?
      Memory
      Database
      Appropriateness
      dies quickly
      stays forever
      Data Lifetime
    • Intermediate Data Lifetime
      Some data doesn’t have to be stored in the database
      Session information
      Messages / Tokens
      Transaction
      Unfinished stuff
      Data Lifetime
    • 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
    • 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
    • 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
    • Terracotta Drawbacks
      Concurrency awareness
      Massive scalability is a commercial feature
      Requires another machine(s)
      Sharing objects across applications requires configuration
      TIMs documentation
    • Terracotta Pros
      Concurrency awareness
      Fits into your application
      Provides great visibility
      Very versatile usage
      Scales massively
      Doesn’t use serialization
      Great community
    • 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?
    • Terracotta Pros
      Any Questions?