From notifications-return-1693-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Wed Sep 4 18:48:57 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7ADBA1804BB for ; Wed, 4 Sep 2019 20:48:57 +0200 (CEST) Received: (qmail 4970 invoked by uid 500); 5 Sep 2019 00:35:31 -0000 Mailing-List: contact notifications-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list notifications@zookeeper.apache.org Received: (qmail 4950 invoked by uid 99); 5 Sep 2019 00:35:31 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Sep 2019 00:35:31 +0000 From: GitBox To: notifications@zookeeper.apache.org Subject: [GitHub] [zookeeper] enixon commented on a change in pull request #1045: ZOOKEEPER-3400: Add documentation on local sessions Message-ID: <156762293680.19372.10500028854532485898.gitbox@gitbox.apache.org> Date: Wed, 04 Sep 2019 18:48:56 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit enixon commented on a change in pull request #1045: ZOOKEEPER-3400: Add documentation on local sessions URL: https://github.com/apache/zookeeper/pull/1045#discussion_r320917719 ########## File path: zookeeper-docs/src/main/resources/markdown/zookeeperProgrammers.md ########## @@ -503,6 +503,85 @@ new list and failing to connect, the client moves back to the normal mode of ope an arbitrary server from the connectString and attempts to connect to it. If that fails, it will continue trying different random servers in round robin. (see above the algorithm used to initially choose a server) +**local session**.Added in 3.5.0, mainly implemented by [ZOOKEEPER-1147](https://issues.apache.org/jira/browse/ZOOKEEPER-1147). + +- Background:The create and close of session is costly in zookeeper, especially when these operations of sessions need a +quorum confirmation by leader, which we call this session type: global session. it will be a bottle neck for ZooKeeper ensemble +when it wants to handle thousands of client connections. +So after 3.5.0, we introduce a new type of session: local session which doesn't have a full functionality of a normal(global) session. +,this feature will be available by turning on *localSessionsEnabled*. + +when *localSessionsUpgradingEnabled* is disable: + +- Local sessions cannot create ephemeral nodes + +- Once a local session is lost, users cannot re-establish it using the session-id/password. The session and its watches are gone for good. + +- When a local session connects, the session info is only maintained on the zookeeper server that it is connected to. The leader is not aware of the creation of such a session and +there is no state written to disk. + +- The pings, expiration and other session state maintenance are handled by the server which current session is connected to. + +when *localSessionsUpgradingEnabled* is enable: + +- A local session can upgrade to the global session automatically. + +- When a new session is created it is saved locally in a wrapped *LocalSessionTracker*. It can subsequently be upgraded +to a global session as required(e.g. create ephemeral nodes).If an upgrade is requested the session is removed from local + collections while keeping the same session ID. + +- Currently, Only the operation:*create ephemeral node* needs a session upgrade from local to global. +The reason is that the create of ephemeral node depends heavily on a global session.if local session can create ephemeral +node without upgrading to global session, it will cause the data inconsistency between different nodes. Review comment: The leader also needs to know about the lifespan of a session in order to clean up ephemerals on close/expiry. This requires a global session as the local session is tied to its particular server. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services