gearman可以实现:
1 语言间的通信
2 分布式任务的调度
gearman的原理
gearman 的详细说明:
http://www.cnblogs.com/cocowool/archive/2011/08/18/2145144.html
http://blog.163.com/lgh_2002/blog/static/44017526201281394856306/
gearman worker:
$worker = new GearmanWorker();
$worker->addServer("127.0.0.1", 4730);
$worker->addFunction( "upper", array(new MyClass(), "toUpper"));
while($worker->work());
class MyClass{
public function toUpper($job){
return strtoupper($job->workload());
}
}
gearman client:
echo "client test:";
$client = new GearmanClient();
$client->addServer('127.0.0.1', 4730);
echo $client->do('upper', "hi beck");
本文介绍 Gearman 的基本原理及其在分布式环境中实现任务调度的应用。Gearman 支持跨语言通信,通过示例代码展示了如何使用 PHP 实现 worker 和 client 的交互。
265

被折叠的 条评论
为什么被折叠?



