Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Hazelcast in DX 7.2 1
Hazelcast
How to share Java objects in a cluster
Hazelcast in DX 7.2 2
DX 7.2
Sharing objects across servers
1
Hazelcast in DX 7.2 3
1 Why do we want to share objects?
• Replicated object = Highly Available object
o No Single Point o...
Hazelcast in DX 7.2 4
1 Why do we want to share objects?
Sticky Session Stateless
VS
Hazelcast in DX 7.2 5
What are the solutions?
1 • Externalize objects to a dedicated backend
• Synchronize objects across ...
Hazelcast in DX 7.2 6
What are the solutions?
1
VS
Offloaded objects Synchronized objects
Hazelcast in DX 7.2 7
1
Pros & Cons
• Externalized objects to a dedicated backend:
- No development required for some obje...
Hazelcast in DX 7.2 8
1
Hazelcast
“The Leading Open Source In-Memory Data Grid”
There is much more to Hazelcast than what ...
Hazelcast in DX 7.2 9
1
Hazelcast in Digital Experience Manager
7.2
• Hazelcast 3.7.3 is available out of the box in Digit...
Hazelcast in DX 7.2 10
1
Hazelcast server discovery
How do servers know about each other?
• Multicast
• TCP
• EC2 Cloud
DX...
Hazelcast in DX 7.2 11
1
DX 7.2 server architecture with Hazelcast
Hazelcast in DX 7.2 12
1
Hazelcast usages in 7.2
Hazelcast is already widely used inside Digital Experience Manager 7.2:
•...
Hazelcast in DX 7.2 13
Technical Implementation
2
Hazelcast in DX 7.2 14
2
Hazelcast architecture
• Hazelcast uses TCP communication to replicate the objects
• Hazelcast is...
Hazelcast in DX 7.2 15
How to use Hazelcast in DX7.2
Hazelcast in DX 7.2 16
2
OSGi Services
<osgi:reference id="com.hazelcast.core.HazelcastInstance" interface="com.hazelcast....
Hazelcast in DX 7.2 17
2
Simple shared object declaration
Java class declaration:
public class HazelcastExampleBean {
}
Fi...
Hazelcast in DX 7.2 18
2
That’s all. All the heavy lifting is handled internally by DX 7.2
Of course, there is much more t...
Hazelcast in DX 7.2 19
2
Distributed Events
• Membership Listener for cluster membership events.
• Distributed Object List...
Hazelcast in DX 7.2 20
2
Configuration fine tuning
The configuration is stored in
/digital-factory-
data/karaf/etc/hazelca...
Hazelcast in DX 7.2 21
2
Performances
• Hazelcast is designed to play well under high read and write load
• Network perfor...
Hazelcast in DX 7.2 22
THE END!
THANKS FOR
LISTENING
Prochain SlideShare
Chargement dans…5
×

Sharing of Distributed Objects in a DX Cluster, thanks to Hazelcast - Online Developers Meetup - March 2017

586 vues

Publié le

Here are the slides of Jahia's Developers Meetup held online, via Cisco WebEx, on March 15, 2017.

The topic of this meetup was: Sharing of Distributed Objects in a DX Cluster, thanks to Hazelcast.

Publié dans : Logiciels
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Sharing of Distributed Objects in a DX Cluster, thanks to Hazelcast - Online Developers Meetup - March 2017

  1. 1. Hazelcast in DX 7.2 1 Hazelcast How to share Java objects in a cluster
  2. 2. Hazelcast in DX 7.2 2 DX 7.2 Sharing objects across servers 1
  3. 3. Hazelcast in DX 7.2 3 1 Why do we want to share objects? • Replicated object = Highly Available object o No Single Point of Failure o Servers can be restarted and shutdown without data loss • Better load balancing o Load Balancer redirects traffic to the less busy server, and not to the one containing the data • Because we need it! o Prevents race conditions between servers o Some features simply need to share data cluster-wide
  4. 4. Hazelcast in DX 7.2 4 1 Why do we want to share objects? Sticky Session Stateless VS
  5. 5. Hazelcast in DX 7.2 5 What are the solutions? 1 • Externalize objects to a dedicated backend • Synchronize objects across the cluster Digital Experience Manager offers out of the box support for both!
  6. 6. Hazelcast in DX 7.2 6 What are the solutions? 1 VS Offloaded objects Synchronized objects
  7. 7. Hazelcast in DX 7.2 7 1 Pros & Cons • Externalized objects to a dedicated backend: - No development required for some objects (user sessions...) - Specific development required when storing custom objects - More complex architecture (additional servers) - Highly scalable • Synchronized objects across the cluster: - Needs to be taken into account in the code - No architecture change required - Very granular: specific objects can be synchronized while others aren’t - Very efficient with few servers, won’t scale to hundreds of nodes
  8. 8. Hazelcast in DX 7.2 8 1 Hazelcast “The Leading Open Source In-Memory Data Grid” There is much more to Hazelcast than what we are going to talk about today: Hazelcast is Open Source under Apache license (we love open source!)
  9. 9. Hazelcast in DX 7.2 9 1 Hazelcast in Digital Experience Manager 7.2 • Hazelcast 3.7.3 is available out of the box in Digital Experience Manager 7.2 • Available as a service: no custom integration required (Use it in less than 5 minutes) • Hazelcast is masterless: killing a server won’t alter the service
  10. 10. Hazelcast in DX 7.2 10 1 Hazelcast server discovery How do servers know about each other? • Multicast • TCP • EC2 Cloud DX 7.2 uses the TCP option. Everything is done for you and you can start using the service without worrying about the server discovery.
  11. 11. Hazelcast in DX 7.2 11 1 DX 7.2 server architecture with Hazelcast
  12. 12. Hazelcast in DX 7.2 12 1 Hazelcast usages in 7.2 Hazelcast is already widely used inside Digital Experience Manager 7.2: • Clustered module deployment: shared module states across the cluster • Oauth authentification modules: authentication token shared across the cluster to authenticate users on all servers at once • More custom modules we haven’t heard of!
  13. 13. Hazelcast in DX 7.2 13 Technical Implementation 2
  14. 14. Hazelcast in DX 7.2 14 2 Hazelcast architecture • Hazelcast uses TCP communication to replicate the objects • Hazelcast is event-based • Hazelcast handles concurrent access to objects out of the box • Hazelcast is instantiated by DX and exposed as an OSGi Service Any DX 7.2 module can import Hazelcast’s OSGi service and start using it right away.
  15. 15. Hazelcast in DX 7.2 15 How to use Hazelcast in DX7.2
  16. 16. Hazelcast in DX 7.2 16 2 OSGi Services <osgi:reference id="com.hazelcast.core.HazelcastInstance" interface="com.hazelcast.core.HazelcastInstance"/> <bean id="HazelcastExampleAction” class="org.jahia.modules.hazelcastexample.beans.HazelcastExampleBean"> <property name="hazelcastInstance" ref="com.hazelcast.core.HazelcastInstance"/> </bean> Spring file declaration: Imports the Hazelcast OSGi Service and injects it in a Spring Bean.
  17. 17. Hazelcast in DX 7.2 17 2 Simple shared object declaration Java class declaration: public class HazelcastExampleBean { } First access to the getMap(String) method will instantiate the shared object private HazelcastInstance hazelcastInstance; public void setHazelcastInstance(HazelcastInstance hi) { this.hazelcastInstance = hi; } public HazelcastExampleBean () { Map<Integer, String> sharedData = hazelcastInstance.getMap("sharedObject"); sharedData.put(sharedData.size()+1, “myContent”); }
  18. 18. Hazelcast in DX 7.2 18 2 That’s all. All the heavy lifting is handled internally by DX 7.2 Of course, there is much more to Hazelcast than sharing objects. If you want to know more, more documentation is available at http://docs.hazelcast.org/docs/3.7/manual/html-single/index.html
  19. 19. Hazelcast in DX 7.2 19 2 Distributed Events • Membership Listener for cluster membership events. • Distributed Object Listener for distributed object creation and destroy events. • Migration Listener for partition migration start and complete events. • Partition Lost Listener for partition lost events. • Lifecycle Listener for HazelcastInstance lifecycle events. • Entry Listener for IMap and MultiMap entry events. • Item Listener for IQueue, ISet and IList item events. • Message Listener for ITopic message events. • Client Listener for client connection events. Event distribution is a big part of Hazelcast. Even though you might not use them at the beginning, listening to events might come in handy someday.
  20. 20. Hazelcast in DX 7.2 20 2 Configuration fine tuning The configuration is stored in /digital-factory- data/karaf/etc/hazelcast.xml
  21. 21. Hazelcast in DX 7.2 21 2 Performances • Hazelcast is designed to play well under high read and write load • Network performance is a key aspect of Hazelcast’s perfs If you are designing a highly demanding application with lots of accesses, load performance testing is a key aspect of the project.
  22. 22. Hazelcast in DX 7.2 22 THE END! THANKS FOR LISTENING

×