gecche / laravel-multidomain

A Laravel extension for using a laravel application on a multi domain setting
MIT License
842 stars 105 forks source link

Worker with 50 domains - memory leak? one horizon to many clients? #107

Open raulamoretti opened 9 months ago

raulamoretti commented 9 months ago

Hey Giacomo!

Some time ago I opened a issue to config horizon.

Now I have a problem with memory / queues.

We run 70 domains, with huge queues, 4 queues in small clients e 18 queues in higher clients.

With this we spend 30 Gigabits of memory and CPU.

I think in a special method to decrease PHP footprint in worker memory or a common queue to many clients.

image image
gecche commented 8 months ago

Hi, sorry for the delay... I don't think there is a memory leak in the package as the worker is the Laravel worker itself. Maybe Horizon? But I don't know. I believe that If you want "a special method to decrease PHP footprint in worker memory", I think that you should think it for the standard Laravel worker. However, the 30 GB of memory usage is uniformely distributed across the worker processes? Have you tried memory usage, by using N Laravel installations, one for each domain?

For the second idea "a common queue to many clients", I think that you can't do this forking my package, but you could consider to rethink your application by building a "central" module which process the jobs of all your domains. But generally is not that simple :)

Anyway, I leave the issue open for quite bit: let's see if someone has some idea to improve the situation.

Thanks

Giacomo