Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 17650 invoked from network); 17 Apr 2009 18:57:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Apr 2009 18:57:35 -0000 Received: (qmail 56150 invoked by uid 500); 17 Apr 2009 18:57:34 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 56100 invoked by uid 500); 17 Apr 2009 18:57:34 -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 56090 invoked by uid 99); 17 Apr 2009 18:57:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2009 18:57:34 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=MSGID_MULTIPLE_AT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.23.114.76] (HELO smtp.decimal.pt) (195.23.114.76) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2009 18:57:23 +0000 Received: from smtp.decimal.pt (localhost.localdomain [127.0.0.1]) by smtp.decimal.pt (Postfix) with ESMTP id 9351EB6C98 for ; Fri, 17 Apr 2009 19:58:15 +0100 (WEST) Received: by smtp.decimal.pt (Postfix, from userid 1001) id 863B1B6CA1; Fri, 17 Apr 2009 19:58:15 +0100 (WEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on lira X-Spam-Level: Received: from pcjorge (87-196-9-215.net.novis.pt [87.196.9.215]) by smtp.decimal.pt (Postfix) with ESMTPA id 69171B6C98 for ; Fri, 17 Apr 2009 19:58:14 +0100 (WEST) From: "Jorge Bastos" To: References: <003001c9a7cd$16250930$426f1b90$@com.au> <49C11314.8020700@dmi.me.uk> <000301c9a82f$b993f2e0$2cbbd8a0$@com.au> <49C1DFC3.1050202@dmi.me.uk> <23103676.post@talk.nabble.com> <000001c9bf8d$d7d404a0$877c0de0$@jorge@decimal.pt> In-Reply-To: <000001c9bf8d$d7d404a0$877c0de0$@jorge@decimal.pt> Subject: RE: MySQL Virtual Host and Traffic Module Date: Fri, 17 Apr 2009 19:57:04 +0100 Message-ID: <000a01c9bf8e$4cba5170$e62ef450$@jorge@decimal.pt> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Acm/jXTwr3PR/9dCSCSXoJo1casPPAAAE3fwAAAf+bA= Content-Language: pt X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, MSGID_MULTIPLE_AT autolearn=no version=3.2.5 Ops! Didn't saw that It was in the end of the email already :) > -----Original Message----- > From: Jorge Bastos [mailto:mysql.jorge@decimal.pt] > Sent: sexta-feira, 17 de Abril de 2009 19:54 > To: modules-dev@httpd.apache.org > Subject: RE: MySQL Virtual Host and Traffic Module > > http://www.dmi.me.uk/code/apache/mod_sqltemplate/ > > this module will do the work for you, I still haven't got time to test > it > but for sure will do. > > > > > -----Original Message----- > > From: Eldho [mailto:eldhokpaul@gmail.com] > > Sent: sexta-feira, 17 de Abril de 2009 19:49 > > To: modules-dev@httpd.apache.org > > Subject: Re: MySQL Virtual Host and Traffic Module > > > > > > Hi Vaughan, > > > > What is the status of this module. Actually I am searching for a > module > > that write all the vhost configuration to a database and read it > from > > db > > also. > > > > thanks. > > > > Eldho > > > > > > > > Dave Ingram wrote: > > > > > > Hi Vaughan, > > >> Thanks for the response. I haven't thought of doing the SQL query > > the way > > >> you suggested, however I agree that it will cause unnecessary load > > on > > >> busy > > >> servers and I would like to keep this as efficient as possible. > > >> > > >> The second option sounds more reasonable. I have already used > > threading > > >> to > > >> make a function which ticks on a configurable interval so I > suppose > > each > > >> child process would dump data for each of its vhosts at this > > interval, > > >> using > > >> a query similar to what you have suggested. > > >> > > > I think that's probably the most sensible approach. It does mean > that > > > you won't have up-to-the-moment statistics, and I would guess that > > you'd > > > have to play about with different intervals as the number of hosts > > grows > > > in order for it to scale. You may also want to consider somehow > > > staggering the updates, so they don't all happen at once. It may > also > > be > > > advisable to perform an UPDATE rather than an INSERT... ON > DUPLICATE > > > UPDATE once your module knows that there is a value that can be > > updated > > > (i.e. after the query has run once in the simple case, or once this > > > day/hour/etc in the complex case). > > > > > >> I think I might go with the second option for the time being and > see > > how > > >> it > > >> goes but I am still interested to know if there is a way to store > > per > > >> vhost > > >> data across children? > > >> > > > I would be interested to know how things turn out, and I'd be > > interested > > > to see the final module. I've been thinking about writing a custom > > > bandwidth monitoring/limiting module myself, but if I don't need to > > > reinvent the wheel... > > > > > > I'm afraid I can't answer this question in a definite way, though. > > One > > > module that should store per-vhost data like this is mod_cband > > > , so that might be worth > > looking > > > into. > > > > > > As a side note, I'd be interested to know how you create/template > the > > > virtual hosts. I myself have written a database-backed templating > > module > > > that could be used for virtual hosting > > > (http://www.dmi.me.uk/code/apache/mod_sqltemplate/) and I'm curious > > to > > > see other approaches. > > > > > > Thanks, > > > > > > > > > Dave > > > > > >> > > >> Thanks, > > >> Vaughan > > >> > > >> -----Original Message----- > > >> From: Dave Ingram [mailto:dave@dmi.me.uk] > > >> Sent: Thursday, 19 March 2009 12:28 AM > > >> To: modules-dev@httpd.apache.org > > >> Subject: Re: MySQL Virtual Host and Traffic Module > > >> > > >> Vaughan, > > >> > > >> > > >>> What I have so far are 2 filters which gather the inbound traffic > > and > > >>> outbound traffic for each transaction. These work ok and when > > logging > > >>> transactions to file all of the in/out byte amounts appear to be > > >>> correct. > > >>> The first problem however, is that each child has its own set of > > memory > > >>> > > >> and > > >> > > >>> therefore keeps its own totals per virtual host. This also means > > that > > >>> multiple logging events occur for each transaction. I could just > > log > > >>> this > > >>> all to database but it would 1) be inefficient and 2) cause the > > size of > > >>> > > >> the > > >> > > >>> database to grow quite quickly. > > >>> > > >>> > > >> > > >> It sounds to me like you could go two ways with this. I don't know > > the > > >> format of your database table, but it should be possible to update > > it > > >> atomically using something like: > > >> > > >> INSERT INTO bandwidth (vhost_id, bw_in, bw_out) VALUES (42, 1124, > > >> 5023409) ON DUPLICATE KEY UPDATE bw_in = bw_in + 1124, bw_out = > > bw_out + > > >> 5023409 > > >> > > >> but that could lead to a lot of load. Another way might be for > each > > >> child to collect statistics and only flush to the database > > periodically, > > >> say every 30 seconds (perhaps configurable on a per-vhost basis, > so > > that > > >> load-heavy sites could have larger update intervals). It would > still > > be > > >> possible to use the query above though. > > >> > > >> This query could probably even be updated to split statistics on a > > >> date/time basis, if you require more granular reporting. > > >> > > >> Or have I missed/misunderstood something? > > >> > > >> > > >> Dave > > >> > > >> > > > > > > > > > > > > > -- > > View this message in context: http://www.nabble.com/MySQL-Virtual- > Host- > > and-Traffic-Module-tp22579200p23103676.html > > Sent from the Apache HTTP Server - Module Writers mailing list > archive > > at Nabble.com. >