Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scaling Up Hibernate/JPA Applications with Infi...

Scaling Up Hibernate/JPA Applications with Infinispan Second-Level Cache

Galder Zamarreño

April 20, 2013
Tweet

More Decks by Galder Zamarreño

Other Decks in Technology

Transcript

  1. Scaling Up Hibernate/JPA Applications with Infinispan Second-Level Cache ! Galder

    Zamarreño Senior Software Engineer Red Hat, Inc ! 20th April 2013, São Paulo
  2. Galder Zamarreño • R&D Engineer, Red Hat Inc. • Infinispan

    developer • Creator of Infinispan second-level cache provider for Hibernate • Escalante founder and lead • Twitter: @galderz
  3. Agenda • Bottlenecks in Hibernate/JPA applications • Applying caching techniques

    sensibly • Distribute caches across multiple nodes • Caching in managed environments
  4. Query results validity Cached query results are valid as long

    as none of the entity types involved are updated
  5. Cache Strategies • Read-only • data never updated • insert/delete

    allowed • Read/write • data can be updated • with JBDC transactions or no transactions
  6. Cache Strategies • Nonstrict read/write • data rarely updated •

    with JBDC transactions or no transactions • Transactional • data can be updated • for JTA environments
  7. Strategy Support Provider / Strategy read- only nonstrict r/w r/w

    transactional Infinispan yes no no yes EhCache yes yes yes yes ConcurretHashMap (testing) yes yes yes no
  8. Caches form cluster Infinispan uses JGroups to form a peer-to-peer

    cluster, providing discovery, failure detection...etc
  9. Queries / Timestamps Recommended keeping query cache local to each

    node, but must replicate update timestamps cache
  10. Summary • Don't apply caching blindly! Always measure first! •

    Think what you are going to cache! • How to select a caching provider • Scale up your app going multi-node! • Scaling up JPA in managed environments