What is the best way to setup a web application to check free RAM on the server and keep users into a waiting queue until sufficient RAM is available again?
I think fetching free RAM on server would only be possible using exec(), right?
I want to enforce this system in my web application as my web application makes use of a lot of RAM and during high traffic i dont want my server to get halted.
Thanks.
You should separate the part of your code that handles web requests and the part that does the resource-intensive work. When you get the web request, put the job into a queue, which separate processes pull jobs off of and do the work. You can have the user on the webpage poll your server every X seconds with AJAX until their job has been processed then update their page.