codeigniter-queue-worker icon indicating copy to clipboard operation
codeigniter-queue-worker copied to clipboard

Added public method psPathFilter to include a grep with FCPATH in psCmd and psInfoCmd

Open ig0rb opened this issue 5 years ago • 7 comments

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.

ig0rb avatar Dec 13 '19 17:12 ig0rb

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.

yidas avatar Dec 15 '19 02:12 yidas

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.

ig0rb avatar Dec 17 '19 08:12 ig0rb

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

yidas avatar Dec 24 '19 02:12 yidas

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 avatar Dec 26 '19 23:12 ig0rb

@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.

yidas avatar Dec 28 '19 14:12 yidas

Yes each instance don't need to be syncronized with others.

ig0rb avatar Jan 03 '20 00:01 ig0rb