Are there benchmarks comparing the respective memo

2019-04-29 23:27发布

问题:

I have to run a Web server with many services on an embedded server with limited RAM (1 GB, no swap). There will be a maximum of 100 users. I will have services such as a forum, little games (javascript or flash), etc.

My team knows Ruby on Rails very well, but I am a bit worried about Rails' memory usage. I really do not want to start a troll here, but I am wondering if there are any serious (i.e. documented) benchmarks comparing Rails, Django, CakePHP or any other PHP framework?

Could you please point to benchmarks or give me your opinion about Rails' memory usage? Please please please no troll.

回答1:

In terms of memory usage it's generally going to be Python > Ruby > PHP, which of course leads to Django > Rails > CakePHP. Not just memory but that also tends to hold for raw performance. EDIT: Also worth noting that there are, of course, no absolutes here. There are plenty of usage scenarios in which Ruby will beat Python, hands down. I think we can all agree that Ruby and Python will always beat PHP, though :)

Here's a straight-forward 3-way benchmarking (with Symfony on the PHP side of things) that bears out the above: http://wiki.rubyonrails.com/rails/pages/Framework+Performance. Though of course it's easy to find stats to support your own viewpoint :)

That said, it's still very easy to make a crappy, slow, and inefficient Django application and a lean, fast, and efficient Rails application, or vice-versa. Skill, knowledge, and expertise with the system you are using will do far more for its memory and performance footprint than just the framework itself. Database optimizations, server choices and architectures (Apache vs. proxy setups using nginx/lighttpd, etc.), and fundamental design decisions are likely going to overwhelm the framework's inherent characteristics pretty quickly.

So I guess what I'm saying is if your team knows Rails, and your expertise lies in Rails, I would stick with Rails.



回答2:

I just stumbled upon this benchmark which looks pretty good. It just gives data about Rails' memory usage (and performance) but it only partially answers the question because it does not compare Rails with other frameworks.

http://www.rubyenterpriseedition.com/comparisons.html



回答3:

My own experience is that Rails memory usage can be high, especially on 64 bit machines (min. is around 95-100 MB with thin as web front-end). PHP tends to be used with different patterns so it is a bit difficult to compare directly.