简体   繁体   中英

PHP queue jobs in centOS

I wrote a PHP shell script which include queuing jobs in centOS with 'at' command. The queue jobs may vary in time and contents which means the system need to keep quite a large number of jobs. The application logic will also be a bit difficult to setup with cronjob. Is there a limit in number of queue jobs in centOS or is there any alternative way of queuing jobs?

你可能会考虑写一个“分布式”队列,如dropr或实现AMPQ

A lot of job processes may slow down the whole server. It could happen if there are many of them which started at the same time (or simply work at the same time). If you have 20 hard working processes and only 4 CPU cores they will struggle for CPU and it should switch between them very often.

I'd suggest using a message queue and a pool of workers. You can start from a filesystem queue (or mysql based). You have to install a php lib only, no any extra services. Later if needed, you can switch to real message queue brokers with less effort.

I would recommend using enqueue library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM