Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GM's avatar
Level 8

Massively long jobs causing NGINX to "Gateway not responding"

I have written an accounting system for a rental business which is currently based on Laravel 4.2.

At the end of each month there is a month-end procedure that besides anything else creates all of the creditor remittance advices and owner statements as PDFs using DOMPDF.

The problem I have is that this process is really slow and intensive and as a result the server is timing out. My procedure operates from a single page which is updated via AJAX. I could quite easily change this to a multi-blade process, but I do not think that would necessarily resolve this issue as the timeout is server side.

I have tried issuing the PDF generator via jobs (artisan queues - one per PDF), but the amount of data is too big for the queue to handle in one particular creditors case (their statement is 24 pages long). So instead I tried to step back one layer and make the whole statement generation process a queue. This kind of works, but then I get no feed back to the user telling them when that process is completed.

So what I am looking for is a way of initiating and getting progress back from really really long jobs or an alternative solution. Any suggestions are welcomed.

Thanks in advance

0 likes
3 replies
kfirba's avatar

@Sneeble Hey.

If you want to keep everything in a queue and also be able to get a feedback, use a socket to listen to some port and then you can simply trigger some event that your app will catch using the socket and will then let the user know the progress. You can use Redis and Socket.io for the sockets.

Please or to participate in this conversation.