Coldfusion 到 Rails 的迁移,Java 代码不变
我们使用普通的 Coldfusion 9(提供 html 内容)和 Java(后端工作并连接到 Web 服务)构建了一个 Web 应用程序。我们预计每天约有 50,000 名访客,每分钟最多 200 个请求。生产服务器在 Windows 上运行。 问题是我们因为痛苦的 CF 代码而感到疲倦和愤怒。
我们的想法是用 Ruby on Rails 替换 CF 层。 java 方面应该保持不变,因为它编写得很好、可靠、快速并且覆盖了自动化测试。
所以我的问题是:您将如何详细解决这个问题?
- JRuby 是唯一的选择吗?
- 调用我们的 jar 包 Java 代码是否仍然足够快?
- 切换到 Rails 时是否还需要 Linux? (我不喜欢 Windows 上的 Rails)
- 可扩展性怎么样?您推荐 Sinatra 来处理我们的流量吗?
- 是否可以将此配置放置在云中?
提前致谢
We've built a webapp using plain Coldfusion 9 (serving html content) and Java (backend work and connecting to WebServices). We're expecting about 50 000 visitors a day, up to 200 requests per minute. Production servers are running on Windows.
The problem is that we're getting tired and angry because of painful CF code.
Our idea is to replace the CF layer with Ruby on Rails. The java side should be left untouched, because it's well written, reliable, fast and covered with automated tests.
So my question is: how would you approach this problem in details?
- Is JRuby the only option?
- Will invoking our jar-packaged Java code be still fast enough?
- Is Linux required along with switching to Rails? (I don't like Rails on Windows)
- What about scalability? Do you recommend Sinatra to handle our traffic?
- Will it be possible to place this configuration in a cloud?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您愿意,您应该尝试一下 ColdFusion on Wheels 框架。它的灵感来自 Rails,您可以轻松地将当前应用程序放入框架中,然后慢慢将其转换为 MVC。
请访问:http://cfwheels.org/
If you're willing you should give the ColdFusion on Wheels framework a try. It's VERY inspired by Rails and you could easily drop your current app into the framework and then slowly convert it over to MVC.
Check it out at: http://cfwheels.org/
我在很大程度上同意 Ciaran Archer 的想法,并将指出一个项目,我在该项目中逐步将 Spring 应用程序转换为 Rails。您必须发挥您的想象力来弄清楚如何将杂乱的 CF 视图转换为 Rails,但您至少可以看看如何在 Rails 环境中使用 Java 后端。
https://github.com/nicksieger/refactoring-to-rails
I agree with Ciaran Archer's thoughts for the most part, and will point out a project where I incrementally convert a Spring application to Rails. You will have to use your imagination to figure out how to convert your messy CF views to Rails, but you can at least look to see how you might use your Java backend in a Rails environment.
https://github.com/nicksieger/refactoring-to-rails
说话不要绝对! :) JRuby 的优点是能够调用 CF 等 Java 库,但它仍然是一个新兴平台,尽管它在 JVM 上具有巨大潜力。
如果您仍打算在 CF 或 JRuby 等 JVM 语言上运行,那么我会说是的。
JRuby 不需要 Linux(请参阅此处) - 请记住 JRuby 只是另一种 JVM 语言, JVM 的好处是平台独立性。如果您打算使用普通 Rails,我建议您使用 Linux - 我之前曾尝试在 Windows 上使用 Rails,但效果并不理想。你读到的所有关于 Rails 教程等的内容都将假定 Linux 是有利的。
Sinatra 是一个非常精简的框架,它本质上使用简单的正则表达式路由规则。我会将其用于小型项目,但对于可能增长的生产应用程序,则不会。您最好获得 Rails 的组织优势。
我相信 Engine Yard做JRuby托管。 Heroku 做 Rails PaaS 托管。如果您使用 JRuby 或从 JRuby 调用 Java,Heroku 可能不太适合,但对于普通的 Rails 应用程序来说,它非常酷。
正如其他人指出的那样 - CF 不是问题,问题在于您的应用程序是如何编写和组织的。请记住,您也可以编写垃圾 Rails 代码。
希望所有这些对您的决定有所帮助。
Don't speak in absolutes! :) JRuby has the benefit of being able to call Java libraries like CF, but it's still an emerging platform, albeit one with great potential on the JVM.
If you are still going to run on a JVM language like CF or JRuby then I would say yes.
Linux is not required for JRuby (see here) - remember JRuby is just another JVM language and the benefit of the JVM is platform independence. If you are going for plain Rails I would recommend going over to Linux - I've tried using Rails on Windows before and it's not pretty. Everything you read in terms of Rails tutorials etc. will assume a favour of Linux.
Sinatra is a very slimmed down framework which essentially uses simple regex routing rules. I would use it for small projects, but for a production application that is likely to grow, then no. You are better off getting the organisational benefits of Rails.
I believe Engine Yard do JRuby hosting. Heroku do Rails PaaS hosting. Heroku might not be a good match if you are using JRuby or calling Java from JRuby, but for a plain Rails application it's very cool.
And as others have pointed out - CF is not the problem, the problem is how your application was written and organised. You can write crap Rails code too, remember.
Hoep all that helps you somewhat with your decision.