Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ig0rb
Copy link

@ig0rb ig0rb commented Dec 13, 2019

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
Copy link
Owner

yidas commented Dec 15, 2019

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
Copy link
Author

ig0rb commented Dec 17, 2019

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
Copy link
Owner

yidas commented Dec 24, 2019

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
Copy link
Author

ig0rb commented Dec 26, 2019

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
Copy link
Owner

yidas commented Dec 28, 2019

@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
Copy link
Author

ig0rb commented Jan 3, 2020

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

@devvspl
Copy link

devvspl commented Jul 4, 2024

Hello @yidas @ig0rb I'm working on queue processing. Could you share the complete code with me ([email protected])? 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