ring in production?

It seems that people sugget the use of lein-ring for a no-brainer deploy of a Compojure application. Isn't it just meant for development? I've benchmarked the same app running with lein-ring vs packed by leiningen with uberjar (executed with java -jar, it contains ring-jetty).

To my surprise, the performance is even slightly better with lein-ring! Am I missing something?

How can i keep on using lein-ring but avoid printing out stacktraces in case of exceptions and avoid checking for modified files?

Thanks


lein-ring will allow you to readily produce a war file for deployment to a container (and serves as the basis for lein-beanstalk for easy deployment to Amazon's Elastic Beanstalk), but I'm not aware of a common practice of using it in production. Certainly an option, but probably rarely the best one. I'd recommend deploying using the methods recommended by your host / container; this will most often mean deploying a war (which lein-ring can be used to build) or using some variety of containerless deployment with an embedded Jetty instance (as on Heroku with Leiningen).

If you do want to use lein-ring in production but want to turn off its development-time capabilities (code reloading, stack trace rendering, etc), you must set the RING_ENV environment variable to production , eg:

export RING_ENV=production
lein ring ...

lein-ring is a development only tool. Of course the way you package and deploy your application will have an impact on performance. Are you actually comparing apples to apples here?

I have found significant differences in lein-ring and even just an embedded jetty deployment.

This being said, with lein-ring you miss out on a ton of stuff. Putting your application in a proper container will allow for a lot more in terms of opertional support and monitorability.

链接地址: http://www.djcxy.com/p/9780.html

上一篇: Xpath支持在我的浏览器中?

下一篇: 在生产环?