codeigniter-queue-worker
codeigniter-queue-worker copied to clipboard
Added public method psPathFilter to include a grep with FCPATH in psCmd and psInfoCmd
Hi, I have multiple instances of same web application on the server, in differents vhosts, when a "worker" of an instance start and there is a the same "worker" active in another instance, the last called don't start, because ps ${search} find the PID of the first instance.
To prevent that, I wrote a small patch, I created a public method to set the behaviour, becase in some situation multiple instances use same 'resources' and only one worker must run.
I used FCPATH to discriminate the vhost where worker is running.
Hi @ig0rb,
Thank you for your request.
In general, there is only one worker instance.
If you use multiple instances to run workers, you should detect the same queue and treat each as a consumer.
Yes I agree, but in some situation each web application have it's own queue not shared, different database, different settings.
In a specific case I have a mutitenant environment, where each instance is in a different vhost and ps result see the process of other instance.
Anyway I don't know how my 'patch' will work on windows.
Hi @ig0rb,
In your case, what queue you are using?
Because the queue service is separate from the worker instances, these instances are irrelevant.
Thanks
Hi I wrote a simple queue manager serializing a multidimensional array...
class GenericQueueJob { protected $f_queue = APPPATH.'spools/jobs.queue.bin'; protected $fh = NULL; protected $locked = 0;
On same webserver multiple instances of same codeigniter installation, because every app is used to manage different stuff...
For example one queue communicate with a customer's device via http API.
Each installation have 'his' device configured for queue and his spool.
the result of ps is: 1163 ? S 0:00 php /var/www/html/ctrl/cust015/index.php ussdWorker/work
If there is another another working from another vhost it doesn't start, because psFilter search only "ussdWorker/work".
I don't want to have a single queue manager, because, each customer can 'reset', flush', download, his queue and i don't want to share a signle queue for every installation.
@ig0rb,
I don't want to have a single queue manager, because, each customer can 'reset', flush', download, his queue and i don't want to share a signle queue for every installation.
I think you can refer to the Kafka architecture, the queue is used as a standalone service.
If each server owns each queue, I think it doesn't have to synchronize each server's workers.
Yes each instance don't need to be syncronized with others.