From users-return-235303-apmail-tomcat-users-archive=tomcat.apache.org@tomcat.apache.org Thu Jul 5 00:36:10 2012 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 F30E7CB86 for ; Thu, 5 Jul 2012 00:36:09 +0000 (UTC) Received: (qmail 46215 invoked by uid 500); 5 Jul 2012 00:36:06 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 46136 invoked by uid 500); 5 Jul 2012 00:36:06 -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 46125 invoked by uid 99); 5 Jul 2012 00:36:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 00:36:06 +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 (athena.apache.org: local policy) Received: from [76.96.59.243] (HELO qmta13.westchester.pa.mail.comcast.net) (76.96.59.243) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 00:35:59 +0000 Received: from omta08.westchester.pa.mail.comcast.net ([76.96.62.12]) by qmta13.westchester.pa.mail.comcast.net with comcast id WQJ21j0060Fqzac5DQbgRl; Thu, 05 Jul 2012 00:35:40 +0000 Received: from Christophers-MacBook-Pro.local ([107.3.88.58]) by omta08.westchester.pa.mail.comcast.net with comcast id WQbe1j0061FXhpX3UQbe1r; Thu, 05 Jul 2012 00:35:38 +0000 Message-ID: <4FF4E163.7050509@christopherschultz.net> Date: Wed, 04 Jul 2012 20:35:47 -0400 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Any way to deal with too many request per second? References: In-Reply-To: X-Enigmail-Version: 1.4.2 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: SHA1 Brian, On 6/29/12 7:57 PM, Brian Braun wrote: > I created a RESTfull service. My clients are sending me HTTP > requests, and I return them responses. Usually, a client makes at > the most 1-2 requests per second which is totally fine, but some > clients sometimes make about 30 requests per second and that makes > my server suffer, even though I'm using a load balancer with two > servers behind it. I would like to find a way to deal with this. > The best thing would be to delay them when they do that, not to > totally stop or ban them, but to slow them somehow. Maybe creating > a queue for them, or maybe putting them in a lower priority, until > they slow their requests. I could program this myself, but I guess > there is already a solution somewhere. Maybe a Tomcat valve could > do it? Does anybody know one? Or maybe some kind of filter? Any > suggestions? You are looking for a feature called "traffic shaping" or "quality of service" (QOS), which is something Tomcat does not do (at least not directly). You should look at your load balancer's options to support either of these features. If not, you could look at something like mod_qos for Apache httpd. It will require another component, but it will get the job done. The alternative to something off-the-shelf like that, of course, is to implement it yourself. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/04WMACgkQ9CaO5/Lv0PB/ZQCgkhHv+tpYxptkT0ZPAkLcvF7S 0ZYAnjTYPxAdFM3nUbVRC8+vio+jyDg3 =YjE6 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org