How to best manage a queue of external processes My scenario is a web app that creates jobs that need to be processes by an R script. We are currently have the web app execute a SQL stored proc that executes the R script. However, we quickly realized this is unworkable. The first job eats a lot of memory up and then all subsequent jobs fail. We did set aside 40% of the servers memory for external processes, as described in MSFT's docs here: 

https://docs.microsoft.com/en-us/sql/advanced-analytics/administration/how-to-create-a-resource-pool?view=sql-server-2017

I appreciate any advice or recommendations you may have.
You could have a background job (SQL Agent or other) that runs the stored procedure, ensuring that you only have one instance running at a time.

The web app, instead of directly invoking the procedure, could just write a row to a "job table" or "queue table" and the background process works off of that.