Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network


Groupware Zookeeper And Jgroups



My experience on building a service registry with jgroups and zookeeper

My experience on building a service registry with jgroups and zookeeper



Total Views
Views on SlideShare
Embed Views



4 Embeds 414

http://www.bluetangstudio.com 405
http://www.linkedin.com 4
https://www.linkedin.com 4
http://webcache.googleusercontent.com 1



Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Groupware Zookeeper And Jgroups Presentation Transcript

  • 1. GROUPWARE -JGROUPS & ZOOKEEPER presented by Yung-Lin Ho yunglin@gmail.com founder of blue tang studio
  • 2. GROUPWARE?• Organize group• Send Group Message• Handle abnormal quit• Elect new group leader.
  • 3. OUR NEEDS•A Service Registry to provide the service endpoint of servicesin the cloud. - data repository for a given model. - search indexer for a given model.
  • 4. JGROUPS• An Open Source Project founded by Bela Ban• Heavily used by JBoss.• Messaging API built on the top of IGMP, TCP, and UDP.• Messages will come-in in order.
  • 5. JGROUPS - SIMPLE API• JChannel • jchannel.send(Address dst, Address src, byte[] msg);• MessageListener • public void viewAccepted(View new_view) • public void receive(Message message)
  • 6. STATE TRANSFER• MessangerListener • byte[] getState(); • void setState(byte[] state);
  • 7. SERVICE REGISTRY WITH JGROUP• When service provider starts(or ends), it has to send a service advertisement message to the group.• When service provider closes abnormally, each member has to handle this event in the viewChanged() method.•
  • 8. ISSUES WITH JGROUPS• Keeps states on each machine.• State Transfer is an expensive operations but it happens often!• JGroups with 2 threads for each channel.• Kicker - Sharing channel among different usages is HARD!!. MuxDispatcher is expert only.• Document is not sufficient.
  • 9. ZOOKEEPER• Open Source Distributed Locking System by Yahoo!• An OOS solution for Google Chubby.•
  • 10. ZOOKEEPER OPERATIONS• Operations • create nodes(normal, ephemeral, and sequence) • get a node, or get all children of a node. • set data to nodes. • set watcher to nodes on data changes and node changes.
  • 11. DUDE, WHERE IS MY LOCK? Call create( ) to create a node with pathname "_locknode_/write-". This is the lock node spoken of later in the protocol. Make sure to set both sequence and ephemeral flags.1. Call getChildren( ) on the lock node without setting the watch flag - this is important, as it avoids the herd effect.2. If there are no children with a lower sequence number than the node created in step 1, the client has the lock and the client exits the protocol.3. Call exists( ), with watch flag set, on the node with the pathname that has the next lowest sequence number.4. If exists( ) returns false, goto step 2. Otherwise, wait for a notification for the pathname from the previous step before going to step 2.
  • 12. BACK TO SERVICE REGISTRY• /service-registry/{properties}/{serviceName}/${endpoint}• But pull state from zookeeper on each operation is expensive too.• Keep partial state in local memory (get and cache)• use watcher to keep local state in-sync with the state in zookeeper.
  • 13. QA?