T
T
tfanialn2021-09-24 14:13:56
ubuntu
tfanialn, 2021-09-24 14:13:56

Laravel queues on another server?

The crux of the issue is a Laravel project on a server with Ubuntu. There are many queues in them, tasks are executed slowly for a long time, respectively, if many workers are running, the server starts to hang. There is a great desire to transfer these jobs to another server so that they do not interfere with the main one, but work there. At the same time, I do not want to make a full-fledged application on the second server. It is necessary to somehow simply organize the process, that is, the main server creates a job, another server executes it and writes what is needed in the database. I also don’t want to spread the application code across two servers, it is desirable that the code be the same. I hope it's clear.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2021-09-24
@tfanialn

So a job can use anything to get executed, how do you want it to work without code? If you need some kind of service, get the model from the database, save it to the database, etc.
To raise queues on another server, you need to set up a common radish and a common database, then the jobs will be balanced between servers.
But you need to fully deploy the application on both servers.
Of course, you can make separate consumers on a separate server so that there is only one script there, but this will work completely outside of Laravel. Those. you will not be able to use services, eloquent, models and everything else from laravel. What's the point.
It's time to explore the deployment to multiple servers. Or rather, in principle, automatically raise the deployment, and how many servers there need to be deployed, he does not care.

V
Vyacheslav Plisko, 2021-09-27
@AmdY

In fact, jobs should be run in separate containers. Interaction goes through a rabbit and a DB. At what it can be the same monolith, it is not necessary to divide it into microservices, all the same, containers with queues do not look at the web through a web service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question