Skip to content

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

Open
ig0rb wants to merge 1 commit into
yidas:masterfrom
ig0rb:hotfix/psCmd
Open

Added public method psPathFilter to include a grep with FCPATH in psCmd and psInfoCmd#5
ig0rb wants to merge 1 commit into
yidas:masterfrom
ig0rb:hotfix/psCmd

Conversation

@ig0rb

@ig0rb ig0rb commented Dec 13, 2019

Copy link
Copy Markdown

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.

@yidas

yidas commented Dec 15, 2019

Copy link
Copy Markdown
Owner

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.

@ig0rb

ig0rb commented Dec 17, 2019

Copy link
Copy Markdown
Author

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.

@yidas

yidas commented Dec 24, 2019

Copy link
Copy Markdown
Owner

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

@ig0rb

ig0rb commented Dec 26, 2019

Copy link
Copy Markdown
Author

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.

@yidas

yidas commented Dec 28, 2019

Copy link
Copy Markdown
Owner

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

@ig0rb

ig0rb commented Jan 3, 2020

Copy link
Copy Markdown
Author

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

@devvspl

devvspl commented Jul 4, 2024

Copy link
Copy Markdown

Hello @yidas @ig0rb I'm working on queue processing. Could you share the complete code with me (kdevendra7999@gmail.com)? I'm having trouble understanding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants