SlideShare a Scribd company logo
1 of 36
Download to read offline
©2013 Software AG Government Solutions. All rights reserved.1 |
Scale	
  Coldfusion with	
  Terracotta	
  
Distributed	
  Caching	
  for	
  Ehcache
Fabien	
  Sanglier,	
  	
  Terracotta	
  Architect,	
  
a.k.a The	
  Cache	
  Guy
+
2015 Adobe Coldfusion Summit
November 9, 2015
Why	
  are	
  you	
  (and	
  I)	
  here?
•
•
•
•
+
Happy marriage since CF9 (2009)
= Open-Source, De-Facto Java Caching API
+ +
Seamless, Powerful Distributed In-Memory Caching
with Free Open-Source Software
=
= Open-Source, Distributed In-Memory Store
In-Memory Caching = Not new, but still making the difference every day!
+ Seamless Integration!
Simple Config Change
Why re-inventing the wheel?
Terracotta	
  (Inc.	
  and	
  products)	
  at	
  a	
  Glance
• Founded	
  in	
  2003
• Lead	
  open-­‐source	
  maintainer	
  for:
• Terracotta	
  Commercial	
  	
  Offerings:	
  BigMemory Go/Max,	
  Universal	
  Messaging
• Deployed	
  by	
  80%	
  of	
  the	
  Global	
  1000
• Over	
  2.5	
  million	
  enterprise	
  deployments	
  in	
  over	
  190	
  countries
• Used	
  by	
  2.1	
  million	
  developers
• Acquired	
  by	
  Software	
  AG	
  in	
  2011
• Software	
  AG	
  Government	
  Solutions	
  serves	
  U.S.	
  Federal	
  Government
4 | ©2013 Software AG. All rights reserved. For internal use only
Some	
  (simple)	
  background	
  to	
  slowly	
  warm	
  up…
-­‐ Caching
-­‐ Ehcache
-­‐ Coldfusion’s use	
  of	
  Ehcache
I	
  built	
  a	
  great	
  CF	
  site	
  /	
  APIs	
  etc…
Web
services
Common	
  Scalability	
  challenges
Web
services
1
2
2
2
1
1
3
4
4
+
Since Coldfusion 9
The	
  De-­‐Facto	
  Java	
  “Caching”	
  API
• Open-source (more at www.ehcache.org)
• Current in 2.x: Ehcache 2.10.1
• Ehcache 3.x (complete overall with lots of improvements !)
• Full JSR 107 compliant (Java Caching specification)
• Seamless integration with many popular frameworks/applications:
Tomcat WebSphere
weblogic
©2013 Software AG Government Solutions. All rights reserved.10 |
Tiered Storage
JVM Managed
Memory
Ehcache Tiered	
  Storage	
  Approach
Local Disk Store
(Re-startable)
Heap
Store
Direct Access
RAM Store
a.k.a Offheap
2,000,000+
1,000,000
100,000
2
1,000
10,000+
Speed (TPS)
1,000s
Size (GB)
External Data Source
(e.g., Database)
Local Disk
Ehcache 2.x Example Configuration
Ehcache Simple	
  and	
  Flexible	
  Configuration (ehcache.xml)
<ehcache >
<cache name=”UserPreferencesCache”
maxBytesLocalHeap=”200M”
maxBytesLocalOffHeap=”2000M”
timeToIdleSeconds="300”
timeToLiveSeconds=“600”
memoryStoreEvictionPolicy="LRU” />
<cache name=”ShoppingCartCache”
maxEntriesLocalHeap=”10000”
timeToLiveSeconds=”6000”
overflowToDisk="true”
maxElementsOnDisk="400"
diskExpiryThreadIntervalSeconds="120”
memoryStoreEvictionPolicy=”LFU” />
</ehcache>
Ehcache goodness	
  all	
  available	
  (user	
  guides,	
  tutorials,	
  APIs,	
  
downloads,	
  etc…)	
  at	
  http://www.ehcache.org
http://www.ehcache.org
Coldfusion’s current	
  use	
  of	
  Ehcache
• CF	
  Authentication:
• auth-­‐ehcache.xml:	
  authcache,	
  authtokenmappingcache
• Internal	
  Caching	
  (CF	
  templates,	
  component	
  paths)	
  
• <cfcache> -­‐ Cache	
  fragments	
  of	
  html
• <cfquery>	
  -­‐ Cache	
  DB	
  calls
• <cfquery name="myPortfolio"	
  cachedwithin=#createTimeSpan(	
  0,	
  1,	
  0,	
  0	
  )#>
• ORM	
  with	
  Ehcache 2nd level	
  caching:	
  Caching Hibernate	
  queries
• Entityload('BlogPost',{},{cacheable=true})
• CF	
  Cache	
  functions:	
  Direct	
  Ehcache calls
• CacheGet /	
  CachePut /	
  CacheRemove /	
  CacheGetAllIds
• CacheGetMetadata
• CacheGetProperties /	
  CacheSetProperties
• Custom	
  CF	
  JAVA	
  components	
  using	
  Ehcache library	
  directly
All this can be “easily” Distributed with Terracotta
+
Coldfusion’s Ehcache resources
1. CF11	
  – Ehcache 2.6.6	
  (Latest	
  ehcache in	
  2.x	
  line:	
  2.10.1)
2. CF11	
  Ehcache libs:
1. <CF_HOME>/cfusion/lib/ehcache-­‐core-­‐2.6.6.jar	
  (core	
  library)
2. <CF_HOME>/cfusion/lib/ehcache-­‐web-­‐2.0.4.jar	
  (web	
  content	
  caching)
3. CF	
  ehcache configs:
1. <CF_HOME>/cfusion/lib/ehcache.xml
2. <CF_HOME>/cfusion/lib/auth-­‐ehcache.xml
For Terracotta, those will need to be updated
+
15 | ©2013 Software AG. All rights reserved. For internal use only
Ehcache standalone
…	
  …	
  vs.	
  Ehcache Replications
…	
  …	
  …	
  vs.	
  Ehcache Distributed	
  with	
  Terracotta
Types of Ehcache Topologies
Not all Ehcache topologies created equal…
Ehcache Standalone:	
  Simple	
  and	
  quick	
  fix
Web
services
EhcacheEhcacheEhcache
Limitations:
§ Limited Memory Storage (JVM Heap only)
§ Larger Heap = Unpredictable Latencies (GC pauses)
§ Standalone = Duplicate cache data = more DB / disks
calls
Advantages:
§ Easy to implement
§ Highly concurrent
§ Linear performance gains
§ Extend storage to disk
Ehcache Replication:	
  Improved	
  caching	
  but	
  some	
  caveats
Web
services
EhcacheEhcacheEhcache
Ehcache
replication
Ehcache
replication
Advantages:
§ Replications on ALL
inserts/updates/deletes
§ Add once, request many
§ More efficient
Same ehcache limitations +
§ Complex (Jgroup, RMI, MultiCasting)
§ Possible Cache Discrepencies
§ Bootstrapping issues
Terracotta	
  Distributed	
  Ehcache:	
  High	
  Scalability	
  Caching
Web
services
EhcacheEhcacheEhcache
Advantages:
§ Simple to setup (1 config change in ehcache)
§ Unlimited in-memory storage capacity
(offheap)
§ Completely open-source (4.3 and up)
TerracottaOpen-Source(4.3)
Advantages (cont’d):
§ Flexible consistencies
§ High Availability
§ Monitoring options
19 | ©2013 Software AG. All rights reserved. For internal use only
Terracotta	
  distributed	
  in-­‐memory	
  caching	
  specifics
http://www.terracotta.org/downloads/open-source/catalog
Terracotta	
  4.x	
  Open	
  Source	
  Offering	
  /	
  Architecture
Active
Server
SCALE OUT
1 JVM – X gb Heap
CF App Server
1 JVM – X gb Heap 1 JVM – X gb Heap
Ehcache 2.x
CF App Server CF App Server
Unlimited
In-Memory
Storage
(Offheap)
Passive
Server
CF internals
Active
replication
Unlimited
In-Memory
Storage
(Offheap)
Ehcache 2.x
CF internals
Ehcache 2.x
CF internals
Heap
TC internals
2 GB
e.g.
100 GB
2 GB
e.g.
100 GB
tcp sockets / nio / unicast
Heap
TC internals
SCALEUP
2
1
3
Easy	
  scalability:	
  New	
  clients	
  can	
  access	
  all	
  cached	
  data
Active
Server
Unlimited
In-Memory
Storage
(Offheap)
Passive
Server
Active
replication
Unlimited
In-Memory
Storage
(Offheap)
Heap
TC internals
2 GB
e.g.
100 GB
2 GB
e.g.
100 GB
tcp sockets / nio / unicast
Heap
TC internals
SCALEUP
1 JVM – X gb Heap
CF App Server
1 JVM – X gb Heap 1 JVM – X gb Heap
Ehcache
CF App Server CF App Server
CF internals
Ehcache
CF internals
Ehcache
CF internals
1 JVM – X gb Heap
CF App Server
Ehcache
CF internals
1 JVM – X gb Heap
CF App Server
Ehcache
CF internals
Powerful	
  H/A	
  =	
  Automatic	
  failover	
  /	
  no	
  cache	
  data	
  loss
Active
Server
Unlimited
In-Memory
Storage
(Offheap)
New Active
Server
Active
replication
Unlimited
In-Memory
Storage
(Offheap)
Heap
TC internals
2 GB
e.g.
100 GB
2 GB
e.g.
100 GB
tcp sockets / nio / unicast
Heap
TC internals
SCALEUP
1 JVM – X gb Heap
CF App Server
1 JVM – X gb Heap 1 JVM – X gb Heap
Ehcache
CF App Server CF App Server
CF internals
Ehcache
CF internals
Ehcache
CF internals
1 JVM – X gb Heap
CF App Server
Ehcache
CF internals
1 JVM – X gb Heap
CF App Server
Ehcache
CF internals
Tiered Storage
JVM Managed
Memory
New	
  Tiered	
  Storage	
  Approach	
  with	
  Unlimited	
  Storage	
  into	
  
Terracotta	
  (up	
  to	
  RAM	
  available	
  of	
  course!)
Local Disk Store
(Re-startable)
Heap
Store
Direct Access
RAM Store
a.k.a Offheap
2,000,000+
1,000,000
100,000
2
1,000
10,000+
Speed (TPS)
1,000s
Size (GB)
External Data Source
(e.g., Database)
Offheap with	
  JAVA	
  =	
  Unrestricted	
  In-­‐Memory	
  Storage
• Standard	
  Java
• Proven	
  TBs	
  scale	
  capacity	
  
• Not	
  managed	
  by	
  the	
  JVM	
  
=	
  No	
  Garbage	
  Collections
=	
  Predictable	
  latencies
• No	
  specialized	
  appliance	
  
needed
Seamless	
  configuration	
  on	
  same	
  ehcache.xml
<ehcache>
<terracottaConfigurl=“server1:9510,server2:9510"/>
<cache name=“UserPreferencesCache”
timeToIdleSeconds=”300”
maxEntriesLocalHeap=“1000” />
<cache name=”ShoppingCartCache”
timeToLiveSeconds=”6000”
maxEntriesLocalHeap=“1000”>
maxEntriesInCache=“10000000”>
<terracotta />
</cache>
</ehcache>
25
Ehcache 2.x Example Configuration
Amount  of  objects  
allowed  in  
Terracotta  for  that  
Cache  region
Terracotta  url
Enable  
Terracotta  for  
that  cache
Example Configuration
Flexible	
  data	
  access	
  consistency
Strongly
Consistent  
Fully
Transactional
Eventually
Consistent
More  Consistency More  Performance
<cache  name=”UserPreferencesCache"
maxElementsInMemory="10000"
timeToLiveSeconds="300”>
<terracotta consistency=”eventual"/>
</cache>
<cache  name=”ShoppingCartCache"
maxElementsInMemory=”5000"
timeToIdleSeconds=”6000”>
<terracotta consistency=”strong"/>
</cache>
Example Configuration
Some	
  extra	
  “Terracotta”	
  pointers...
1. No	
  limitations	
  on	
  what	
  you	
  can	
  store	
  in	
  cache,	
  BUT	
  Cached	
  Keys	
  /	
  Values	
  MUST	
  be	
  “Serializable”	
  (implement	
  
java.io.Serializable)
2. New	
  Terracotta	
  jar	
  needed	
  +	
  Ehcache JAR	
  must	
  match	
  Terracotta	
  version.	
  So	
  new	
  Jars	
  needed	
  in	
  CF:
1. ehcache-­‐2.10.1.jar
2. terracotta-­‐toolkit-­‐runtime-­‐4.3.1.jar
3. Cache	
  by	
  reference	
  (standalone	
  Ehcache)	
  /	
  Cache	
  by	
  serialization	
  (Terracotta)
4. For	
  resiliency	
  to	
  clients-­‐terracotta	
  disconnections,	
   there’s	
  nonstop	
  mode.	
  But	
  Ehcache client	
  must	
  specify	
  
appropriate	
  “behavior”	
  (noop,	
  exception,	
  localReads)
5. Explicit	
  locks	
  apply	
  to	
  the	
  full	
  “Terracotta	
  cache	
  cluster”	
  (Read	
  /	
  Write	
  Locks)	
  
1. Useful	
  for	
  special	
  data	
  consistency	
  needs
6. Ehcache +	
  Terracotta	
  =	
  Full	
  compliant	
  XA	
  resource	
  (XA	
  transactions)
7. CAS	
  operations	
  apply	
  to	
  the	
  full	
  “Terracotta	
  cache	
  cluster”	
  
1. Cache.putIfAbsent(Element	
  element),	
  Cache.replace(Element	
  oldOne,	
  Element	
  newOne)
Key (Serializable) Value Serializable (byte[])
Monitoring	
  and	
  Management:	
  Simple	
  REST	
  API
Terracotta Server Array
App Server
Heap
Ehcache
/BigMemory
Cache Runtime
Endpoint
JMX bridge TSA Rest Agent
App Server
Heap
Ehcache
/BigMemory
CF App Server
Heap
Ehcache
Tcp
9510
Tcp
JMX
9520
Http/REST
9540
CURL
Monitoring
App
http/rest
http://www.terracotta.org/documentation/4.1/tms/tms-rest-api
A	
  monitoring	
  example:	
  Terracotta	
  NewRelic Plugin
Terracotta Server Array
App Server
Heap
Ehcache
/BigMemory
Cache Runtime
Endpoint
JMX bridge TSA Rest Agent
App Server
Heap
Ehcache
/BigMemory
CF App Server
Heap
Ehcache
Tcp
9510
Tcp
JMX
9520
Http/REST
9540
CURL
NewRelic
Plugin
http/rest
NewRelic Cloud
Rest HTML
Https
REST
Http
HTML
Proxy
https://github.com/Terracotta-OSS/terracotta-newrelic-plugin
30 | ©2013 Software AG. All rights reserved. For internal use only
Setting	
  it	
  all	
  up	
  with	
  CF	
  11
Terracotta	
  Initial	
  Setup	
  in	
  just	
  a	
  few	
  steps…
1. Download	
  Terracotta	
  OSS	
  (latest	
  4.3.1	
  -­‐-­‐ terracotta-­‐4.3.1.tar.gz)
1. http://www.terracotta.org/downloads/open-­‐source/catalog
2. Extract	
  to	
  location	
  of	
  choice
3. Ensure	
  JAVA_HOME	
  is	
  set
4. Navigate	
  to	
  <TERRACOTTA_INSTALL>/server/bin
5. Start	
  with	
  default	
  single	
  node	
  config by	
  executing:	
  
1. start-­‐tc-­‐server.sh (or	
  .bat)
6. Terracotta	
  process	
  is	
  now	
  accessible	
  at	
  IP:9510
Note:	
  if	
  setting	
  up	
  Terracotta	
  in	
  active/mirror	
  setup,	
  tc-­‐config.xml must	
  be	
  created	
  and	
  
referenced	
  at	
  startup:
• start-­‐tc-­‐server.sh (or	
  .bat)	
  -­‐f	
  <path-­‐to-­‐config>/tc-­‐config.xml –n	
  <server-­‐name-­‐to-­‐start>	
  
Connecting	
  CF	
  11	
  to	
  Terracotta	
  in	
  just	
  a	
  few	
  steps
1. Copy	
  Ehcache +	
  Terracotta	
  libs	
  to	
  <CF_HOME>/cfusion/lib
1. <TERRACOTTA_INSTALL>/apis/ehcache/lib/ehcache-­‐2.10.1.jar
2. <TERRACOTTA_INSTALL>/apis/toolkit/lib/terracotta-­‐toolkit-­‐runtime-­‐4.3.1.jar
2. Add	
  terracotta-­‐specifics	
  configurations	
  in	
  CF	
  ehcache configs:
1. <CF_HOME>/cfusion/lib/ehcache.xml
2. <CF_HOME>/cfusion/lib/auth-­‐ehcache.xml
3. Restart	
  CF
4. Notice	
  Terracotta	
  connection	
  in	
  CF	
  logs
All	
  these	
  features	
  are	
  now	
  cached	
  on	
  Terracotta!
• CF	
  Authentication:
• auth-­‐ehcache.xml:	
  authcache,	
  authtokenmappingcache
• Internal	
  Caching	
  (CF	
  templates,	
  component	
  paths)	
  
• <cfcache> -­‐ Cache	
  fragments	
  of	
  html
• <cfquery>	
  -­‐ Cache	
  DB	
  calls
• <cfquery name="myPortfolio"	
  cachedwithin=#createTimeSpan(	
  0,	
  1,	
  0,	
  0	
  )#>
• ORM	
  with	
  Ehcache 2nd level	
  caching:	
  Caching Hibernate	
  queries
• Entityload('BlogPost',{},{cacheable=true})
• CF	
  Cache	
  functions:	
  Direct	
  Ehcache calls
• CacheGet /	
  CachePut /	
  CacheRemove /	
  CacheGetAllIds
• CacheGetMetadata
• CacheGetProperties /	
  CacheSetProperties
• Custom	
  CF	
  JAVA	
  components	
  using	
  Ehcache library	
  directly
+
+
And now just wait to see your CF website
absorb the next usage spikes!!
©2013 Software AG Government Solutions. All rights reserved.35 |
Questions?
Fabien Sanglier
Terracotta Architect
www.linkedin.com/in/fabiensanglier/
fabien.sanglier@softwareaggov.com
twitter.com/fabiensanglier
fsanglier.blogspot.com
github.com/lanimall
www.SoftwareAGgov.comSoftware AG :
Terracotta: www.terracotta.org
Ehcache: www.ehcache.org
www.SoftwareAGgov.comSoftware AG Government Solutions :
Scale ColdFusion with Terracotta Distributed Caching for Ehchache

More Related Content

What's hot

Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
WordCamp Cape Town
 
The app server, web server and everything in between
The app server, web server and everything in betweenThe app server, web server and everything in between
The app server, web server and everything in between
ColdFusionConference
 

What's hot (20)

Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 
Optimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp HoustonOptimizing WordPress for Performance - WordCamp Houston
Optimizing WordPress for Performance - WordCamp Houston
 
Adobe AEM Maintenance - Customer Care Office Hours
Adobe AEM Maintenance - Customer Care Office HoursAdobe AEM Maintenance - Customer Care Office Hours
Adobe AEM Maintenance - Customer Care Office Hours
 
Cfml features modern_coding
Cfml features modern_codingCfml features modern_coding
Cfml features modern_coding
 
Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...Developing High Performance and Scalable ColdFusion Application Using Terraco...
Developing High Performance and Scalable ColdFusion Application Using Terraco...
 
S903 palla
S903 pallaS903 palla
S903 palla
 
Locking Down CF Servers
Locking Down CF ServersLocking Down CF Servers
Locking Down CF Servers
 
The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)The secret life of a dispatcher (Adobe CQ AEM)
The secret life of a dispatcher (Adobe CQ AEM)
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
Handling 10k requests per second with Symfony and Varnish - SymfonyCon Berlin...
 
CIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEMCIRCUIT 2015 - Monitoring AEM
CIRCUIT 2015 - Monitoring AEM
 
Scaling AEM (CQ5) Gem Session
Scaling AEM (CQ5) Gem SessionScaling AEM (CQ5) Gem Session
Scaling AEM (CQ5) Gem Session
 
CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013CQ5.x Maintenance Webinar 2013
CQ5.x Maintenance Webinar 2013
 
Tomcatx performance-tuning
Tomcatx performance-tuningTomcatx performance-tuning
Tomcatx performance-tuning
 
Modern PHP Ch7 Provisioning Guide 導讀
Modern PHP Ch7 Provisioning Guide 導讀Modern PHP Ch7 Provisioning Guide 導讀
Modern PHP Ch7 Provisioning Guide 導讀
 
Aem offline content
Aem offline contentAem offline content
Aem offline content
 
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
 
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
Improve ColdFusion Performance by tuning the Connector and using ColdFusion-T...
 
The app server, web server and everything in between
The app server, web server and everything in betweenThe app server, web server and everything in between
The app server, web server and everything in between
 

Viewers also liked

Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
ColdFusionConference
 

Viewers also liked (15)

Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusionAdvanced caching techniques with ehcache, big memory, terracotta, and coldfusion
Advanced caching techniques with ehcache, big memory, terracotta, and coldfusion
 
Aop clustering
Aop clusteringAop clustering
Aop clustering
 
Exploring Terracotta
Exploring TerracottaExploring Terracotta
Exploring Terracotta
 
Terracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful AppsTerracotta Java Scalability - Stateless Versus Stateful Apps
Terracotta Java Scalability - Stateless Versus Stateful Apps
 
5 Reasons to Upgrade Ehcache to BigMemory Go
5 Reasons to Upgrade Ehcache to BigMemory Go5 Reasons to Upgrade Ehcache to BigMemory Go
5 Reasons to Upgrade Ehcache to BigMemory Go
 
Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3Caching reboot: javax.cache & Ehcache 3
Caching reboot: javax.cache & Ehcache 3
 
Building High Scalability Apps With Terracotta
Building High Scalability Apps With TerracottaBuilding High Scalability Apps With Terracotta
Building High Scalability Apps With Terracotta
 
Terracotta Hadoop & In-Memory Webcast
Terracotta Hadoop & In-Memory WebcastTerracotta Hadoop & In-Memory Webcast
Terracotta Hadoop & In-Memory Webcast
 
Introduction to Terracotta
Introduction to TerracottaIntroduction to Terracotta
Introduction to Terracotta
 
Clustering Java applications with Terracotta and Hazelcast
Clustering Java applications with Terracotta and HazelcastClustering Java applications with Terracotta and Hazelcast
Clustering Java applications with Terracotta and Hazelcast
 
Scaling Hibernate with Terracotta
Scaling Hibernate with TerracottaScaling Hibernate with Terracotta
Scaling Hibernate with Terracotta
 
Architectural Terracotta History, Composition, Failure, Anchoring, Repair and...
Architectural Terracotta History, Composition, Failure, Anchoring, Repair and...Architectural Terracotta History, Composition, Failure, Anchoring, Repair and...
Architectural Terracotta History, Composition, Failure, Anchoring, Repair and...
 
Apama, Terracotta, webMethods Upgrade: Avoiding Common Pitfalls
Apama, Terracotta, webMethods Upgrade: Avoiding Common Pitfalls Apama, Terracotta, webMethods Upgrade: Avoiding Common Pitfalls
Apama, Terracotta, webMethods Upgrade: Avoiding Common Pitfalls
 
Terracotta And Hibernate
Terracotta And  HibernateTerracotta And  Hibernate
Terracotta And Hibernate
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 

Similar to Scale ColdFusion with Terracotta Distributed Caching for Ehchache

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
Davide Carnevali
 
Globo.com & Varnish
Globo.com & VarnishGlobo.com & Varnish
Globo.com & Varnish
lokama
 
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
elliando dias
 

Similar to Scale ColdFusion with Terracotta Distributed Caching for Ehchache (20)

Heapoff memory wtf
Heapoff memory wtfHeapoff memory wtf
Heapoff memory wtf
 
Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...Developing High Performance and Scalable ColdFusion Applications Using Terrac...
Developing High Performance and Scalable ColdFusion Applications Using Terrac...
 
Caching in applications still matters
Caching in applications still mattersCaching in applications still matters
Caching in applications still matters
 
Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
 
Using JCache to speed up your apps
Using JCache to speed up your appsUsing JCache to speed up your apps
Using JCache to speed up your apps
 
Building low latency java applications with ehcache
Building low latency java applications with ehcacheBuilding low latency java applications with ehcache
Building low latency java applications with ehcache
 
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
IMC Summit 2016 Breakout - Greg Luck - How to Speed Up Your Application Using...
 
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
 
Globo.com & Varnish
Globo.com & VarnishGlobo.com & Varnish
Globo.com & Varnish
 
Distributed caching-computing v3.8
Distributed caching-computing v3.8Distributed caching-computing v3.8
Distributed caching-computing v3.8
 
Scaling Your Cache
Scaling Your CacheScaling Your Cache
Scaling Your Cache
 
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
Distributed Caching Using the JCACHE API and ehcache, Including a Case Study ...
 
Primary Storage in CloudStack by Mike Tutkowski
Primary Storage in CloudStack by Mike TutkowskiPrimary Storage in CloudStack by Mike Tutkowski
Primary Storage in CloudStack by Mike Tutkowski
 
Caching and JCache with Greg Luck 18.02.16
Caching and JCache with Greg Luck 18.02.16Caching and JCache with Greg Luck 18.02.16
Caching and JCache with Greg Luck 18.02.16
 
Deep dive into AWS fargate
Deep dive into AWS fargateDeep dive into AWS fargate
Deep dive into AWS fargate
 
Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
All Oracle DBAs have to know about Unix Memory Monitoring
All Oracle DBAs have to know about Unix Memory MonitoringAll Oracle DBAs have to know about Unix Memory Monitoring
All Oracle DBAs have to know about Unix Memory Monitoring
 
VMworld 2013: Extreme Performance Series: Storage in a Flash
VMworld 2013: Extreme Performance Series: Storage in a Flash VMworld 2013: Extreme Performance Series: Storage in a Flash
VMworld 2013: Extreme Performance Series: Storage in a Flash
 
AltaVault
AltaVaultAltaVault
AltaVault
 
Guaranteeing CloudStack Storage Performance
Guaranteeing CloudStack Storage Performance Guaranteeing CloudStack Storage Performance
Guaranteeing CloudStack Storage Performance
 

More from ColdFusionConference

More from ColdFusionConference (20)

Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
Cf ppt vsr
Cf ppt vsrCf ppt vsr
Cf ppt vsr
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server Databases
 
API Economy, Realizing the Business Value of APIs
API Economy, Realizing the Business Value of APIsAPI Economy, Realizing the Business Value of APIs
API Economy, Realizing the Business Value of APIs
 
Don't just pdf, Smart PDF
Don't just pdf, Smart PDFDon't just pdf, Smart PDF
Don't just pdf, Smart PDF
 
Crafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an ArchitectCrafting ColdFusion Applications like an Architect
Crafting ColdFusion Applications like an Architect
 
Security And Access Control For APIS using CF API Manager
Security And Access Control For APIS using CF API ManagerSecurity And Access Control For APIS using CF API Manager
Security And Access Control For APIS using CF API Manager
 
Monetizing Business Models: ColdFusion and APIS
Monetizing Business Models: ColdFusion and APISMonetizing Business Models: ColdFusion and APIS
Monetizing Business Models: ColdFusion and APIS
 
Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016Become a Security Rockstar with ColdFusion 2016
Become a Security Rockstar with ColdFusion 2016
 
ColdFusion in Transit action
ColdFusion in Transit actionColdFusion in Transit action
ColdFusion in Transit action
 
Developer Insights for Application Upgrade to ColdFusion 2016
Developer Insights for Application Upgrade to ColdFusion 2016Developer Insights for Application Upgrade to ColdFusion 2016
Developer Insights for Application Upgrade to ColdFusion 2016
 
Where is cold fusion headed
Where is cold fusion headedWhere is cold fusion headed
Where is cold fusion headed
 
ColdFusion Keynote: Building the Agile Web Since 1995
ColdFusion Keynote: Building the Agile Web Since 1995ColdFusion Keynote: Building the Agile Web Since 1995
ColdFusion Keynote: Building the Agile Web Since 1995
 
Restful services with ColdFusion
Restful services with ColdFusionRestful services with ColdFusion
Restful services with ColdFusion
 
Super Fast Application development with Mura CMS
Super Fast Application development with Mura CMSSuper Fast Application development with Mura CMS
Super Fast Application development with Mura CMS
 
Build your own secure and real-time dashboard for mobile and web
Build your own secure and real-time dashboard for mobile and webBuild your own secure and real-time dashboard for mobile and web
Build your own secure and real-time dashboard for mobile and web
 
Why Everyone else writes bad code
Why Everyone else writes bad codeWhy Everyone else writes bad code
Why Everyone else writes bad code
 
Securing applications
Securing applicationsSecuring applications
Securing applications
 
Testing automaton
Testing automatonTesting automaton
Testing automaton
 
Rest ful tools for lazy experts
Rest ful tools for lazy expertsRest ful tools for lazy experts
Rest ful tools for lazy experts
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Scale ColdFusion with Terracotta Distributed Caching for Ehchache

  • 1. ©2013 Software AG Government Solutions. All rights reserved.1 | Scale  Coldfusion with  Terracotta   Distributed  Caching  for  Ehcache Fabien  Sanglier,    Terracotta  Architect,   a.k.a The  Cache  Guy + 2015 Adobe Coldfusion Summit November 9, 2015
  • 2. Why  are  you  (and  I)  here? • • • • + Happy marriage since CF9 (2009) = Open-Source, De-Facto Java Caching API + + Seamless, Powerful Distributed In-Memory Caching with Free Open-Source Software = = Open-Source, Distributed In-Memory Store In-Memory Caching = Not new, but still making the difference every day! + Seamless Integration! Simple Config Change Why re-inventing the wheel?
  • 3. Terracotta  (Inc.  and  products)  at  a  Glance • Founded  in  2003 • Lead  open-­‐source  maintainer  for: • Terracotta  Commercial    Offerings:  BigMemory Go/Max,  Universal  Messaging • Deployed  by  80%  of  the  Global  1000 • Over  2.5  million  enterprise  deployments  in  over  190  countries • Used  by  2.1  million  developers • Acquired  by  Software  AG  in  2011 • Software  AG  Government  Solutions  serves  U.S.  Federal  Government
  • 4. 4 | ©2013 Software AG. All rights reserved. For internal use only Some  (simple)  background  to  slowly  warm  up… -­‐ Caching -­‐ Ehcache -­‐ Coldfusion’s use  of  Ehcache
  • 5. I  built  a  great  CF  site  /  APIs  etc… Web services
  • 7.
  • 9. The  De-­‐Facto  Java  “Caching”  API • Open-source (more at www.ehcache.org) • Current in 2.x: Ehcache 2.10.1 • Ehcache 3.x (complete overall with lots of improvements !) • Full JSR 107 compliant (Java Caching specification) • Seamless integration with many popular frameworks/applications: Tomcat WebSphere weblogic
  • 10. ©2013 Software AG Government Solutions. All rights reserved.10 | Tiered Storage JVM Managed Memory Ehcache Tiered  Storage  Approach Local Disk Store (Re-startable) Heap Store Direct Access RAM Store a.k.a Offheap 2,000,000+ 1,000,000 100,000 2 1,000 10,000+ Speed (TPS) 1,000s Size (GB) External Data Source (e.g., Database) Local Disk
  • 11. Ehcache 2.x Example Configuration Ehcache Simple  and  Flexible  Configuration (ehcache.xml) <ehcache > <cache name=”UserPreferencesCache” maxBytesLocalHeap=”200M” maxBytesLocalOffHeap=”2000M” timeToIdleSeconds="300” timeToLiveSeconds=“600” memoryStoreEvictionPolicy="LRU” /> <cache name=”ShoppingCartCache” maxEntriesLocalHeap=”10000” timeToLiveSeconds=”6000” overflowToDisk="true” maxElementsOnDisk="400" diskExpiryThreadIntervalSeconds="120” memoryStoreEvictionPolicy=”LFU” /> </ehcache>
  • 12. Ehcache goodness  all  available  (user  guides,  tutorials,  APIs,   downloads,  etc…)  at  http://www.ehcache.org http://www.ehcache.org
  • 13. Coldfusion’s current  use  of  Ehcache • CF  Authentication: • auth-­‐ehcache.xml:  authcache,  authtokenmappingcache • Internal  Caching  (CF  templates,  component  paths)   • <cfcache> -­‐ Cache  fragments  of  html • <cfquery>  -­‐ Cache  DB  calls • <cfquery name="myPortfolio"  cachedwithin=#createTimeSpan(  0,  1,  0,  0  )#> • ORM  with  Ehcache 2nd level  caching:  Caching Hibernate  queries • Entityload('BlogPost',{},{cacheable=true}) • CF  Cache  functions:  Direct  Ehcache calls • CacheGet /  CachePut /  CacheRemove /  CacheGetAllIds • CacheGetMetadata • CacheGetProperties /  CacheSetProperties • Custom  CF  JAVA  components  using  Ehcache library  directly All this can be “easily” Distributed with Terracotta +
  • 14. Coldfusion’s Ehcache resources 1. CF11  – Ehcache 2.6.6  (Latest  ehcache in  2.x  line:  2.10.1) 2. CF11  Ehcache libs: 1. <CF_HOME>/cfusion/lib/ehcache-­‐core-­‐2.6.6.jar  (core  library) 2. <CF_HOME>/cfusion/lib/ehcache-­‐web-­‐2.0.4.jar  (web  content  caching) 3. CF  ehcache configs: 1. <CF_HOME>/cfusion/lib/ehcache.xml 2. <CF_HOME>/cfusion/lib/auth-­‐ehcache.xml For Terracotta, those will need to be updated +
  • 15. 15 | ©2013 Software AG. All rights reserved. For internal use only Ehcache standalone …  …  vs.  Ehcache Replications …  …  …  vs.  Ehcache Distributed  with  Terracotta Types of Ehcache Topologies Not all Ehcache topologies created equal…
  • 16. Ehcache Standalone:  Simple  and  quick  fix Web services EhcacheEhcacheEhcache Limitations: § Limited Memory Storage (JVM Heap only) § Larger Heap = Unpredictable Latencies (GC pauses) § Standalone = Duplicate cache data = more DB / disks calls Advantages: § Easy to implement § Highly concurrent § Linear performance gains § Extend storage to disk
  • 17. Ehcache Replication:  Improved  caching  but  some  caveats Web services EhcacheEhcacheEhcache Ehcache replication Ehcache replication Advantages: § Replications on ALL inserts/updates/deletes § Add once, request many § More efficient Same ehcache limitations + § Complex (Jgroup, RMI, MultiCasting) § Possible Cache Discrepencies § Bootstrapping issues
  • 18. Terracotta  Distributed  Ehcache:  High  Scalability  Caching Web services EhcacheEhcacheEhcache Advantages: § Simple to setup (1 config change in ehcache) § Unlimited in-memory storage capacity (offheap) § Completely open-source (4.3 and up) TerracottaOpen-Source(4.3) Advantages (cont’d): § Flexible consistencies § High Availability § Monitoring options
  • 19. 19 | ©2013 Software AG. All rights reserved. For internal use only Terracotta  distributed  in-­‐memory  caching  specifics http://www.terracotta.org/downloads/open-source/catalog
  • 20. Terracotta  4.x  Open  Source  Offering  /  Architecture Active Server SCALE OUT 1 JVM – X gb Heap CF App Server 1 JVM – X gb Heap 1 JVM – X gb Heap Ehcache 2.x CF App Server CF App Server Unlimited In-Memory Storage (Offheap) Passive Server CF internals Active replication Unlimited In-Memory Storage (Offheap) Ehcache 2.x CF internals Ehcache 2.x CF internals Heap TC internals 2 GB e.g. 100 GB 2 GB e.g. 100 GB tcp sockets / nio / unicast Heap TC internals SCALEUP 2 1 3
  • 21. Easy  scalability:  New  clients  can  access  all  cached  data Active Server Unlimited In-Memory Storage (Offheap) Passive Server Active replication Unlimited In-Memory Storage (Offheap) Heap TC internals 2 GB e.g. 100 GB 2 GB e.g. 100 GB tcp sockets / nio / unicast Heap TC internals SCALEUP 1 JVM – X gb Heap CF App Server 1 JVM – X gb Heap 1 JVM – X gb Heap Ehcache CF App Server CF App Server CF internals Ehcache CF internals Ehcache CF internals 1 JVM – X gb Heap CF App Server Ehcache CF internals 1 JVM – X gb Heap CF App Server Ehcache CF internals
  • 22. Powerful  H/A  =  Automatic  failover  /  no  cache  data  loss Active Server Unlimited In-Memory Storage (Offheap) New Active Server Active replication Unlimited In-Memory Storage (Offheap) Heap TC internals 2 GB e.g. 100 GB 2 GB e.g. 100 GB tcp sockets / nio / unicast Heap TC internals SCALEUP 1 JVM – X gb Heap CF App Server 1 JVM – X gb Heap 1 JVM – X gb Heap Ehcache CF App Server CF App Server CF internals Ehcache CF internals Ehcache CF internals 1 JVM – X gb Heap CF App Server Ehcache CF internals 1 JVM – X gb Heap CF App Server Ehcache CF internals
  • 23. Tiered Storage JVM Managed Memory New  Tiered  Storage  Approach  with  Unlimited  Storage  into   Terracotta  (up  to  RAM  available  of  course!) Local Disk Store (Re-startable) Heap Store Direct Access RAM Store a.k.a Offheap 2,000,000+ 1,000,000 100,000 2 1,000 10,000+ Speed (TPS) 1,000s Size (GB) External Data Source (e.g., Database)
  • 24. Offheap with  JAVA  =  Unrestricted  In-­‐Memory  Storage • Standard  Java • Proven  TBs  scale  capacity   • Not  managed  by  the  JVM   =  No  Garbage  Collections =  Predictable  latencies • No  specialized  appliance   needed
  • 25. Seamless  configuration  on  same  ehcache.xml <ehcache> <terracottaConfigurl=“server1:9510,server2:9510"/> <cache name=“UserPreferencesCache” timeToIdleSeconds=”300” maxEntriesLocalHeap=“1000” /> <cache name=”ShoppingCartCache” timeToLiveSeconds=”6000” maxEntriesLocalHeap=“1000”> maxEntriesInCache=“10000000”> <terracotta /> </cache> </ehcache> 25 Ehcache 2.x Example Configuration Amount  of  objects   allowed  in   Terracotta  for  that   Cache  region Terracotta  url Enable   Terracotta  for   that  cache
  • 26. Example Configuration Flexible  data  access  consistency Strongly Consistent   Fully Transactional Eventually Consistent More  Consistency More  Performance <cache  name=”UserPreferencesCache" maxElementsInMemory="10000" timeToLiveSeconds="300”> <terracotta consistency=”eventual"/> </cache> <cache  name=”ShoppingCartCache" maxElementsInMemory=”5000" timeToIdleSeconds=”6000”> <terracotta consistency=”strong"/> </cache> Example Configuration
  • 27. Some  extra  “Terracotta”  pointers... 1. No  limitations  on  what  you  can  store  in  cache,  BUT  Cached  Keys  /  Values  MUST  be  “Serializable”  (implement   java.io.Serializable) 2. New  Terracotta  jar  needed  +  Ehcache JAR  must  match  Terracotta  version.  So  new  Jars  needed  in  CF: 1. ehcache-­‐2.10.1.jar 2. terracotta-­‐toolkit-­‐runtime-­‐4.3.1.jar 3. Cache  by  reference  (standalone  Ehcache)  /  Cache  by  serialization  (Terracotta) 4. For  resiliency  to  clients-­‐terracotta  disconnections,   there’s  nonstop  mode.  But  Ehcache client  must  specify   appropriate  “behavior”  (noop,  exception,  localReads) 5. Explicit  locks  apply  to  the  full  “Terracotta  cache  cluster”  (Read  /  Write  Locks)   1. Useful  for  special  data  consistency  needs 6. Ehcache +  Terracotta  =  Full  compliant  XA  resource  (XA  transactions) 7. CAS  operations  apply  to  the  full  “Terracotta  cache  cluster”   1. Cache.putIfAbsent(Element  element),  Cache.replace(Element  oldOne,  Element  newOne) Key (Serializable) Value Serializable (byte[])
  • 28. Monitoring  and  Management:  Simple  REST  API Terracotta Server Array App Server Heap Ehcache /BigMemory Cache Runtime Endpoint JMX bridge TSA Rest Agent App Server Heap Ehcache /BigMemory CF App Server Heap Ehcache Tcp 9510 Tcp JMX 9520 Http/REST 9540 CURL Monitoring App http/rest http://www.terracotta.org/documentation/4.1/tms/tms-rest-api
  • 29. A  monitoring  example:  Terracotta  NewRelic Plugin Terracotta Server Array App Server Heap Ehcache /BigMemory Cache Runtime Endpoint JMX bridge TSA Rest Agent App Server Heap Ehcache /BigMemory CF App Server Heap Ehcache Tcp 9510 Tcp JMX 9520 Http/REST 9540 CURL NewRelic Plugin http/rest NewRelic Cloud Rest HTML Https REST Http HTML Proxy https://github.com/Terracotta-OSS/terracotta-newrelic-plugin
  • 30. 30 | ©2013 Software AG. All rights reserved. For internal use only Setting  it  all  up  with  CF  11
  • 31. Terracotta  Initial  Setup  in  just  a  few  steps… 1. Download  Terracotta  OSS  (latest  4.3.1  -­‐-­‐ terracotta-­‐4.3.1.tar.gz) 1. http://www.terracotta.org/downloads/open-­‐source/catalog 2. Extract  to  location  of  choice 3. Ensure  JAVA_HOME  is  set 4. Navigate  to  <TERRACOTTA_INSTALL>/server/bin 5. Start  with  default  single  node  config by  executing:   1. start-­‐tc-­‐server.sh (or  .bat) 6. Terracotta  process  is  now  accessible  at  IP:9510 Note:  if  setting  up  Terracotta  in  active/mirror  setup,  tc-­‐config.xml must  be  created  and   referenced  at  startup: • start-­‐tc-­‐server.sh (or  .bat)  -­‐f  <path-­‐to-­‐config>/tc-­‐config.xml –n  <server-­‐name-­‐to-­‐start>  
  • 32. Connecting  CF  11  to  Terracotta  in  just  a  few  steps 1. Copy  Ehcache +  Terracotta  libs  to  <CF_HOME>/cfusion/lib 1. <TERRACOTTA_INSTALL>/apis/ehcache/lib/ehcache-­‐2.10.1.jar 2. <TERRACOTTA_INSTALL>/apis/toolkit/lib/terracotta-­‐toolkit-­‐runtime-­‐4.3.1.jar 2. Add  terracotta-­‐specifics  configurations  in  CF  ehcache configs: 1. <CF_HOME>/cfusion/lib/ehcache.xml 2. <CF_HOME>/cfusion/lib/auth-­‐ehcache.xml 3. Restart  CF 4. Notice  Terracotta  connection  in  CF  logs
  • 33. All  these  features  are  now  cached  on  Terracotta! • CF  Authentication: • auth-­‐ehcache.xml:  authcache,  authtokenmappingcache • Internal  Caching  (CF  templates,  component  paths)   • <cfcache> -­‐ Cache  fragments  of  html • <cfquery>  -­‐ Cache  DB  calls • <cfquery name="myPortfolio"  cachedwithin=#createTimeSpan(  0,  1,  0,  0  )#> • ORM  with  Ehcache 2nd level  caching:  Caching Hibernate  queries • Entityload('BlogPost',{},{cacheable=true}) • CF  Cache  functions:  Direct  Ehcache calls • CacheGet /  CachePut /  CacheRemove /  CacheGetAllIds • CacheGetMetadata • CacheGetProperties /  CacheSetProperties • Custom  CF  JAVA  components  using  Ehcache library  directly + +
  • 34. And now just wait to see your CF website absorb the next usage spikes!!
  • 35. ©2013 Software AG Government Solutions. All rights reserved.35 | Questions? Fabien Sanglier Terracotta Architect www.linkedin.com/in/fabiensanglier/ fabien.sanglier@softwareaggov.com twitter.com/fabiensanglier fsanglier.blogspot.com github.com/lanimall www.SoftwareAGgov.comSoftware AG : Terracotta: www.terracotta.org Ehcache: www.ehcache.org www.SoftwareAGgov.comSoftware AG Government Solutions :