From dev-return-77123-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Fri Jan 11 20:35:04 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 24E85180648 for ; Fri, 11 Jan 2019 20:35:03 +0100 (CET) Received: (qmail 47325 invoked by uid 500); 11 Jan 2019 19:35:03 -0000 Mailing-List: contact dev-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 dev@zookeeper.apache.org Received: (qmail 47314 invoked by uid 99); 11 Jan 2019 19:35:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2019 19:35:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9E7E118089C for ; Fri, 11 Jan 2019 19:35:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 1snCARoJy7dW for ; Fri, 11 Jan 2019 19:35:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E116D5FCBA for ; Fri, 11 Jan 2019 19:35:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5CA13E070F for ; Fri, 11 Jan 2019 19:35:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0DC6F2558B for ; Fri, 11 Jan 2019 19:35:00 +0000 (UTC) Date: Fri, 11 Jan 2019 19:35:00 +0000 (UTC) From: "Jie Huang (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ZOOKEEPER-3243) Add server side request throttling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Jie Huang created ZOOKEEPER-3243: ------------------------------------ Summary: Add server side request throttling Key: ZOOKEEPER-3243 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3243 Project: ZooKeeper Issue Type: Improvement Components: server Reporter: Jie Huang Fix For: 3.6.0 On-going performance investigation at Facebook has demonstrated that Zookee= per is easily overwhelmed by spikes in connection rates and/or write reques= t rates. Zookeeper performance gets progressively worse, clients timeout an= d try to reconnect (exacerbating the problem) and things enter a death spir= al. To solve this problem, we need to add load protection to Zookeeper via = rate limiting and work shedding. This JIRA task adds a new request throttling mechanism (RequestThrottler) t= o Zookeeper in hopes of preventing Zookeeper from becoming overwhelmed duri= ng request spikes. =C2=A0 When enabled, the RequestThrottler limits the number Of outstanding request= s currently submitted to the request processor pipeline.=20 =C2=A0 The throttler augments the limit imposed by the globalOutstandingLimit that= is enforced by the connection layer (NIOServerCnxn, NettyServerCnxn).=C2= =A0The connection layer limit applies backpressure against the TCP connecti= on by disabling selection on connections once the request limit is reached.= However, the connection layer always allows a connection to send at least = one request before disabling selection on that connection. Thus, in a scena= rio with 40000 client connections, the total number of requests inflight ma= y be as high as 40000 even if the globalOustandingLimit was set lower. =C2=A0 The RequestThrottler addresses this issue by adding additional queueing. Wh= en enabled, client connections no longer submit requests directly to the re= quest processor pipeline but instead to the RequestThrottler. The RequestTh= rottler is then responsible for issuing requests to the request processors,= and enforces a separate maxRequests limit. If the total number of outstand= ing requests is higher than maxRequests, the throttler will continually sta= ll for stallTime milliseconds until under limit. =C2=A0 The RequestThrottler can also optionally drop stale requests rather than su= bmit them to the processor pipeline. A stale request is a request sent by a= connection that is already closed, and/or a request whose latency will end= up being higher than its associated session timeout. To ensure ordering guarantees, if a request is ever dropped from a connecti= on that connection is closed and flagged as invalid. All subsequent request= s inflight from that connection are then dropped as well. =C2=A0 The notion of staleness is configurable, both connection staleness and late= ncy staleness can be individually enabled/disabled. Both these settings and= the various throttle settings (limit, stall time, stale drop) can be confi= gured via system properties as well as at runtime via JMX. =C2=A0 The throttler has been tested and benchmarked at Facebook -- This message was sent by Atlassian JIRA (v7.6.3#76005)