I'd like to know situations in which I should consider using a framework other than Rails.
我想知道我应该考虑使用除Rails之外的框架的情况。
4 个解决方案
#1
Two things. First, Ruby is a relatively young language, and you may run into brick walls when trying to do slightly more esoteric things (like connect to non mainstream or older types of datasources). It also has poor GC, and no kernel threads, both of which are very important for a high performance platform. The main codebase (MRI) is quite hacky (lots of clever obfuscating programmer tricks like macros) and there are parts that are poorly written (gc and thread scheduling leap to mind). Again, it is a very young platform that got very popular very fast.
两件事情。首先,Ruby是一种相对年轻的语言,当你尝试做更多深奥的事情时(例如连接到非主流或旧版数据源),你可能会碰壁。它也有糟糕的GC,没有内核线程,这两者对于高性能平台都非常重要。主代码库(MRI)是相当hacky(很多聪明的混淆程序员的技巧,如宏),有些部分编写得很差(gc和线程调度跳跃到脑海)。同样,它是一个非常年轻的平台,非常受欢迎。
Secondly, while ruby the language and rails the ideas/paradigm are both phenomenal, ruby and rails the platforms are not. There is a hell of alot in both ruby and rails that is downright ugly, and deployment solutions are in the dark ages compared to what is considered normal for other platforms (php/asp/jsp).
其次,虽然ruby语言和轨道的想法/范例都是惊人的,ruby和rails,平台不是。 ruby和rails中有很多东西都很难看,而且与其他平台(php / asp / jsp)的正常情况相比,部署解决方案处于黑暗时代。
Being accused of trolling here, so I will expound a bit. Due to the threading model, Rails cannot process requests concurrently unless you launch multiple full instances of your rails app. To do that you have two options, the relatively young and still under development passenger (mod_rails), or the tried and tested apache load balancer with multiple mongrel instances behind it.
被指控在这里拖钓,所以我会稍微阐述一下。由于线程模型,Rails无法同时处理请求,除非您启动rails应用程序的多个完整实例。要做到这一点,你有两个选择,相对年轻和仍在开发的乘客(mod_rails),或经过试验和测试的apache负载均衡器,后面有多个mongrel实例。
Either way, the lack of the ability to just just spawn workers means you will want 5-10 full instances of your application running, which incurs a very large overhead (can easily be 300-500megs per app depending on your gems and how big your app is). Because of that, the infrastructure needed to serve rails is a hell of alot more complecated then most other things.
无论哪种方式,缺乏仅仅产生工作者的能力意味着您将需要运行5-10个完整的应用程序实例,这会产生非常大的开销(根据您的宝石可以很容易地为每个应用程序300-500megs以及您的应用程序有多大)应用程序是)。正因为如此,为铁路提供服务所需的基础设施比其他大多数东西更加复杂。
Now, that being said, the situation has been continuously getting better (I mean, passenger is usable now, it wasn't the last time I had to deal with deploying a rails app). I would be very surprised if rails doesn't catch up in the next few years.
现在,话虽如此,情况一直在变好(我的意思是,乘客现在可以使用,这不是我最后一次处理部署rails应用程序)。如果rails在未来几年内没有赶上,我会非常惊讶。
Also, rubinius/jruby are doing things the right way, and are moving along at a great pace. I wouldn't be suprised if MRI gets dropped in the next few years in favor of one of those implementations for mainstream rails work.
此外,rubinius / jruby正在以正确的方式做事,并且正以极快的速度前进。如果MRI在接下来的几年中被放弃,而不是主流导轨工作的那些实现之一,我不会感到惊讶。
#2
Ruby on Rails isn't trying to be an end-all be-all web development framework. If you're going to build an application that is predominantly built using CRUD operations, you want to use a lot of AJAX, and you have total control over the database, then Ruby on Rails is one of a few excellent options. If you're doing something else, then there is a probably another framework that is a better match for your requirements.
Ruby on Rails并没有试图成为最终的所有Web开发框架。如果你要构建一个主要使用CRUD操作构建的应用程序,你想要使用大量的AJAX,并且你可以完全控制数据库,那么Ruby on Rails就是一些很好的选择之一。如果您正在做其他事情,那么可能还有另一个框架可以更好地满足您的要求。
#3
edit: Matt amended his answer tastefully :) I've removed my own comments pointing out the things he's fixed.
编辑:马特高兴地修改了他的答案:)我删除了自己的评论,指出了他修复过的事情。
Yes, Ruby definitely has some shortcomings. Green threads being a huge one. But as Matt has said, things are moving along in better directions.
是的,Ruby肯定有一些缺点。绿色线程是一个巨大的线程。但正如马特所说,事情正朝着更好的方向发展。
The other posts are pretty much on the money. Decently simple CRUD apps are best suited for rails, though there are other frameworks you can try in Ruby that offer more flexibility.
其他帖子几乎都是钱。非常简单的CRUD应用程序最适合rails,尽管还有其他框架可以在Ruby中尝试提供更大的灵活性。
Here's a great (and might I add objective) example of where not to use rails: Does the Rails ORM limit the ability to perform aggregations?
这里有一个很好的(也许我可以添加目标)不使用rails的示例:Rails ORM是否限制了执行聚合的能力?
#4
Wow, way to start a flamewar!
哇,开始一场火焰战!
I'm going to start it off by saying that Rails will work for most apps. However, if you need to do a lot of async type work (like messaging between systems, such as getting a request, placing it in a queue and processing it in a different thread, or even on another machine), Rails is probably not your best choice. Ruby, at least at the current time, is not really strong on multithreaded code.
我将首先说Rails适用于大多数应用程序。但是,如果你需要做很多异步类型的工作(比如系统之间的消息传递,比如获取请求,将它放在队列中并在不同的线程中处理它,甚至在另一台机器上),Rails可能不是你的最好的选择。 Ruby,至少目前来说,在多线程代码上并不是很强大。
Let the insults fly!
让侮辱飞!
#1
Two things. First, Ruby is a relatively young language, and you may run into brick walls when trying to do slightly more esoteric things (like connect to non mainstream or older types of datasources). It also has poor GC, and no kernel threads, both of which are very important for a high performance platform. The main codebase (MRI) is quite hacky (lots of clever obfuscating programmer tricks like macros) and there are parts that are poorly written (gc and thread scheduling leap to mind). Again, it is a very young platform that got very popular very fast.
两件事情。首先,Ruby是一种相对年轻的语言,当你尝试做更多深奥的事情时(例如连接到非主流或旧版数据源),你可能会碰壁。它也有糟糕的GC,没有内核线程,这两者对于高性能平台都非常重要。主代码库(MRI)是相当hacky(很多聪明的混淆程序员的技巧,如宏),有些部分编写得很差(gc和线程调度跳跃到脑海)。同样,它是一个非常年轻的平台,非常受欢迎。
Secondly, while ruby the language and rails the ideas/paradigm are both phenomenal, ruby and rails the platforms are not. There is a hell of alot in both ruby and rails that is downright ugly, and deployment solutions are in the dark ages compared to what is considered normal for other platforms (php/asp/jsp).
其次,虽然ruby语言和轨道的想法/范例都是惊人的,ruby和rails,平台不是。 ruby和rails中有很多东西都很难看,而且与其他平台(php / asp / jsp)的正常情况相比,部署解决方案处于黑暗时代。
Being accused of trolling here, so I will expound a bit. Due to the threading model, Rails cannot process requests concurrently unless you launch multiple full instances of your rails app. To do that you have two options, the relatively young and still under development passenger (mod_rails), or the tried and tested apache load balancer with multiple mongrel instances behind it.
被指控在这里拖钓,所以我会稍微阐述一下。由于线程模型,Rails无法同时处理请求,除非您启动rails应用程序的多个完整实例。要做到这一点,你有两个选择,相对年轻和仍在开发的乘客(mod_rails),或经过试验和测试的apache负载均衡器,后面有多个mongrel实例。
Either way, the lack of the ability to just just spawn workers means you will want 5-10 full instances of your application running, which incurs a very large overhead (can easily be 300-500megs per app depending on your gems and how big your app is). Because of that, the infrastructure needed to serve rails is a hell of alot more complecated then most other things.
无论哪种方式,缺乏仅仅产生工作者的能力意味着您将需要运行5-10个完整的应用程序实例,这会产生非常大的开销(根据您的宝石可以很容易地为每个应用程序300-500megs以及您的应用程序有多大)应用程序是)。正因为如此,为铁路提供服务所需的基础设施比其他大多数东西更加复杂。
Now, that being said, the situation has been continuously getting better (I mean, passenger is usable now, it wasn't the last time I had to deal with deploying a rails app). I would be very surprised if rails doesn't catch up in the next few years.
现在,话虽如此,情况一直在变好(我的意思是,乘客现在可以使用,这不是我最后一次处理部署rails应用程序)。如果rails在未来几年内没有赶上,我会非常惊讶。
Also, rubinius/jruby are doing things the right way, and are moving along at a great pace. I wouldn't be suprised if MRI gets dropped in the next few years in favor of one of those implementations for mainstream rails work.
此外,rubinius / jruby正在以正确的方式做事,并且正以极快的速度前进。如果MRI在接下来的几年中被放弃,而不是主流导轨工作的那些实现之一,我不会感到惊讶。
#2
Ruby on Rails isn't trying to be an end-all be-all web development framework. If you're going to build an application that is predominantly built using CRUD operations, you want to use a lot of AJAX, and you have total control over the database, then Ruby on Rails is one of a few excellent options. If you're doing something else, then there is a probably another framework that is a better match for your requirements.
Ruby on Rails并没有试图成为最终的所有Web开发框架。如果你要构建一个主要使用CRUD操作构建的应用程序,你想要使用大量的AJAX,并且你可以完全控制数据库,那么Ruby on Rails就是一些很好的选择之一。如果您正在做其他事情,那么可能还有另一个框架可以更好地满足您的要求。
#3
edit: Matt amended his answer tastefully :) I've removed my own comments pointing out the things he's fixed.
编辑:马特高兴地修改了他的答案:)我删除了自己的评论,指出了他修复过的事情。
Yes, Ruby definitely has some shortcomings. Green threads being a huge one. But as Matt has said, things are moving along in better directions.
是的,Ruby肯定有一些缺点。绿色线程是一个巨大的线程。但正如马特所说,事情正朝着更好的方向发展。
The other posts are pretty much on the money. Decently simple CRUD apps are best suited for rails, though there are other frameworks you can try in Ruby that offer more flexibility.
其他帖子几乎都是钱。非常简单的CRUD应用程序最适合rails,尽管还有其他框架可以在Ruby中尝试提供更大的灵活性。
Here's a great (and might I add objective) example of where not to use rails: Does the Rails ORM limit the ability to perform aggregations?
这里有一个很好的(也许我可以添加目标)不使用rails的示例:Rails ORM是否限制了执行聚合的能力?
#4
Wow, way to start a flamewar!
哇,开始一场火焰战!
I'm going to start it off by saying that Rails will work for most apps. However, if you need to do a lot of async type work (like messaging between systems, such as getting a request, placing it in a queue and processing it in a different thread, or even on another machine), Rails is probably not your best choice. Ruby, at least at the current time, is not really strong on multithreaded code.
我将首先说Rails适用于大多数应用程序。但是,如果你需要做很多异步类型的工作(比如系统之间的消息传递,比如获取请求,将它放在队列中并在不同的线程中处理它,甚至在另一台机器上),Rails可能不是你的最好的选择。 Ruby,至少目前来说,在多线程代码上并不是很强大。
Let the insults fly!
让侮辱飞!