Hosting a website with FilamentPHP backend and Livewire frontend in a production environment
Hi all, I have been developing a website with the TALL stack, using FilamentPHP as the backend.
First off thanks to all the devs for the hard work on the software, I'm really enjoying the development experience!
My question is regarding hosting a website like this in a production environment. What would be the minimum requirements for the server? Having a hard time finding info about this. Specifically, I'm running into a PHP memory limit occasionally. Currently it is set at 1 GB.
FYI, I have also implemented the Filament Fabricator package, which I'm using to make all my pages customizable in the backend. However, during the caching of these routes I'm often hitting the PHP memory limit (there are about 76,000 pages).
As such, I requested my server provider if they could up the limit to 3GB.
Now, the response I got was, 'we're not going to up the memory_limit to 3GB, that's just unrealistically high and would destabilize the server'. I would need to 'cut the process into smaller parts' to keep the memory usage lower.
Since I have no reference for what the baseline memory usage is for such a website I was wondering if anyone could jump in that knows more about it? I'd like to know if it's realistic to have the memory_limit under 1GB before changing anything.
Thanks in advance!
Solution:Jump to solution
That isn't much at all, I'm rather concerned why you are using 1GB of ram.
I would advise you use debug bar or telescope and look at the resource usuage to optimise your queries as I susepct you maybe not using closure on your options for selects, or having repetive queries, or any counts are not loaded in with edgar loading etc....
13 Replies
1... why are you running out of memory? If you have debug mode enabled that'll do it.
Usually, you would just need a basic digital ocean $5 server, filamentphp.com runs off that, but I think recently we moved to a 10$ one
I tend to run them on 500mb memory, 1cpu and 2gb ram.
It all depends on what you physically need. You really shouldn't need more than 500mb memory for the application. That seems excessive unless it's a big data intesive app.
I have made sure to turn debug mode off.
Well, what's considered a big data intensive app? This website will have a page for each country, state, city in the world, with customizable blocks for each page in the backend.
Will that do it?
Solution
That isn't much at all, I'm rather concerned why you are using 1GB of ram.
I would advise you use debug bar or telescope and look at the resource usuage to optimise your queries as I susepct you maybe not using closure on your options for selects, or having repetive queries, or any counts are not loaded in with edgar loading etc.
I would class a large app, being millions of rows of data and requiring bespoke re-processing of said data for certain functionality.
It's the caching process of filament fabricator, I think. It caches all page the routes I have created at once, so I will probably have to dive into the plugin code a bit. Atleast I know it should be possible with 1GB or memory now, ty!
Since it only happens after clearing the route cache. Once they're all cached, everything works fine.
Ahh ok, might be worth digging into it more to optimise it. But yeah it should be fine on a basic $5 do server, maybe you could run a CLI command to cache your routes etc
Yeah unfortunately I'm stuck with a different server construct which my employer decided to use before I started here. Some kind of cluster environment, unsure of the specifics and I have to ask everything. π Thank you for your time btw.
I'll mark it as solved for now since you've pointed me in the right direction. Other insights are always welcome ofcourse!
Ok so you could be limited by those servers... I had the same with an employeer and the fast servers were 375% slower than a $5 DO server.
Hmm interesting, I'll see if I can compare the server specs with a DO one.
It's not always the specs, it can be the implementation. Best bet is to run a test on each performance wise and compare. You can be suprised.
I had NMVE, 4 dedicated cores, 16GBram and it's max throughput was 150mb/sec... Theory on spec's it was hugely faster, reality was it was badly configured in a bad stack.
Might be worth comparing them in that case. Curious if that's the case here as well
Always worth a test
Hopefully it's worth it to my employer as well π