使用 Rails 作为大型网站的框架
我已经使用 Rails(版本 3)几个月了,并且对这个框架有了相当的了解。然而,我还没有开发一个提供大量数据库访问和用户交互的大型网站。
我对以下几点持怀疑态度:
- Ruby 的速度和可扩展性(我听说它比大多数其他服务器端语言慢 10 倍)。
- Rails 作为框架的额外后台处理(多层次抽象)。
- 缺乏在 Rails 上运行的企业级 Web 应用程序(我能想到的唯一的应用程序是 Groupon、Github 和 Hulu)。
- 环境的复杂性(nginx > mongrel > Rails > ruby > website)。
- 幕后 SQL 操作(我知道这些可以优化,但我确信我会错过一些)。
由于这些原因,我不确定是否继续使用 Rails 还是切换到构建在性能更高的语言之上的语言 .. 比如 Java Spring。
请指教 :)
I've been playing around with Rails (version 3) for a few months now and I understand the framework fairly well. However, I have yet to develop a large website which offers lots of database access and user interaction.
I'm fairly skeptical of the following:
- The Speed and Scalability of Ruby (I've heard that its up to 10 times slower than most other server-side languages).
- The extra background processing that Rails as a framework (multiple levels of abstration).
- The lack of enterprise-level web apps that run on Rails (the only ones that I can think of Groupon, Github and Hulu).
- The complexity of the environment (nginx > mongrel > rails > ruby > website).
- The behind-the-scenes SQL operations (I know that these can be optimized, but I'm sure that I'll miss some).
For these reasons, I'm unsure whether to continue using Rails or to switch to something that is built ontop a more performant language .. say Java Spring.
Please advise :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
生产环境中有大量使用 Rails 的大型站点和基础设施。多年来,Rails 被积极用于各种大大小小的 Web 应用程序,这个问题也一直被问到死。
简而言之,它不是最快的语言,但尽管如此,如果您知道自己在做什么,则可以很好地扩展。如果你确实遇到任何规模问题,你应该有足够的钱来雇用那些知道自己在做什么的人。
扩展任何网络应用程序都很困难,请使用您知道的语言/框架。程序员快乐才是王道。
There are tons of large sites and infrastructures in production that use Rails. This question has also been asked to death over the years of Rails being actively used for all manner of web apps, large and small.
Short version is that it is not the fastest language around but despite that scales fine if you know what you are doing. And you should have enough money to hire people that know what they are doing if you actually have any problems of scale.
Scaling any webapp is hard, use the language/framework you know. Programmer happiness is king.
使用 Ruby 可以获得良好的性能。简单:
问题解决了;)
You can get good performance with Ruby. Easy:
Problem solved ;)
不再讨论速度和规模了吗?
在网络开发中,最慢的事情是网络通信(接收请求,取回所有数据),数据库(从数据库中获取所有数据),并且大多数时候它根本与计算时间无关。
虽然 Ruby 和 Ruby on Rails 似乎更注重程序员的幸福感,但我认为用 .NET 或 Java 构建的每一个像样的 Web 应用程序都具有尽可能多的抽象级别。
环境的复杂程度?我想你的意思是部署?有很多选项,但最常用的选项是 Passenger (非常容易部署在 apache 或nginx),或 Torquebox。
目前,Torquebox 是最快、最好的扩展解决方案(基于 JBoss 应用程序服务器),Ruby 社区中的几位知名人士都将 Jruby 称为部署应用程序的选择实现。虽然据我所知,最常见的部署仍然是使用 REE(Ruby 企业版)和 Passenger。
除非您知道您将不得不进行严肃的数学、CPU 密集型运算,否则我认为您应该问自己的问题是:哪种框架/语言会给我最快的结果?
如果您非常精通 Java/Spring,那么这可能就是您的答案。但如果您唯一担心的是总体性能,我会说:不要犹豫,选择 Ruby on Rails。在其中进行开发是一种纯粹的乐趣。如果您遇到任何问题,Ruby 社区真的很棒:发个帖子即可获得支持。
最后,我想添加一些使用 Rails 的大型网站:LinkedIn 正在使用 Rails(和 jruby),Twitter 仍然使用 Rails 作为其前端。
Not the speed and scaling discussion again?
In webdevelopment the things that are the slowest is the network communication (receiving the request, getting al your data back), the database (getting all your data from the database), and most of the times it is not about the computation time at all.
While it is true that Ruby and Ruby on Rails seem more focused on programmer happiness, I think that every decent web-application built in .NET or Java has as many levels of abstraction.
The complexity of the environment? I think you mean deploying? There are a lot of options, but the most used options are Passenger (very easy deployment on top of an apache or nginx), or Torquebox.
Torquebox for the moment is the fastest, best scaling solution (based on JBoss Application server), and several big names in the Ruby community are calling Jruby the implementation of choise to deploy your applications. While AFAIK the commonest deploy still is using REE (Ruby Enterprise Edition) and Passenger.
Unless you know you are going to have to do serious mathematical, cpu-intensive operations, I think the question you should ask yourself is: which framework/language will give me the quickest result?
If you are very proficient in Java/Spring, that might be the answer for you. But if your only worry is performance in general, I would say: do not hesitate and go for Ruby on Rails. It is a pure joy to develop in. The ruby community is really awesome if you would encounter any issues: support is just a post away.
And to conclude, I want to add a few very big sites using Rails: LinkedIn is using rails (and jruby), and Twitter still is using Rails for their frontend.