Terracotta And Hibernate

2,775 views
2,672 views

Published on

Terracotta is a high performance open source Java clustering technology which includes native support via plug-ins to seamlessly integrate with applications based on Hibernate, EHCache, Spring and more. In this session, learn how to integrate Terracotta into your Hibernate application in just a few simple steps. Then visualize your application in real-time and tune it's performance using the Terracotta developer console, a sophisticated runtime visualization, profiling and debugging tool included with the core Terracotta kit.

Published in: Business, Sports, Career

Terracotta And Hibernate

  1. 1. Scaling Hibernate with Terracotta Taylor Gautier Code Camp, October 3, 2009
  2. 2. Agenda
  3. 3. Agenda • Caching 101
  4. 4. Agenda • Caching 101 • Intro to Terracotta
  5. 5. Agenda • Caching 101 • Intro to Terracotta • Installation and Setup
  6. 6. Agenda • Caching 101 • Intro to Terracotta • Installation and Setup • Demo
  7. 7. About me...
  8. 8. About me... • Java enthusiast since 1996
  9. 9. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999
  10. 10. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009
  11. 11. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 • Principal Architect - Grid Dynamics
  12. 12. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 • Principal Architect - Grid Dynamics • Technical Advisor - Terracotta
  13. 13. About me... • Java enthusiast since 1996 • Have built scalable systems since 1999 • Terracotta Product Manager 2006-2009 My Blog - java.think() • Principal Architect - Grid Dynamics http:// • Technical Advisor - Terracotta javathink.blogspot.com
  14. 14. Quick poll...
  15. 15. • How many have heard of Terracotta?
  16. 16. • How many have heard of Terracotta? • How many have downloaded it?
  17. 17. • How many have heard of Terracotta? • How many have downloaded it? • Anyone running in production?
  18. 18. Why are you here?
  19. 19. Your app needs... something
  20. 20. Your app needs... better latency
  21. 21. Your app needs... better throughput
  22. 22. Your app needs... better efficiency
  23. 23. Your app needs... to cost less
  24. 24. Let’s see if modern system architecture can help us...
  25. 25. Memory Hierarchy
  26. 26. Why a hierarchy?
  27. 27. Modern Hardware
  28. 28. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9)
  29. 29. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9)
  30. 30. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9) L2 Cache Access Time 20 nanoseconds (20x10 -9)
  31. 31. Modern Hardware CPU Speed (2GHZ) 1 nanosecond (1x10 -9) L1 Cache Access Time 2 nanoseconds (2x10 -9) L2 Cache Access Time 20 nanoseconds (20x10 -9) Main Memory Access Time 60 nanoseconds (60x10 -9)
  32. 32. How common is this? Modern Hardware
  33. 33. How common is this? File-system
  34. 34. How common is this? Web Architecture
  35. 35. But not JEE?
  36. 36. But not JEE? Hibernate (Session)
  37. 37. But not JEE? Hibernate (Session) Hibernate Second Level Cache
  38. 38. Hibernate Architecture CPU Architecture
  39. 39. Hibernate Architecture CPU Architecture Hibernate Architecture
  40. 40. How to add a second level cache to your application?
  41. 41. Terracotta!
  42. 42. What is Terracotta?
  43. 43. IS IT...
  44. 44. A proprietary JVM?
  45. 45. Proprietary software?
  46. 46. Expensive?
  47. 47. Of course not!
  48. 48. Terracotta, is...
  49. 49. Terracotta, is... Open source
  50. 50. Terracotta, is... Open source High Performance Availability and Scalability
  51. 51. Terracotta, is... Open source High Performance Availability and Scalability For J2SE & J2EE
  52. 52. Terracotta, is... Open source High Performance Availability and Scalability For J2SE & J2EE Really fun!
  53. 53. Terracotta Platform Terracotta Platform (Server Array)
  54. 54. Terracotta Platform - coherent data replication - automatic data persistence - ACID transactions - automatic data routing - cluster coordination - visual profiling and debugging Terracotta Platform (Server Array)
  55. 55. Terracotta Platform Application Application Application - coherent data replication - automatic data persistence - ACID transactions - automatic data routing - cluster coordination - visual profiling and debugging Terracotta Platform (Server Array)
  56. 56. Terracotta Platform Application Application Application Terracotta Server Instance Terracotta Server Instance
  57. 57. Terracotta Platform Application Application Application Terracotta Server Terracotta Server Instance Instance Terracotta Server Terracotta Server Instance Instance
  58. 58. Terracotta Platform Application Application Application Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
  59. 59. Terracotta Platform Application Application Application POJOs POJOs POJOs Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
  60. 60. Terracotta Platform Application Application Application Hibernate Spring EHCache Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
  61. 61. TIMs Terracotta Platform ------------ Application Application Application Hibernate Spring EHCache Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
  62. 62. TIMs Terracotta Platform ------------ Application Application Application Hibernate Spring EHCache Hibernate TIM Spring TIMs EHCache TIM Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance Terracotta Server Terracotta Server Terracotta Server Terracotta Server Instance Instance Instance Instance
  63. 63. Terracotta Use Cases • Hibernate • Spring • EHCache • Web Sessions • Batch or Distributed Workload • POJOs
  64. 64. Support...
  65. 65. Support... • Community • ES
  66. 66. Support... • Community • ES • Commercial (24x7 SLA, official patches) • EX • FX
  67. 67. Terracotta for Hibernate
  68. 68. Features...
  69. 69. Features... • Second-Level Cache
  70. 70. Features... • Second-Level Cache • Replicated, Coherent Cache
  71. 71. Features... • Second-Level Cache • Replicated, Coherent Cache • Configurable settings at run-time
  72. 72. Features... • Second-Level Cache • Replicated, Coherent Cache • Configurable settings at run-time • Visual Profiling of Cache and Performance
  73. 73. Terracotta for Hibernate Architecture Standalone Architecture
  74. 74. Terracotta for Hibernate Architecture Standalone Architecture Distributed Architecture
  75. 75. Performance 100% Read 90 % Read 0% Write 10% Write 2ms 7ms Terracotta 55k TPS 16k TPS 106ms 95ms MySQL alone 1,122 TPS 1,259 TPS PetClinic with 1,000,000 objects
  76. 76. so, with a cache, you get...
  77. 77. so, with a cache, you get... ✓ Better performance
  78. 78. so, with a cache, you get... ✓ Better performance ✓ Better latency
  79. 79. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput
  80. 80. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput ✓ Better efficiency
  81. 81. so, with a cache, you get... ✓ Better performance ✓ Better latency ✓ Better throughput ✓ Better efficiency ✓ Lower cost
  82. 82. Your app needs...
  83. 83. Your app needs... a cache!
  84. 84. Installation and Setup
  85. 85. Step 1 - Download...
  86. 86. ...and Install Terracotta
  87. 87. Step 2 - Copy the Hibernate JARs
  88. 88. Step 2 - Copy the Hibernate JARs
  89. 89. Step 3 - Update your Hibernate Config
  90. 90. Step 4 - Update and re- build your Application
  91. 91. Step 4 - Update and re- build your Application
  92. 92. Step 5 - Start a Terracotta server
  93. 93. Step 6 - Start your application server
  94. 94. Always start a developer console!
  95. 95. DEMO!

×