Starman eat all the memory with Dancer REST api

1k views Asked by At

I have developed a RESTful application with perl framework Dancer. This application needs almost 1 GB in memory and it takes 30 seconds to be loaded. This application works pretty well in a local test with ./bin/app.pl for a single user, then I try to deploy with Starman (alone or with plackup, with and without keep-alive) for multi-tenant use in several different ways:

plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl 
plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl --disable-keepalive
plackup -E production -s Starman --workers=10 -p 3000 -a bin/app.pl --disable-keepalive --preload-app
starman --workers=10 -p 3000 -a bin/app.pl

Deployment success, but for each query Starman allocates some memory which never free any more, so the application go out of memory very fast.

I read all the documentation of Starman, PSGI and Dancer deployment, included a very nice explanation of NGINX/Starman/Dancer and a similar error with Starman and memory but it doesn't solve this one, because I disable keep-alive and Starman still keep the memory.

Any idea why Starman is eating my memory? Thanks!

1

There are 1 answers

2
Sak On

Finally I found where the memory leak was and I'm sorry Starman to blame you :)

In the program we use a binding library wich works perfect in a regular execution but for a reason I can't figure out, in a multiprocess situation eat all the memory. This bug have been sended to the author of the perl library.