rexyai / RestRserve

R web API framework for building high-performance microservices and app backends
https://restrserve.org
276 stars 32 forks source link

Concern on 500 errors due to insufficient memory #14

Closed jaehyeon-kim closed 6 years ago

jaehyeon-kim commented 6 years ago

Hi

It's quite interesting to find this package. I have been using the built-in HTTP server of Rserve at work and it is definitely more performant than Plumber, RApache and OpenCPU.

Rserve forks processes effectively but it doesn't check if the machine has enough resources. Therefore it can lead to 500 error when it fails to fork a process due to insufficient memory.

Initially I looked into NGINX if there is a way to queue requests but only the paid edition has that functionality. On the other hand, HAProxy allows to limit # processes that can be handled. It become more effective after the API is 'proxy'-ed by HAProxy in a linked Docker environment.

I hope more deployment examples are introduced in the long run.

Regards Jaehyeon

dselivanov commented 6 years ago

Hi Jaehyeon. Thanks for your comment. I'm aware of such behaviour - I've seen discussion here https://github.com/s-u/Rserve/issues/91. I agree with Simon - there is nothing to do on Rserve/RestRserve side - we can't predict how much resources user code will need. Anyway in most cases applications are used with load balancer (I use HAproxy as well) and certain limitation can be put there. I will add note to "known limitations" section.