Compojure:lein-ring 正在生产中?

发布于 2024-12-10 02:32:08 字数 262 浏览 0 评论 0 原文

人们似乎建议使用 lein-ring 来轻松部署 Compojure 应用程序。不就是为了发展吗?我对使用 lein-ring 运行的同一个应用程序与由 leiningen 使用 uberjar 打包的应用程序进行了基准测试(使用 java -jar 执行,它包含ring-jetty)。

令我惊讶的是,使用 lein-ring 时性能甚至略好!我错过了什么吗?

我怎样才能继续使用 lein-ring 但避免在出现异常时打印堆栈跟踪并避免检查修改的文件?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷乱花海 2024-12-17 02:32:09

lein-ring 将允许您轻松生成一个 war 文件以部署到容器(并作为 lein 的基础-豆茎
以便轻松部署到 Amazon 的 Elastic Beanstalk),但我不知道在生产中使用它的常见做法。当然是一种选择,但可能不是最好的选择。我建议使用主机/容器推荐的方法进行部署;这通常意味着部署一场战争(可以使用 lein-ring 来构建)或使用某种带有嵌入式 Jetty 实例的无容器部署(如 Heroku 与 Leiningen)。

如果您确实想要在生产中使用 lein-ring 但想要关闭其开发时功能(代码重新加载、堆栈跟踪渲染等),则必须设置 RING_ENV 环境变量到生产,例如:

export RING_ENV=production
lein ring ...

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, e.g.:

export RING_ENV=production
lein ring ...
与君绝 2024-12-17 02:32:09

lein-ring 是一个仅供开发的工具。当然,打包和部署应用程序的方式会对性能产生影响。您实际上是在比较苹果与苹果吗?

我发现 lein-ring 甚至只是嵌入式码头部署之间存在显着差异。

话虽这么说,有了 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文