Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 55188 invoked from network); 3 Apr 2008 06:40:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 06:40:11 -0000 Received: (qmail 24386 invoked by uid 500); 3 Apr 2008 06:40:10 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 24366 invoked by uid 500); 3 Apr 2008 06:40:10 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 24357 invoked by uid 99); 3 Apr 2008 06:40:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2008 23:40:10 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [213.239.154.11] (HELO adonis.tweakers.net) (213.239.154.11) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 06:39:28 +0000 Received: from localhost (localhost [127.0.0.1]) by adonis.tweakers.net (Postfix) with ESMTP id A581C5DC269 for ; Thu, 3 Apr 2008 08:39:38 +0200 (CEST) Received: from adonis.tweakers.net ([127.0.0.1]) by localhost (adonis.tweakers.net [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 06830-09 for ; Thu, 3 Apr 2008 08:39:25 +0200 (CEST) Received: from [10.0.0.153] (office.tweakers.net [84.245.2.46]) by adonis.tweakers.net (Postfix) with ESMTP id C86645DC26A for ; Thu, 3 Apr 2008 08:39:25 +0200 (CEST) Message-ID: <47F47BA0.90309@tweakers.net> Date: Thu, 03 Apr 2008 08:39:28 +0200 From: Arjen van der Meijden User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: Basic queue concept References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org On 3-4-2008 7:47, Joel Poloney wrote: > 1. I have a consumer in a while(1) { //consume } fashion. That would > basically run forever. As I understand it, this is the way most web servers > work (at the core, core level). In this model, I would have to make sure > that the consumer was always running (perhaps do 3-way redundancy and have 3 > consumers doing this). My concern with this model is that if I implement > this in PHP, I'm afraid of memory issues and so on. I don't necessarily > trust a PHP script to run in a while(1) fashion forever. I have this set-up, with four different consumers with varying load (two do more than two million entries per day, one only a few hundred and one a few ten thousand). I have seen no memory leak whatsoever from them. The only major memory leakage from php I've seen recently was with SimpleXML, so if you intend to do XML-processing with those scripts, use DOM or expat. Ironically, ActiveMQ leaks memory in my setup and therefore has a lower uptime than my php-consumers :X > 2. I could somehow get the queue size and batch process these. Basically, > get the queue size (say it was 200 entries), consume 200 messages and then > the PHP script would end. Then you would have this script in a cronjob that > runs every x amount of time. > > Unfortunately, I have to implement this in PHP. So, I'm not really sure > which way would be the proper way to go about doing this. If any one has any > thoughts or comments, it would be greatly appreciated. I would go with 1. But you may want to add some control-code to ensure you can easily and cleanly kill your scripts. In my code, I added a few signal handlers, so the consumer first finishes its most recent job and then dies. But than the fread-calls in the Stomp-implementation won't get interrupted. So I've a 'kill'-message for that situation, so my consumer dies as soon as its either blocked in fread waiting for a new message or right after its current job. Best regards, Arjen