Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B3A03CA0C for ; Sat, 6 Dec 2014 01:20:14 +0000 (UTC) Received: (qmail 25734 invoked by uid 500); 6 Dec 2014 01:20:08 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 25662 invoked by uid 500); 6 Dec 2014 01:20:08 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 25649 invoked by uid 99); 6 Dec 2014 01:20:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Dec 2014 01:20:08 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [206.46.173.17] (HELO vms173017pub.verizon.net) (206.46.173.17) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Dec 2014 01:19:42 +0000 Received: from Christophers-MacBook-Pro.local ([64.134.102.237]) by vms173017.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0NG400G89ZOE4TB0@vms173017.mailsrvcs.net> for users@tomcat.apache.org; Fri, 05 Dec 2014 19:19:26 -0600 (CST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=F/vgrRlI c=1 sm=1 tr=0 a=zcs2Cn6c6ASSH/FTszAoZQ==:117 a=0Jzs0ny25Y0A:10 a=IkcTkHD0fZMA:10 a=-57I09spAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=A92cGCtB03wA:10 a=pGLkceISAAAA:8 a=j4nzMFrpAAAA:8 a=fx9ATQPrNN9f1tnvasoA:9 a=I-LweDSiNBydimyI:21 a=p3-9mwPO-S7tYzbR:21 a=QEXdDO2ut3YA:10 Message-id: <5482599F.4050801@christopherschultz.net> Date: Fri, 05 Dec 2014 20:19:27 -0500 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-version: 1.0 To: Tomcat Users List Subject: Re: throttle filter References: In-reply-to: Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Leo, On 12/2/14 5:12 PM, Leo Donahue wrote: > On Tue, Dec 2, 2014 at 3:28 PM, Chris Gamache > wrote: > >> You could probably be more sophisticated in your throttling, >> letting certain IPs or requests through while tarpitting others. >> >> I was thinking about how, from my perspective, I see developers >> wanting to > throttle back the number of requests to their web applications (and > web services) based on the same ip, session, and other factors > appearing in a given amount of time. > > I know that some frameworks (Spring) provide this mechanism, and I > have seen other projects attempt to record the information in a > database and produce application specific logic to restrict the > number of requests in a given amount of time. > > I didn't know if anyone has considered a container provided filter > that is configurable to provide this kind of functionality. "This > kind of functionality" is ambiguous I know. But I would settle on > even the basic ability to say: For this web service/app, allow > only x many connections per sec/min/hour. FWIW, Tomcat already captures stats like requests per unit time. You can find them on the connector's MBean (I think... don't have time to check just now). A Filter wanting to simply limit the total server throughput (e.g. 10k/sec) could consult that data and simply return 503 responses if the server were handling too much load. I'd recommend making the limit for that Filter configurable through JMX or some other means, so you can take the cap off it you think that you can handle more load... you don't want to restart your webapp just to change the load-cap. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJUglmfAAoJEBzwKT+lPKRYmWYP/05x4TViGO4tz1FTfd2q81+7 RWYvGjk/S7ItedwflGLWO/yCSAweIsB+Gh+9qcbhyh2xn6u1xVZuSEBHyUsqCuQE VLtbyEf05VSQ26ju4sLkT9XY8o379udb+Svk7/IRakhba2EKxuZSYz/L8dHwNjja suoNA40Nhm8qyySfSzHFrIcyz7okuJxV3GXMU5048RD+BN1M/IImSqps/osDXy1k yqXX2+KUPfC/S6kO5zttNZATSLhAirccAoqan6NfonyNbZOc/6d6Am5ZnTwHf7Sm eefbloWoN2I4n3KAGOHeRBmZpHubGGG+ZFRof/ir+2K44mwfmwWi1EL9gjIjyu7P dck9wWw1+LdtNZLBfgXTVTUCyfz/V1XagzyfCl7TqKHDxv2TQuz9pm8GAcixpEKz Ch9oszWwit+tRNvXwUwX8M/7NmOaLkZ2o9ouJe+CcfPw/cm1vI90bcVagR4oqFmA TJRU8KhXp3FsApyx6KGzsMiDVO6GTIyVMux4t9V5/6huwU1z1VAaT2Vri48JTXFw Edl6Pm5rss0X4PwtMgZAoG3MipbboE3Xufkvpo3sQ/XJ/Hxq9OFwD6Qmwx0+Ezoi xtIAUbAAu9Di4FCE75GxTV5Tm5dCGg2dHoIpF1Nv0KmU+2+QLELB3bF6SBANAwvx dTOOk4pS91Ir2DWeDlIE =86pY -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org