If a server receive multiple high memory consuming requests, the server will queue the requests or put all the requests in RAM causing problems to server.
I understand that I can limit requests with ‘memory_limit’ in php.ini, but for example if a server with 4GB RAM and memory_limit 1024M receive at same time multiple requests that in total exceed the value of RAM what will happen?
2
Answers
The server will try to do all task at the same time.
So if this is an issue you will need to optimize memory consuming task or use some tool to store request in the queue.
The example is maybe a composer require command. If the process requires more memory than server has, a process will be simply killed.
If server receiving high memory consume request then you may get error like “out of memory” in log or browser.
You need to debug and find out in the code where it takes much time & consuming memory. Based on that try to optimize the code ( optimization is depends on code structure).