NYCPHP Meetup

NYPHP.org

[nycphp-talk] Writing daemons in PHP

Rolan Yang rolan at omnistep.com
Sat Apr 9 17:44:55 EDT 2011


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
>



More information about the talk mailing list