GitHub user TyqITstudent opened a pull request: https://github.com/apache/zookeeper/pull/688
reduce session revalidation time after zxid roll over **Problem:** 1. Sometimes Zookeeper cluster will receive a lot of connections from clients, sometimes connection number even exceeds 1W. When zxid rolls over, the clients will reconnect and revalidate the session. 2. In Zookeeper design structure, when follower server receives the session revalidation requests, it will send requests to leader server, which is designed to be responsible for session revalidation. 3. In a short time, Leader will handle lots of requests. I use a tool to get the statistics, some clients need to wait over 20s. It is too long for some special clients, like ResourceManager. **Solution:** 1. When zookeeper cluster finishes reelection(which will cost a few seconds). The leader will send the time point TimeA to followers. ï¼which is the approximate value of roll overï¼ 2. Followers can judge the most session revalidations. When the timeout of the session is less than currentTime - timeA , follower will put the session on the touchTable. ï¼Every half tickTime, followers will send sessions of touchTable to leader to validateï¼. 3. When the timeout of the session is larger than currentTime - timeA, the follower will send session revalidation request to leader right away. So the leader will receive fewer requests from followers. You can merge this pull request into a Git repository by running: $ git pull https://github.com/TyqITstudent/zookeeper ZOOKEEPER-3169 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/zookeeper/pull/688.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #688 ---- commit 6a1aca3de5585325c9b4fb595813fb0f86d5a2ea Author: ç°æ¯ 群 <tianyiqun@...> Date: 2018-11-04T08:45:53Z reduce session revalidation time after zxid roll over ---- ---