5
votes

I am running Gearman server along with Gearman Manager, with their PHP interface. the setup is as shown below. The Gearman server could be either on one of the two machines or on a third machine.

enter image description here

For my implemnetation, I need to be able to tell from one worker if another worker on the same machine is busy or free. e.g. I should be able to tell if Worker 2 on machine 1 is free from Worker 1 on machine 1. Can that be done either with the PHP APIs or the telnet interface?

Possible Solution

On the Telnet interface the 'WORKERS' command gives you a list of all the workers attached to the server along with their ips. I believe I can use that to do my task. I found a PHP script to get this information using telnet.

1

1 Answers

0
votes

I suspect your proposed solution is less than optimal, however, you didn't provide any information about the problem you are trying to solve so I'll try to answer the question as is. You will need to communicate between your workers and telnet is probably a less than ideal solution. You may want to look into something like Redis' pub/sub event system for inter-process communication. Just have workers publish and subscribe to a channel that is based on the machine name and design a simple method to broadcast the workers state.