利用Gearman,筹建异步分布式计算平台
利用Gearman,搭建异步分布式计算平台分布式计算平台extensionperlfunctionphpGearman的介绍主页在http://g
利用Gearman,搭建异步分布式计算平台
分布式计算平台extensionperlfunctionphp
Gearman的介绍
主页在http://gearman.org/index.php, 它的主要优点有:
1.[xhtml]
Couldn't?find?uuid/uuid.h??[xhtml]gearmand:?error?while?loading?shared?libraries:?libgearman.so.1:?cannot?open?shared?object?file:?No?such?file?or?directory??[xhtml]Fatal?error:?Class?'GearmanWorker'?not?found???[php]use?Gearman::Worker;??my?$worker?=?Gearman::Worker->new;??$worker->job_servers('127.0.0.1:4730');??$worker->register_function("reverse",??/&test);??$worker->work?while?1;????sub?test?{??????return?join('?',?$_[0]->handle,?$_[0]->arg,?'world',?"/n");??}??[php]use?Gearman::Client;??my?$client?=?Gearman::Client->new;??$client->job_servers('127.0.0.1:4730');????#?running?a?single?task??my?$result?=?$client->do_task("reverse",?"hello");?#?return?a?scalar?reference??print?$$result;???Gearman异步模式的实现
在Perl的Gearman::Client模块里已经实现了异步的方法,采用dispatch_background时client请求不会等待worker的响应就立即返回了。http://blog.csdn.net/hfahe/article/details/5519582