Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Scaling Up Hibernate/JPA Applications with Infi...
Search
Galder Zamarreño
April 20, 2013
Technology
220
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Scaling Up Hibernate/JPA Applications with Infinispan Second-Level Cache
Galder Zamarreño
April 20, 2013
More Decks by Galder Zamarreño
See All by Galder Zamarreño
Principles and Patterns for Streaming Data Analysis
galderz
0
130
Streaming Data Analysis with Kubernetes
galderz
0
2.6k
The Rough Guide to Java RPC Frameworks
galderz
1
7.2k
Streaming Data Analysis with Kubernetes
galderz
1
450
Streaming Data Workshop @ Codemotion Madrid
galderz
0
1.5k
Streaming Data : ni pierdas el tren, ni esperes en balde
galderz
0
3.2k
Data grids : descubre qué esconden los datos
galderz
0
3.3k
Streaming Data Workhop @ Devoxx
galderz
0
400
Streaming Data Analysis with Kubernetes
galderz
0
2.2k
Other Decks in Technology
See All in Technology
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
150
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
290
Bet AI Day 2026丨AIを「使う」から、AIが「働く」へ ― LayerXが進める「組織AI」の社会実装
layerx
PRO
3
2.8k
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
180
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/6 - 2026/8
oracle4engineer
PRO
0
130
プロダクトエンジニアに必要な「いい感じ」に作る能力 〜たくさん作れる時代に、どこまで作るかの決め方〜
jnishime_dresscode
2
1.4k
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
150
Tab5をRubyで動くパソコンにする
kishima
2
270
When Does a Local Qwen Start to Break
morshoto
0
190
AI 駆動 Terraform 開発/SRE_BizReach_MIXI_2
visional_engineering_and_design
3
1.9k
Snowflakeで実現する全社横断の顧客の声(VOC)分析・活用基盤@Snowflake World Tour Tokyo 2026
yuto16
0
120
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
170
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
270
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
New Earth Scene 8
popppiees
3
2.5k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
510
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
320
The Curse of the Amulet
leimatthew05
2
14k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
202
76k
Building Adaptive Systems
keathley
44
3.2k
Transcript
None
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
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
Agenda • Bottlenecks in Hibernate/JPA applications • Applying caching techniques
sensibly • Distribute caches across multiple nodes • Caching in managed environments
Why do we care?
DB = bottleneck Most Hibernate/JPA applications involve intensive I/O workload
against database
Bottleneck problems Bottlenecks decrease throughput, increase latency... and make users
:(((
We care because we want to make users :))
How do we scale up Hibernate/JPA applications ?
Option 1: $$$ Buy/rent more powerful hardware to host the
DB... who can afford that?
Option 2: Caching Use second-level caching sensibly to reduce burden
on database
Second Level Cache JVM-level, or clustered, cache whose contents can
be shared between different transactions
Lesson 1: Don't apply caching blindly! Always measure first!
Caching cost! Local caches have a cost (memory, GC), clustered
caches add more cost (network, IO)
Demo 1: Measure performance
Lesson 2: Think what you are going to cache!
Think about reads Biggest performance gain comes from caching read-
mostly data
What kind of data? Entities, collections of entities, and query
results can be cached
Entity caching Mark entities cacheable, and define the cache concurrency
strategy
Query caching Speed up execution of repeated queries (w/ same
parameters) by caching their results
Query results validity Cached query results are valid as long
as none of the entity types involved are updated
Demo 2: Query cache in action
Lesson 3: How to select a caching provider
Cache Strategies • Read-only • data never updated • insert/delete
allowed • Read/write • data can be updated • with JBDC transactions or no transactions
Cache Strategies • Nonstrict read/write • data rarely updated •
with JBDC transactions or no transactions • Transactional • data can be updated • for JTA environments
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
Lesson 4: Scale up your Hibernate/JPA app going multi-node!
Caches form cluster Infinispan uses JGroups to form a peer-to-peer
cluster, providing discovery, failure detection...etc
Clustered Entities Recommended using invalidation to keep entities consistent accross
cluster (replication can be used too)
Queries / Timestamps Recommended keeping query cache local to each
node, but must replicate update timestamps cache
Demo 3: Clustered second-level cache in action!
Lesson 5: Scaling up JPA in managed environments
JPA Caching simplified Infinispan as default cache provider (with sensible
defaults), and ready to cluster!
shared-cache-mode Persistence unit configuration option that should be set to
ENABLE_SELECTIVE
Demo 4: JPA caching in JBoss AS 7
Summary Q - How do we scale up Hibernate/JPA applications?
Enable second level cache!!
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
Questions • http://infinispan.org • http://hibernate.org • http://github.com/galderz/secondlc • https://docs.jboss.org/author/display/ ISPN/Using+Infinispan+as+JPA-Hibernate
+Second+Level+Cache+Provider