Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48727 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57256 invoked from network); 10 Jun 2010 15:46:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2010 15:46:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.212.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.212.170 mail-px0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:56883] helo=mail-px0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/57-17116-4D8011C4 for ; Thu, 10 Jun 2010 11:46:28 -0400 Received: by pxi6 with SMTP id 6so20763pxi.29 for ; Thu, 10 Jun 2010 08:46:25 -0700 (PDT) Received: by 10.141.125.8 with SMTP id c8mr244496rvn.180.1276184785425; Thu, 10 Jun 2010 08:46:25 -0700 (PDT) Received: from Rasmus-Lerdorfs-MacBook-Pro.local (c-24-7-29-193.hsd1.ca.comcast.net [24.7.29.193]) by mx.google.com with ESMTPS id l29sm131195rvb.16.2010.06.10.08.46.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 10 Jun 2010 08:46:24 -0700 (PDT) Message-ID: <4C1108CE.2090308@lerdorf.com> Date: Thu, 10 Jun 2010 08:46:22 -0700 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Frederic Hardy CC: Brian Moon , internals References: <4C10FD00.1050204@lerdorf.com> <4C1102D4.6080105@moonspot.net> <4C110501.1090906@mageekbox.net> In-Reply-To: <4C110501.1090906@mageekbox.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Gearman support for php-fpm? From: rasmus@lerdorf.com (Rasmus Lerdorf) On 6/10/10 8:30 AM, Frederic Hardy wrote: > On 06/10/2010 17:20, Brian Moon wrote: >> The big difference is that different processes do different jobs in >> Gearman. All PHP workers in fpm just run what ever code is handed to >> them. How do you handle that? > Threading ;) ? Definitely not. Gearman is actually the answer to a lot of problems where people think they need threads. As far as different workers doing different jobs, I don't see the issue here. fpm doesn't need to know the details. All it has to know is that it needs to maintain pools of php processes. Each pool would correspond to a Gearman job. The workers can take care of registering themselves with gearmand. All fpm has to do is start up and maintain N processes per worker pool. [gearman] worker1.path = /path/to/worker1.php worker1.pm = dynamic worker1.pm.max_children = 10 worker1.pm.start_servers = 5 worker2.path = /path/to/worker2.php worker2.pm = dynamic worker2.pm.max_children = 4 worker2.pm.start_servers = 2 ... or however you do multiple nested conf blocks in the fpm .ini file. In fact, this may not need to be gearman-specific. We could just call it cli job management or something like that if we left it completely up to the workers to register with the gearmand. Alternatively, we could make fpm Gearman-aware and register the workers from there, but I am not sure I see much of an advantage to that other than making the worker code slightly simpler. -Rasmus