Leader crashing simulate

106 views
Skip to first unread message

Vineet Menon

unread,
Apr 23, 2013, 1:03:20 AM4/23/13
to curato...@googlegroups.com
I am trying to simulate the crashing of nodes in zookeeper with curator.
I have modified the example program with LeaderSelector and LeaderSelectorListener for incorporating seperate individual programs which act as peers.

1. When I Cnrt + C the Java program, the next node takes considerable time about 30 s for the next peer to become leader. I have checked with the zookeeper for the nodes available and have noticed that the ephemeral znodes are alive even after the process is crashed.
I have attached the program codes with this post. AM I doing anything wrong with the code? or I should simulate the crash some way other than that?

2. When the leader actually relinquishes the leadership, by actually terminating itself, the switching over is quite smooth and fast.

What is happening here? What am I doing wrong?


App1.java
LeaderElector1.java

Jordan Zimmerman

unread,
Apr 23, 2013, 2:44:00 AM4/23/13
to curato...@googlegroups.com
ZooKeeper has a session timeout. Ephemeral nodes are only deleted after the session timeout has expired. You specify the session timeout when you create the CuratorFramework instance. The default session timeout is 60 seconds.

-JZ 

--
You received this message because you are subscribed to the Google Groups "curator-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to curator-user...@googlegroups.com.
To post to this group, send email to curato...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/curator-users/-/_o1hpQWjemkJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
<App1.java><LeaderElector1.java>

Vineet Menon

unread,
Apr 23, 2013, 3:10:39 AM4/23/13
to curato...@googlegroups.com
thanks for the prompt reply,Jordan. Does it also depend on the tickTime value in ZooKeeper config file?
I just now changed it to 500 ms from 2000 ms and the time taken to elect the new leader came down from 30 ms to 4ms!

Eric Pederson

unread,
Apr 23, 2013, 7:36:48 AM4/23/13
to curato...@googlegroups.com
That is very interesting!   I have also seen very long (even greater than 30 secs) election times when the ZK leader is killed (I am actually using LeaderLatch).  I will try the tick time change to see if I see the same thing as you, Vineet.
Reply all
Reply to author
Forward
0 new messages