php – Multiple App Laravel using the same job table

Question:

I have in my scenario 3 http servers running the same Laravel application and sharing the same Database, where the first server performs LoadBalance using nginx , basically with the same load weight.

The application works with several job queues using the drive database in the "jobs" table. The only server that processes the jobs ( php artisan queue:listen ) is app1.

I would like to know if there is any contraindication about processing the jobs on other servers as well and if anyone has had any similar experience.

Answer:

As long as the balance is right, I don't see any problems.

I believe you should do a comparative analysis:

  • If I run a single application on a single queue server, and this application/server supports, say, 10K (ten thousand) queues per hour…compared to three applications running a single queue server, is the volume the same? So there is no contraindication

  • Now, the possibility of using different connections for different queues is just so that you can balance correctly, again let's say, if the three applications run 2k queues, and a single one runs 30k queues, it is more likely that it will be necessary to balance with queue execution in different connections/servers for this single application as opposed to the three mentioned.

I hope it was clear that the evaluative issue here is the demand/volume of job execution and the computational cost (processing+memory) required by each job, to really identify if there is a contraindication, as you mentioned, in running queues of multiple systems on a single server/connection.

For those who need more understanding on how to configure different connections for execution queues in Laravel, access the documentation section

Scroll to Top