Post on 13-May-2018
Boost Your Hibernate and Application PerformancePresented by: Greg Luck, Founder and CTO Ehcache
March 3, 2010
Thursday, 18 March 2010
www.terracotta.org
Agenda Intro to Ehcache and Terracotta Code: Scaling Spring Pet ClinicWith HibernateWith JDBC direct
Comparative Performance Testing ResultsDatabaseEhcache EXMemcached Well-known IMDG
Near-term Roadmap: Projects Brisbane & Darwin
2
Thursday, 18 March 2010
www.terracotta.org
About Ehcache
Founded in 2003 Apache 2.0 License Integrated by lots of projects, products Hibernate Provider implemented 2003 Web Caching 2004 Distributed Caching 2006 Greg Luck becomes co-spec lead of JSR107 JCACHE (JSR107) implementation 2007 REST and SOAP APIs 2008 SourceForge Project of the Month March 2009 Acquired by Terracotta 2009 Integration with Terracotta Server Array 2009
3
The world's most widely used Java cache
Thursday, 18 March 2010
www.terracotta.org
About Terracotta
4
Company focus: Application Scale Performance solutions span 1 node to 1000’s and virtual environments Solutions for key scale bottlenecks: Cache, ORMs, Web Session Clustering etc.
Commercial OSS business model Core products are Open Source Commercial product offerings add support and enterprise features
Ubiquitous footprint Default Cache for Atlassian, Grails, Hibernate, Liferay, Salesforce, Spring, etc. Used by 70% of Sun’s Java customers* 100K+ Enterprise Deployments
Global presence Development/Support Centers in San Francisco and New Delhi Sales Office/Presence in US, Europe, Asia and Australia Resellers in US, UK, Continental Europe, China, S.E. Asia, Australia, Africa
Thursday, 18 March 2010
www.terracotta.org
Terracotta Customers
5
100K+ Enterprise Deployments 100% of Fortune 100 70% of Fortune 1000
Business Critical Requirements High scale & performance Continuous Uptime
Deployments Traditional Data Center Private and Public Cloud
Thursday, 18 March 2010
www.terracotta.org
Code - Spring Pet Clinic
6
Thursday, 18 March 2010
www.terracotta.org
Pet Clinic Domain Model Domain Objects
VetsSpecialtyOwnerPetPetTypeVisit
7
Sprint PetClinic Domain Model
attr = ""
Pet
attr = ""
Owner
attr = ""
Visit
attr = ""
Vet
attr = ""
Specialty
attr = ""
PetType
Thursday, 18 March 2010
www.terracotta.org
Code Steps:
Configure PetClinic for Hibernate
Configure hibernate for second-level cache
Configure hbm file for caching
Update query code to add caching
Optional but recommended:
add ehcache.xml to WEB-INF/classes specify cache regions and config
8
Thursday, 18 March 2010
www.terracotta.org
Code ehcache.xml:
9
<ehcache> <defaultCache maxElementsInMemory="10000" eternal="false" timeToLiveSeconds="120" />
<cache name="org.hibernate.cache.UpdateTimestampsCache" maxElementsInMemory="10000" timeToIdleSeconds="300" />
<cache name="org.hibernate.cache.StandardQueryCache" maxElementsInMemory="10000" timeToIdleSeconds="300" /></ehcache>
Thursday, 18 March 2010
www.terracotta.org
Performance
10
Testing Methodology
Results in Details
Conclusions
Thursday, 18 March 2010
www.terracotta.org
Standalone Performance Read Performance
11
Thursday, 18 March 2010
www.terracotta.org
Standalone Performance Put Performance
12
Thursday, 18 March 2010
www.terracotta.org
Ehcache in-process vs Memcached
13
Thursday, 18 March 2010
www.terracotta.org
Ehcache with Terracotta vs the Rest Application
Tests done with Owners = 25K and 125K which translates to total objects of 0.3 M and 1.5 M
Minimal tuning.
Cluster Configuration:8 Client JVMs (1.75G Heap)1 (+0) Terracotta Servers (6G Heap)MySql: sales18.
14
Thursday, 18 March 2010
www.terracotta.org
Ehcache with Terracotta vs the Rest Ehcache
Replicated with RMI not included because not coherentSingle TSA Server 15 threads and some with 100 threads
IMDG15 threads Cache deployed in Partitioned Mode Tests were also done with Replicated – which did well for
small cache sizes but failed to complete with larger cache sizes. So, it is not included.
memcached15 threads1 server
15
Thursday, 18 March 2010
www.terracotta.org
Hibernate - Read Only TPS
16
Thursday, 18 March 2010
www.terracotta.org
Hibernate - Read Write TPS
17
Thursday, 18 March 2010
www.terracotta.org
Hibernate - Read Only Latency
18
Thursday, 18 March 2010
www.terracotta.org
Hibernate - Read Write Latency
19
Thursday, 18 March 2010
www.terracotta.org
Test SourceThe code behind the benchmarks is in the Terracotta Community SVN repository.
Download https://svn.terracotta.org/repo/forge/projects/ehcacheperf/(Terracotta Community Login Required)
20
Thursday, 18 March 2010
www.terracotta.org
Performance ConclusionsWith Hibernate, Using Spring Pet Clinic
After app servers and DBs tuned by independent 3rd parties30-95% database load reduction80 times read-only performance of MySQLNotably lower latency
1.5 ms versus 120 ms for database (25k)
21
Thursday, 18 March 2010
www.terracotta.org
Visual Cache Tuning - Dev Console
22
Cache hit ratiosHit/miss ratesHits on the databaseCache putsDetailed efficiency of cache regions
Dramatically simplifies tuning and operations, and shows the database offload.
Thursday, 18 March 2010
www.terracotta.org
Product Roadmap -March 2010Hibernate 3.3+ Caching SPI
Old SPI was heavily synchronized and not well suited to clustersNew SPI uses CacheRegionFactoryFully cluster safe with Terracotta Server ArrayUnification of the Ehcache and Terracotta 3.2 providers
JTACache as an XAResourceDetects most common Transaction ManagersOthers configurableWorks with Spring, EJB and manual transactions
23
Thursday, 18 March 2010
www.terracotta.org
Product Roadmap ...cont.Write-behind
Offloads Databases with high write workloadsCacheStorer Interface to implementcache.putWithWriter(...) and cache.removeWithWriter(...)Write-through and Write-behind modesBatching, coalescing and very configurableStandalone with in-memory write-behind queue.TSA with HA, durability and distributed workload balancing
Bulk Loadingincoherent mode for startup or periodic cache loading10 x fasterNo change to the API (put, load etc).SetCoherent(), isCoherent(), waitForCoherent()
24
Thursday, 18 March 2010
www.terracotta.org
Product Roadmap ...cont.New CAP configurability – per cache basis
coherent – run coherent or incoherent (faster)synchronousWrites – true for ha, false is fastercopyOnRead – true to stop interactions between threads outside of the cacheCluster events – notification of partition and reconnection
ManagementDynamic Configuration of common cache configs from JMX and DevConsoleNew web-based Monitoring with UI and API
25
Thursday, 18 March 2010
www.terracotta.org
Non-disruptive Scalability Continuum
26
http://www.terracotta.org/continuum
Thursday, 18 March 2010
www.terracotta.org
Terracotta Commercial Products
27
Enterprise Support Included in Commercial Offerings: 24x7 support for mission critical business functions Guaranteed time-to-respond service level agreement (SLA) Thoroughly tested patches
Thursday, 18 March 2010
www.terracotta.org
Q&A
Please ask any questions you have in the Q&A window.
28
Thursday, 18 March 2010
www.terracotta.org
Additional Ehcache InformationWebsite: www.ehcache.org
Documention: www.ehcache.org/documentation
Hibernate: www.ehcache.org/documentation/
hibernate.html
Commercial Products: www.terracotta.org/ehcache/
Twitter: www.twitter.com/Ehcache
29
Thursday, 18 March 2010
www.terracotta.org
Terracotta Contact InformationWebsite: www.terracottatech.com
Telephone: +1 415-738-4000
Email: info@terracottatech.com
Facebook: www.facebook.com/Terracotta
Twitter: www.twitter.com/TerracottaTech
30
Thursday, 18 March 2010