need help on how to setup multiple php beanstalkd workers

1,457 views
Skip to first unread message

Ebot Tabi

unread,
Dec 18, 2011, 7:26:22 AM12/18/11
to beanstalk-talk
Hi there
i am new to beanstalkd, looking very interesting and right tool for my
php application, will be grateful to know how to setup multiple php
worker running on daemon mode and how to manage them and their memory
usages. i am currently trying to setup with the php client class:
pheanstalk,


Regards

Gordon Heydon

unread,
Dec 18, 2011, 7:59:48 PM12/18/11
to beansta...@googlegroups.com, beanstalk-talk
Hi

You are on the right track. I wrote the beanstalkd integration for Drupal and it is currently being used on Drupal.org

All you need to do us write a cli php application and then to have multiple workers just run the php application multiple times adding watches on the same queues and then when you grab a job from the queue beanstalkd will make sure the job will go to only 1 worker.

The biggest problem is going to be your php since if to connect to a. Existing application it us not built to run forever and sooner or later you will run out of memory and have to restart.

Gordon

Sent from my iPhone

> --
> You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
> To post to this group, send email to beansta...@googlegroups.com.
> To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.
>

Chad Kouse

unread,
Dec 18, 2011, 8:00:29 PM12/18/11
to beansta...@googlegroups.com
I use a process control system called supervisord - haven't had any
issues with it for the past 2 years.

Http://supervisord.org

Then I just make a program group with a line that looks like:
command=/usr/bin/php my_consumer.php

Provides good logging and auto restart

--chad

Daniel Olfelt

unread,
Dec 18, 2011, 8:42:26 PM12/18/11
to beansta...@googlegroups.com

I have to agree with Chad. I also use supervisord. Plus, you can use tools in superlance to add memory management and email alerts.

Daniel

Ebot Tabi

unread,
Dec 23, 2011, 7:48:23 AM12/23/11
to beanstalk-talk
Thanks guys,
i successfully get multiple workers running with supervisor you guys
rocks, now i am working to get inside kohana 2.3.4, isn't easy, but
trying to see how to get it inside so that i can use it the core of
kohana features.

Regards and thanks

On Dec 19, 2:42 am, Daniel Olfelt <dolf...@gmail.com> wrote:
> I have to agree with Chad. I also use supervisord. Plus, you can use tools
> in superlance to add memory management and email alerts.
>
> Daniel
> On Dec 18, 2011 7:00 PM, "Chad Kouse" <chad.ko...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I use a process control system called supervisord - haven't had any
> > issues with it for the past 2 years.
>
> > Http://supervisord.org
>
> > Then I just make a program group with a line that looks like:
> > command=/usr/bin/php my_consumer.php
>
> > Provides good logging and auto restart
>
> > --chad
>

Daniel Olfelt

unread,
Dec 23, 2011, 8:35:35 AM12/23/11
to beansta...@googlegroups.com
It should be fairly easy to do. I am using Kohana 3.2 and it was quite easy to create a daemon controller and run that from the command line. I even implemented some code to prevent it being viewed outside the CLI. Here is a SO article that shows you the basics of running a KO controller from the command line in 2.x and 3.x: http://stackoverflow.com/questions/2133433/kohana-command-line

Hope this helps,
Daniel

Ebot Tabi

unread,
Dec 27, 2011, 9:27:56 AM12/27/11
to beanstalk-talk
thanks Daniel, all you guys rock, your help is awesome guys

On 23 déc, 08:35, Daniel Olfelt <dolf...@gmail.com> wrote:
> It should be fairly easy to do. I am using Kohana 3.2 and it was quite easy
> to create a daemon controller and run that from the command line. I even
> implemented some code to prevent it being viewed outside the CLI. Here is a
> SO article that shows you the basics of running a KO controller from the
> command line in 2.x and 3.x:http://stackoverflow.com/questions/2133433/kohana-command-line
>
> Hope this helps,
> Daniel
>

Steffan Choi

unread,
Dec 30, 2011, 12:07:59 PM12/30/11
to beansta...@googlegroups.com
very nice
--
Best regards,

Steffan Choi


Fred Wang

unread,
Feb 4, 2012, 12:57:16 AM2/4/12
to beansta...@googlegroups.com
This is a patch to added back the -d and daemon 

copy this file to that dir and 
you can use this command to add back the -d args 

patch main.c beanstalkd-daemon.patch


--
You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
To post to this group, send email to beansta...@googlegroups.com.
To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.




--
--Sempr
beanstalkd-daemon.patch

Fred Wang

unread,
Feb 4, 2012, 12:52:43 AM2/4/12
to beansta...@googlegroups.com
This is a patch to added back the -d and daemon 

copy this file to that dir and 
you can use this command to add back the -d args 

patch main.c beanstalkd-daemon.patch


On Sun, Dec 18, 2011 at 8:26 PM, Ebot Tabi <ebot...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
To post to this group, send email to beansta...@googlegroups.com.
To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.




--
------
Fred Wang @ HUST STI



beanstalkd-daemon.patch

Sempr

unread,
Feb 4, 2012, 8:08:24 AM2/4/12
to beanstalk-talk
Sorry, maybe i have send the wrong email.


On Feb 4, 1:57 pm, Fred Wang <iamse...@gmail.com> wrote:
> This is a patch to added back the -d and daemon
>
> copy this file to that dir and
> you can use this command to add back the -d args
>
> *patch main.c beanstalkd-daemon.patch*
> *
> *
>
>
>
>
>
>
>
>
>
> On Sun, Dec 18, 2011 at 8:26 PM, Ebot Tabi <ebot.t...@gmail.com> wrote:
> > Hi there
> > i am new to beanstalkd, looking very interesting and right tool for my
> > php application, will be grateful to know how to setup multiple php
> > worker running on daemon mode and how to manage them and their memory
> > usages. i am currently trying to setup with the php client class:
> > pheanstalk,
>
> > Regards
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "beanstalk-talk" group.
> > To post to this group, send email to beansta...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > beanstalk-tal...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/beanstalk-talk?hl=en.
>
> --
> --Sempr
>
>  beanstalkd-daemon.patch
> 2KViewDownload

Chad Kouse

unread,
Feb 4, 2012, 9:49:18 AM2/4/12
to beansta...@googlegroups.com
Sempr check out supervisord - I use it to manage many php consumer processes.

Supervisord.org

--chad

galo

unread,
Oct 31, 2012, 12:09:00 PM10/31/12
to beansta...@googlegroups.com
Hi,

I have drupal with beanstalkd configured and using the runqueue.sh that comes with the beanstalkd drupal module.
I tested the script and also concluded that the process memory keeps getting bigger and bigger. So I need a way to manage it.

I installed supervisord but unsure as to how it works and how I should configure it to supervise the runqueue.sh script.
Would appreciate it if someone can help me with this.

Thanks

galo

unread,
Nov 1, 2012, 11:10:16 AM11/1/12
to beansta...@googlegroups.com
So in combination with supervisor, the plugin superlance is needed to auto-restart when you reach a certain amount of memory.
Reply all
Reply to author
Forward
0 new messages