Gearman with multiple servers and php workers

后端 未结 5 1918
误落风尘
误落风尘 2021-02-02 01:57

I\'m having a problem with gearman workers running on multiple servers which i can\'t seem to solve.

The problem occurs when a worker server is taken offline, rather tha

5条回答
  •  滥情空心
    2021-02-02 02:49

    Further to @Darhazer 's comment above. We found that as well and solved like thus :-

    // Gearman workers show a strong preference for servers at the end of a list so randomize the order
    $worker = new GearmanWorker();
    $s2 = explode(",", Configure::read('workers.servers'));
    shuffle($s2);
    $servers = implode(",", $s2);
    $worker->addServers($servers); 
    

    We run 6 to 10 workers at any time, and expire them after they've completed x requests.

提交回复
热议问题