Upload
others
View
21
Download
0
Embed Size (px)
Citation preview
Red Hat JBoss Data Grid &the Hibernate Suite: A Love Affair
Sanne Grinovero Senior Software Engineer, Red HatJune 13, 2013
Goals
● Overview of existing integrations Hibernate / JBoss Data Grid
● Familiarize with JBoss Data Grid concepts● What problems could these integrations
solve for you
Who am I?
Engineering team: Hibernate● Hibernate Search lead● Hibernate OGM team● Hibernate ORM
● Query parser and performance
● Infinispan● Contributor for fun and need● Designed some recent improvements● Driving some of the Hibernate and Apache Lucene integrations
● @SanneGrinovero on Twitter
Why am I standing here?
I'm not a spokesman.
Nor a designer.
Common mistake:Need to avoid lazy loading with custom fetching
select b from Book bjoin fetch b.publishedIn
where b.id = :bookId
Measure the Effect, avoid generalization
● Cool we avoided some SQL statements
● What on the network payload?
● Is the RDBMS happier?
Better: avoid any pointless loading
select b from Book bwhere b.id = :bookId
Love affair 1# @Cache ?
● 2nd level
● Choice of implementations
● HashTable● Ehcache● Infinispan
● Available on multiple levels
● Entity● Relation● Query
How to start cheating
● Enable caching on entities
● .. and/or relations
● hibernate.cache.use_second_level_cache = true
TX / secondbenchmark - JBoss EAP 6.1
1 User10 Users
20 Users30 Users
40 Users50 Users
60 Users70 Users
80 Users90 Users
100 Users110 Users
120 Users130 Users
140 Users150 Users
160 Users170 Users
180 Users190 Users
200 Users
0
1000
2000
3000
4000
5000
6000
7000
8000
Average Response timebenchmark - JBoss EAP 6.1
1 User10 Users
20 Users30 Users
40 Users50 Users
60 Users70 Users
80 Users90 Users
100 Users110 Users
120 Users130 Users
140 Users150 Users
160 Users170 Users
180 Users190 Users
200 Users
0
10
20
30
40
50
60
What kind of data structure do we need for the Cache?
What is ?
● Community project
● A high performance cache
● A NoSQL database: a key-value store
● Just another...
java.util.Map<K, V>
java.util.concurrent.ConcurrentMap<K, V>
javax.cache.Cache<K, V>
Infinispan Cache Modes
● Local
● Invalidation
● Replication
● Distribution
2nd level cache: Invalidation
JBoss Data Grid?
Remote access
● Multiple protocols
● Not only clients in JVM
Remote clients to Data Grid
Library Mode
Linear scalability by design
● Linear throughput
● Linear capacity
● Linear processing
A simple but powerful local cache
Excellent for caching
● Low Inter-reference Recency Set (LIRS)● http://dl.acm.org/citation.cfm?id=511334.511340
● Transactional
● Reliable
● High performance
● Multiple nodes via JGroups● Dynamic topology● Discovery● Cloud friendly networking
Love affair 2# sharing a powerful Search Engine
Why Apache Lucene?
● Extremely efficient
● Very reliable, great community
● Flexible and extensible
● Apache Licensed OSS
● Not just queries
Results returned in order of releveance
“More Like This”
Faceting
Filters: declarative, stacking, reusable
@Spatial: geospatial distance filtering and sorting
Hibernate Search & JBoss Data Grid queries:same engine, same queries
● Same underlying technology
● Same API to learn
● Same indexing configuration options
There is one catch: an index to maintain
● The typical Lucene index is stored on filesystem
● A Lucene index is not easy to replicate on multiple nodes (nor efficient)
● Write operations require an exclusive lock
Async replication delegating writes to a master
Love affair 3# storing the index in the Data Grid
Real-Time replication by storing the index in the JBoss Data Grid
Is it fast?
The Lucene Directory can be used independently
This unlocks the Red Hat JBoss Data Grid as a platform for even more complex distributed data mining tasks on natural language and classification
Durability
Love affair 4# Infinispan delegating to Hibernate persistence
● JPA CacheStore available in community Infinispan 5.3
Love affair 5# The really cool stuff...
(not a product yet)
● Replace your RDBMS, keep the persistence layer
● JPA / Hibernate API for any NoSQL
● Standards compliant
● Influenced by the relational model
● Does queries too (gradual ramp up)
● Not much new to learn
● Same well known API, same integration options
What it does
● JPA front end for:
● Infinispan, Ehcache
● MongoDB
● Coming next: Neo4J, Cassandra, CouchDB
● CRUD support for @Entities
• Full-text queries by using Hibernate Search
● JP-QL queries (simple ones)
Future● More complex JP-QL
support
● Hybrid storage
How it looks
Review
● In products:● 2nd level caching● Search engine● Storing Apache Lucene
indexes in the Jboss Data Grid
● In community only:● Infinispan with
Write-through to JPA● Infinispan to replace the
database
Mentioned today
● The products● Red Hat JBoss Data Grid
http://red.ht/data-grid
● JBoss Web Framework Kit
● JBoss Enterprise Application Platform
● The projects● Infinispan● Hibernate● Hibernate Search● Hibernate OGM● Apache Lucene
More: Replication Between Datacenters with Red Hat JBoss Data GridBela Ban — Consulting Software Engineer, Red HatRoom 207 — Thursday, June 13, 2:30 pm - 3:30 pm (right now)