Reputation: 5760
developing with Laravel 5 some times I encountered errors like Allowed memory size of .... bytes exhausted ... trying to allocate ...
Usually I faced this kind of error along with long resultsets using Eloquent / Models or using Flysystem to upload large files (sometimes chunking is not enough to have it solved, Lrvl's components bug w/ memory leaks?)
Sometimes I solved it by performing the same actions but with a "lower level" functionalities. (i.e. avoid using Builder/Eloquent in favour of raw queries)
But definitely I end up solving it, by increasing php allowed memory limit.
I'd like to know If there's a minimum suggested PHP config for memory_limit (default set is 128MB) in order to have enough room to use hi-level Laravel5 functionalities.
Upvotes: 0
Views: 3488
Reputation: 19139
Answering a question like this is a little difficult, since the answer really depends on your app. If you're doing any heavy lifting, like image manipulations, then you'll need more memory in those situations.
Having said that, from my experience optimizing a Laravel app on Heroku, I've found that a memory limit of 64M
is perfect. The default memory limit on Heroku for PHP is 128M
, so lowering this allows us to increase our concurrency.
The following graph shows our memory usage for the last 7 days, as reported by New Relic. Even though we're dealing with some optimization problems in our Laravel app, you can see that memory consistently stays below 60MB.
Upvotes: 1