NYCPHP Meetup

NYPHP.org

[nycphp-talk] Writing daemons in PHP

guilhermeblanco at gmail.com guilhermeblanco at gmail.com
Sat Apr 9 19:25:19 EDT 2011


You should look at Gearman project for PHP. =)

http://php.net/manual/en/book.gearman.php
http://www.phpclasses.org/blog/post/108-Distributing-PHP-processing-with-Gearman.html
http://www.slideshare.net/felixdv/high-gear-php-with-gearman
http://weierophinney.net/matthew/archives/240-Writing-Gearman-Workers-in-PHP.html

Cheers,

On Sat, Apr 9, 2011 at 6:44 PM, Rolan Yang <rolan at omnistep.com> wrote:
> I use this:
>
> http://pear.php.net/package/System_Daemon
>
> and it's worked flawlessly for the past 2 years.
>
> ~Rolan
>
> On 4/7/2011 5:38 PM, Gary Mort wrote:
>>
>> Just wondering what, in general, others are using for writing daemons in
>> PHP.
>>
>> Just code it directly using libevent...   or using a framework such as
>> phpdaemon, https://github.com/kakserpom/phpdaemon
>>
>>
>> For a first pass, I need to set up a more intelligent CPULimit app to
>> meet my specific goals.  Since all CPULimit basically does is check all
>> the PID's every 2ms and send out kill to processes with SIGSTOP and
>> SIGCONT - it seems simple to do the same with PHP.
>>
>> Just loop through every 2 ms and when cpu usage is over the threshold,
>> do some quick calcs to determine how many microseconds before the
>> processes can be continued in order to drop the cpu usage below the
>> threshold and use libevent to set the callback time.
>>
>> Granted, this is supposedly "better" to program in C rather than PHP,
>> but since I want to be able to do quick changes and keep the learning
>> curve small, I'd rather do it in PHP until everything has been tweaked
>> and perfected.  Then it's always an option to try using HipHop to
>> convert it.... or if it is running well and doing what is needed, leave
>> it be.
>> _______________________________________________
>> New York PHP Users Group Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>> http://www.nyphp.org/Show-Participation
>>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>



-- 
Guilherme Blanco
Mobile: +55 (16) 9215-8480
MSN: guilhermeblanco at hotmail.com
São Paulo - SP/Brazil



More information about the talk mailing list