-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Is there any reason for creating a new connection for each enqueued job or each try to get a jobstatus?
44340/562347 [===>----------------------------------------------] 7% Elapsed: 4 mins
[pid 5732] connect(9, {sa_family=AF_INET, sin_port=htons(4730), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
44341/562347 [===>----------------------------------------------] 7% Elapsed: 4 mins
[pid 5732] connect(9, {sa_family=AF_INET, sin_port=htons(4730), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
44342/562347 [===>----------------------------------------------] 7% Elapsed: 4 mins
[pid 5732] connect(9, {sa_family=AF_INET, sin_port=htons(4730), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
44343/562347 [===>----------------------------------------------] 7% Elapsed: 4 mins
[pid 5732] connect(9, {sa_family=AF_INET, sin_port=htons(4730), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
With the default behaviour I get issues with many jobs (like 3000 per second) because of an unreachable (busy or out of sockets/fd/whatever) jobserver (connect returns -EADDRNOTAVAIL).
Maybe something like this could be a better way:
219 private function doEnqueue(array $worker, $params, $method, $unique)
220 {
221 if(!$this->gearmanClient) {
222 $this->gearmanClient = new \GearmanClient();
223 $this->assignServers($this->gearmanClient);
224 }
225
226 return $this->gearmanClient->$method($worker['job']['realCallableName'], $params, $unique);
227 }
But I have no clue how to check for a valid connection - I just found the ping() method...