Infinispan for Dummies
-
Upload
galder-zamarreno -
Category
Technology
-
view
13.902 -
download
0
Transcript of Infinispan for Dummies
Thursday, November 3, 11
for Dummies
Galder ZamarreñoSenior Software Engineer
Red Hat, Inc
Thursday, November 3, 11
Who is Galder?
• R&D engineer (Red Hat Inc):
• Infinispan developer
• Contributor and committer:
• JBoss AS, Hibernate, JGroups...etc
• More about me?
• Blog: zamarreno.com
• Twitter: @galderz
Thursday, November 3, 11
Agenda
• What is Infinispan?
• Infinispan as in-memory cache
• Infinispan as in-memory data grid
• Data-as-a-Service with Infinispan
• Clustering and migration challenges
• Who uses Infinispan?
Thursday, November 3, 11
What is Infinispan?
• Data grid platform:
• Open source (LGPL)
• In-memory
• Highly available
• Elastic
Thursday, November 3, 11
Local in-memory cache
• Performance booster
• Good for data that is:
• Hard to calculate
• Expensive to retrieve...etc
• Why not ConcurrentHashMap? Infinispan offers:
• Greater concurrency with MVCC
• Built-in eviction...etc
Thursday, November 3, 11
Local cache example
Thursday, November 3, 11
Clustered in-memory cache
• Same as local but cluster-aware
• More shared-cache space!
• Can help you cluster your framework too!
• Invalidation cache mode commonly used
Thursday, November 3, 11
Invalidation
Thursday, November 3, 11
Invalidation
Thursday, November 3, 11
Invalidation
Thursday, November 3, 11
Cache.putForExternalRead()put() putForExternalRead()
Use for updating state Use to cache state read from external source
Regular lock acquisition timeout Fail-fast
Could throw an exception Fails quietly
Could cause existing transaction to fail
Will never affect existing transactions
Thursday, November 3, 11
Clustered cache configuration
Thursday, November 3, 11
P2P Embedded Architecture
Thursday, November 3, 11
In-memory data grid
• It’s a data store, not just a cache
• An authoritative data sink
• FADE
• Fast
• Available
• Distributed
• Elastic
Thursday, November 3, 11
Distribution vs Replication
Thursday, November 3, 11
Replication
Thursday, November 3, 11
Distribution
• With number of copies = 2
Thursday, November 3, 11
Consistent Hashing
Thursday, November 3, 11
Virtual Nodes
Thursday, November 3, 11
Client/Server Architecture
• Supported protocols
• REST
• Memcached
• Hot Rod
Thursday, November 3, 11
Server Endpoint Comparison
Thursday, November 3, 11
Hot Rod server and clients
Thursday, November 3, 11
Traditional 3-tier App
Thursday, November 3, 11
Typical IaaS App
Thursday, November 3, 11
Typical PaaS App
Thursday, November 3, 11
State
Thursday, November 3, 11
Virtualize data
• Some public services exist
• Amazon RDS and SimpleDB
• FathomDB, Cloudant...etc
• But not all cloud deployments are public!
• Private cloud very important
• How can you build a DaaS yourself?
Thursday, November 3, 11
Characteristics of DaaS
• Elastic data
• Need to scale with other tiers
• Response times should be linear
• Needs to be highly available!
• Nodes with die! The service shouldn’t
Thursday, November 3, 11
DaaS with Infinispan
Thursday, November 3, 11
Clustering challenges
• JGroups taking care of clustering
• Default config file good for 4-16 nodes
• Bigger clusters require tweaking...
• Adjust transport and discovery to environment limitations
• Especially where UDP multicast not allowed
• These adjustments do not require altering code
Thursday, November 3, 11
Migration best practices
• ‘RadarGun’ project benchmarks different data grid products
• Benchmark your use case!
• Helps with mapping between different provider APIs
• XSLTs distributed to transform configuration
Thursday, November 3, 11
Who uses Infinispan?
• Examples:
• As a cache:
• Hibernate for the second level cache
• HTTP session cache in JBoss AS 6 and AS 7
• As a data grid:
• Real-time trading app of a well known stock exchange
Thursday, November 3, 11
What’s next?
• Distributed Executors and Map/Reduce
• Hibernate OGM (Object-Grid-Mapping)
• JPA-like interface backed by Infinispan
• ...etc
Thursday, November 3, 11
Summary
• Infinispan is a fast powerful local cache
• More space and scales up when cache is clustered
• Infinispan is also a distributed elastic data grid
• Accessible in embedded and client/server mode
• Build your own Data-as-a-Service with Infinispan
Thursday, November 3, 11
Questions?
• infinispan.org
• blog.infinispan.org
• @infinispan on twitter
• #infinispan for comments
• IRC: #infinispan on FreeNode
• speakerrate.com/galder
Thursday, November 3, 11