18. Where we’re at:
• Optimisation alone won’t solve this
problem.
• Neither will larger servers.
• Scaling the application server and
databases doesn’t work.
20. A solution that works!
Cache
Cache
Cache
Application
Server
Cache
Cache
Cache
Cache
Cache
Application
Server
21. Infinispan
• Based in part on code from JBoss Cache
• Licensed under the LGPL
• Is a distributed in-memory data grid
• Has competition
• As of May 2011 Infinispan is officially
supported by Red Hat.
25. We aim to help developers:
Work with Grails and Groovy naturally.
26. We aim to help developers:
Work with Grails and Groovy naturally.
Avoid and diagnose problems quickly.
27. We aim to help developers:
Work with Grails and Groovy naturally.
Avoid and diagnose problems quickly.
Save time.
28. Configuring Infinispan in Grails
development {
infinispan = {
register {
cacheManager {
named "matrixCacheManager"
configured {
externally {
using "grails-app/conf/infinispan/infinispan-config.xml"
}
}
caches "agentCache", “citiesCache"
}
queryHelper {
named "agentQueryHelper"
referencing "agentCache"
properties queryHelperProperties
classes infinispantestapp.Agent, infinispantestapp.SuperHero
}
}
}
}
}
29. Configuring Infinispan in Grails
production {
infinispan = {
register {
cacheManager {
named "matrixCacheManager"
configured {
declaratively {
using globalConfiguration
using configuration
}
}
caches "agentCache", "illinoisCitiesCache"
}
queryHelper {
named "agentQueryHelper"
referencing "agentCache"
properties queryHelperProperties
classes infinispantestapp.Agent, infinispantestapp.SuperHero
}
}
}
}
}
30. Use the cache
LoadAgentCacheController {
def agentCache
def index = {
for (int ctr in 1..1000) {
agentCache.put (
"person id $ctr",
new Agent (name:"Agent Smith",
weapon:"gun")
)
}
}
}
32. Query and iterate over the results
def term = new Term (WEAPON, GUN)
def termQuery = new TermQuery (term)
def results = agentCache.query (queryHelper,
Agent, termQuery)
results.each {
log.info ("it: $it")
}
34. Food for Thought
• Infinispan 5.0 is currently under
development and will deliver fork/join and
map/reduce implementations.
• Infinispan can help reduce costs for any
data source.
• Infinispan can be very useful in the cloud
and service-oriented architectures (SOA).
35. A p p lic a tio n A p p lic a tio n
S e rv e r S e rv e r
C u s to m e r
I n fo r m a t io n
O rd e r
h is t o r y O rd e r
h is t o r y
A p p lic a tio n
A p p lic a tio n A p p lic a tio n Paym ent
S e rv e r O rd e r
S e rv e r S e rv e r p r o c e s s in g ,
p r o c e s s in g
S h ip p in g
A p p lic a tio n
S e rv e r
P ro d u ct
in fo r m a t io n P a rtn e r & p ro d u ct
A n a ly t ic s in fo r m a t io n
P a rtn e r
r e g is t r a t io n
A p p lic a tio n A p p lic a tio n A p p lic a tio n A p p lic a tio n
S e rv e r S e rv e r S e rv e r S e rv e r
36. Conclusion
• Three attempts that failed to deliver a
solution that could cope with the load.
• Design principles behind the Grails
Infinispan Plugin.
• Example code.
• Further documentation is available at
http://www.grails.org/plugin/infinispan
37. Any questions?
Contact me
Email:
thomas.fuller@coherentlogic.com