Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 72093 invoked from network); 9 Oct 2008 13:51:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Oct 2008 13:51:23 -0000 Received: (qmail 36394 invoked by uid 500); 9 Oct 2008 13:51:21 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 36372 invoked by uid 500); 9 Oct 2008 13:51:21 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 36361 invoked by uid 99); 9 Oct 2008 13:51:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Oct 2008 06:51:21 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_SECURITYSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sorinm@gmail.com designates 209.85.132.241 as permitted sender) Received: from [209.85.132.241] (HELO an-out-0708.google.com) (209.85.132.241) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Oct 2008 13:50:19 +0000 Received: by an-out-0708.google.com with SMTP id b2so1155ana.102 for ; Thu, 09 Oct 2008 06:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=v5W44lu9hJcGrcixV+gljnP14bJo7L8OLU2zSeCeq7w=; b=qEFOkvRDsS6N4ojprBNYGWazFBz9IVub1yELSvEl6NEN3huttmVvhJ1+cCT3VbEFA7 JdBXptotFunxFvj+GlFS0lmgaHfcCRiqTS4pmysYbJ+GqXH8tkpN/PCElraHWFQz9sZb Sreeng0d3Qw+o7aHMDMjzucdDAbPPnnaB5VFY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=tQiPuIxpDXHrISd0pjZZV21UAtjGJEtmEOFwNfRxT0V2u77xuU8+unJ38n2YYDr8V7 fLEBlBaFpn1OddRzAn5tPLRleiic3dXTC1kX4tX8lJjrqV7NeD7y74McygEBw9EX1Q6J oKypweaYQM4Zpb1Pf4LU+UAG8+NuXiqvPBI9Y= Received: by 10.143.3.4 with SMTP id f4mr55119wfi.233.1223560237799; Thu, 09 Oct 2008 06:50:37 -0700 (PDT) Received: by 10.143.3.19 with HTTP; Thu, 9 Oct 2008 06:50:37 -0700 (PDT) Message-ID: <20170a030810090650g60d9709dx13b6d0eadf0b8f81@mail.gmail.com> Date: Thu, 9 Oct 2008 15:50:37 +0200 From: "Sorin Manolache" To: modules-dev@httpd.apache.org Subject: Re: number of bytes/packets sent/received In-Reply-To: <6456355d0810090644p3764a436l256b1b097d829532@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6456355d0810090540s30edaabfx9491ba47f2c6b9bf@mail.gmail.com> <20170a030810090611s240ec6f3w7fd5eaf41fb1de7e@mail.gmail.com> <20170a030810090625t44209259v26b4d78be5f94ac0@mail.gmail.com> <6456355d0810090644p3764a436l256b1b097d829532@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Oct 9, 2008 at 15:44, Andrej van der Zee wrote: > Thanks for your reply! > >> >> Giving it a second thought, the problem looks complicated. Such >> filter-based counters would count the traffic of _one_ apache process. >> When you increment the counter, you have to protect it from concurrent >> access by other threads running in the same apache child process. >> Then, before the apache child process exits, you need to add the >> counter to a global counter shared among apache child processes (which >> has to be protected against race conditions as well). It's really >> hairy. Don't do it in apache. >> > > I forgot to mention, but I need the number of packets / bytes per HTTP > request and log it to a database with other information. So I guess > that would take case of all the hairy stuff. I think I will give it a > go as you recommend with an input and output filter that only counts > the bytes and just passes on the data, unless somebody comes with a > better idea (what about the content-length for example, can I trust > this?). I understood from your email that the headers are counted with > it (I never wrote a filter before) and that's exactly what I need. No, the Content-Length doesn't include the size of the headers. While I was typing the message, Dave Ingram's message arrived. I think the solution he proposes is much better. Sorin Sorin