| Symfony - Ruby on Rails - Django performance test [message #8815] |
Fri, 14 July 2006 12:18  |
matt Messages: 21 Registered: June 2006 |
Junior Member |
|
|
We recently decided to switch our projects to a MVC framework and our choice of the framework came down to three final contenders:
* Symfony on PHP http://www.symfony-project.com/
* Rails on Ruby http://rubyonrails.org/
* Django on Python http://www.djangoproject.com/
To better understand the pros and cons of each, we wrote a very simple demo application in all three. The app we chose was the one built in the Ruby on Rails tutorial Rolling with Ruby on Rails http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html.
We really wanted to test the framework, not static file serving or database performance. So we didn't come up with complex queries or serve any static CSS or image files. All requests/hits/transactions are rendered pages. Also, all of the tests are GET operations (database SELECTs) for concurrent testing fairness and simplicity.
Each of the tested pages was configured to have a unique number displayed on it based on microtime (to verify the pages weren't being cached). Also, the same pages across all three apps were edited to have nearly the same number of bytes served.
DISCLAIMER: There are infinitely more test scenarios we could have performed. But we wanted something done in a finite time. We feel these results, though not the whole picture, offer hints about relative performance between the three frameworks/platforms.
Test Hardware:
* Dell 1U server (unknown model)
* Dual Xeon 3.2Ghz (6400 bogomips)
* 2 Gigs of RAM
* 2 240Gig (?) SATA drives
Test OS/Software:
* OS: SuSE 10.1
* kernel: 2.6.16.13-4-smp
* database: Mysql 5.0.18
* stress-test software: Siege 2.64 http://www.joedog.org/JoeDog/Siege
* Used stock RPM's for all software unless noted below
Symfony setup:
* Apache 2.2.0 (mod_php)
* PHP 5.1.2
* APC 3.0.10 (PHP accelerator, compiled from source)
* Symfony 0.7.1587 (not an RPM)
Django setup:
* Apache 2.2.0 (mod_python)
* Python 2.4.2
* Django 0.95-3336 (not an RPM)
Rails setup:
* Apache 2.2.0 (mod_proxy_balancer)
* Ruby 1.8.4
* Rails 1.1.4 (not an RPM)
* Mongrel and lighttpd web server (not an RPM)
Apache Prefork tuning:
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 150
MaxClients 150
MaxRequestsPerChild 10000
Results
For each of the platforms, we experimented a bit with some options to try to get the best performance by running 3-minute tests. Then we ran an extended 30-minute test on each platform. (Before the actual tests, we pre-ran siege for a minute or two to prime whatever cache's, etc.) Here are some of the results:
For each of the platforms, we experimented a bit with some options to try to get the best performance by running 3-minute tests. Then we ran an extended 30-minute test on each platform. (Before the actual tests, we pre-ran siege for a minute or two to prime whatever cache's, etc.) Here are some of the results:
Symfony - 50 concurrent users
With PHP+APC: (30 min)
Transactions: 85862 hits
Availability: 100.00 %
Elapsed time: 1801.15 secs
Data transferred: 114.41 MB
Response time: 1.04 secs
Transaction rate: 47.67 trans/sec <---
Throughput: 0.06 MB/sec
Concurrency: 49.63
Successful transactions: 85862
Failed transactions: 0
Longest transaction: 4.15 <---
Shortest transaction: 0.02
Mysql: ~7% of CPU
Siege: ~5% of CPU
With APC disabled: (3 min)
Transactions: 2256 hits
Availability: 99.34 %
Elapsed time: 181.76 secs
Data transferred: 3.15 MB
Response time: 3.64 secs
Transaction rate: 12.41 trans/sec <--- !
Throughput: 0.02 MB/sec
Concurrency: 45.19
Successful transactions: 2256
Failed transactions: 15 <---
Longest transaction: 30.57 <---
Shortest transaction: 0.14
NOTE: NOT having a PHP accelerator yields about 12 trans/sec! Horrible! Rumor has it that APC will be included by default in PHP6. In the above tests, we also had syck (for YAML parsing). However it didn't significantly change the results on a 3 minute test (less than 0.5 trans/sec).
Rails - 50 concurrent users
With 10 mongrels: (30 min)
Transactions: 158747 hits
Availability: 100.00 %
Elapsed time: 1800.82 secs
Data transferred: 211.38 MB
Response time: 0.57 secs
Transaction rate: 88.15 trans/sec <---
Throughput: 0.12 MB/sec
Concurrency: 49.89
Successful transactions: 158747
Failed transactions: 0
Longest transaction: 11.11 <---
Shortest transaction: 0.00
Mysql: ~10% of CPU
Siege: ~10% of CPU
NOTE: In the test above Rails was configured with 10 stand-alone mongrel processes (production mode) and web requests were redirected through Apache using mod_proxy_balancer. In subsequent 3 minute tests, having 20 or 30 mongrels didn't affect the transaction rate more than 0.5 trans/sec.
With lighttpd+fastcgi: (3 min)
Transactions: 15415 hits
Availability: 100.00 %
Elapsed time: 180.66 secs
Data transferred: 20.53 MB
Response time: 0.58 secs
Transaction rate: 85.33 trans/sec <---
Throughput: 0.11 MB/sec
Concurrency: 49.89
Successful transactions: 15415
Failed transactions: 0
Longest transaction: 1.25 <---
Shortest transaction: 0.04
NOTE: The above test was run with the default lighttpd.conf, but on port 80 and in production mode. The number of trans/sec was about the same, but the longest transaction time was much smaller!
Django, 50 concurrent users
With mod_python: (30 min)
Transactions: 224588 hits
Availability: 100.00 %
Elapsed time: 1800.52 secs
Data transferred: 298.94 MB
Response time: 0.40 secs
Transaction rate: 124.74 trans/sec <---
Throughput: 0.17 MB/sec
Concurrency: 49.92
Successful transactions: 224576
Failed transactions: 0
Longest transaction: 9.31 <---
Shortest transaction: 0.00
Mysql: ~17% of CPU
Siege: ~11% of CPU
NOTE: The above test was run with PythonAutoReload? Off and PythonDebug? Off (production mode). These are by far the best performance numbers of the three frameworks!
High-load Results
I re-ran 3-minute tests on all three platforms with 150 concurrent users to check high-load results.
Symfony - PHP+APC, 150 concurrent users
Transactions: 14363 hits <---
Availability: 98.68 %
Elapsed time: 183.12 secs
Data transferred: 3.72 MB
Response time: 1.34 secs
Transaction rate: 78.43 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 105.06
Successful transactions: 122 <---
Failed transactions: 192 <---
Longest transaction: 30.67
Shortest transaction: 0.02
NOTE: You can see there were very few successful transactions. Most were "500 - Internal Server Errors" and 192 failed to connect altogether. It looks like the 500 errors were caused by something with Mysql, because the dev interface returned: "connect failed Native Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock"
Rails - 10 mongrels, 150 concurrent users
Transactions: 14718 hits
Availability: 100.00 %
Elapsed time: 180.61 secs
Data transferred: 20.22 MB
Response time: 1.79 secs
Transaction rate: 81.49 trans/sec <---
Throughput: 0.11 MB/sec
Concurrency: 146.12
Successful transactions: 14718 <---
Failed transactions: 0 <---
Longest transaction: 18.39
Shortest transaction: 0.00
NOTE: "Transaction rate" down, and "Longest trans" time is up (from 50 concurrent users), but no failed transactions.
NOTE: Attempting this test with lighttpd+fastcgi failed. The web server returned "500 - Internal Server Error"'s and absurd siege result numbers.
Django, 150 concurrent users
Transactions: 19903 hits
Availability: 100.00 %
Elapsed time: 180.78 secs
Data transferred: 26.73 MB
Response time: 1.35 secs
Transaction rate: 110.10 trans/sec <---
Throughput: 0.15 MB/sec
Concurrency: 148.32
Successful transactions: 19903
Failed transactions: 0 <---
Longest transaction: 20.03 <---
Shortest transaction: 0.01
NOTE: "Transaction rate" down, and "Longest trans" time is up (from 50 concurrent users), but no failed transactions. Still the top performer.
Summary
Rails performed much better than Symfony. And Django performed much better than Rails.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #8853 is a reply to message #8841 ] |
Fri, 14 July 2006 22:33   |
|
digg is built with php on the wact framework...
I am not sure about slashdot, but I think it is perl.
With any framework it depends on the environment. In this case, there are three separate frameworks and three separate environments. Symfony can be speed up quite a bit if implemented correctly in an optimized environment.
Once propel 2 is released using pdo, it will speed up db access quite a bit.
Either way, excellent review. Thanks
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #8863 is a reply to message #8853 ] |
Sat, 15 July 2006 01:46   |
francois Messages: 1627 Registered: October 2005 |
Faithful Member |
|
|
Wow, a stab in the back in the middle of the French national day!
All right guys, you know your job and when to publish a review with a negative conclusion. I must admit it.
We won't argue about performance - we use symfony every day, for high-traffic websites with AJAX requests etc., and we have no problem with it. Sometimes it takes time to configure a project and to optimize the model layer (since, as I already sais, and as your test shows, Propel is the slowest part in symfony), but we always get the best out of our servers (including resisting a Digg effect, for instance in the symfony website itself).
We won't argue about PHP vs. other languages either - most of the companies we work for don't even give us the choice. People who want to make money in this market, and use open-source tools with minimum support and documentation, have to use PHP.
What we can say is that we have a huge concern about performance, we keep improving it with every new version. We know symfony's weak points (once again, Propel) and we are already working on alternatives. But we are confident that symfony already runs quite fast.
Your study is interesting, but it leads only to one conclusion: If you really want a fast application, you have to code it by hand (in plain PHP, or, why not, assembly?). Then, you'll be in total control of its performance. But people who do web apps for a living are not that much interested in plain old performance, since:
- The time spent on creating web apps with symfony is about four times less than what it takes to do them without it.
- And the price of an additional server is really not very much as compared to the money earnt by using a framework.
Anyway, if you choose another framework, it's because it's probably the best choice for you, so good luck with Django. And thanks for your study.
One last word: We love the two frameworks you compared symfony with, and we are quite proud about being their main competitor after only ten months of existence, while they've both been existing for years...
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #8866 is a reply to message #8863 ] |
Sat, 15 July 2006 02:03   |
matt Messages: 21 Registered: June 2006 |
Junior Member |
|
|
Salut Francois,
Thanks for your reply. This isn't a stab in the back. Seriously, when we evaluated the 3 frameworks, Symfony wasn't the worst of 3.
To be honest with you, there wasn't a clear winner. Symfony is great and has all the features RoR and Django offer. It might not have the momentum of RoR or the framework speed of Django but it's a great solution we really liked. We also really liked the documentation and the community around Symfony. We hope to see some published books in the future even though your online documentation is excellent.
We came to the conclusion that there wasn't a perfect solution, all depends on your project.
For your information, we didn't give up on Symfony yet, we aren't sure what's the best choice for our project.
Also, I'm glad to see that you are working on improving the framework performance, note that if you have tricks on how to improve the perforance, we would be glad to re run the test.
Matt
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #8868 is a reply to message #8815 ] |
Sat, 15 July 2006 03:22   |
|
The best choice for your project is of course: symfony 
I think the review is fair (even though it was posted on RoR site).
Do you have screen installed on your server? If so, give me root and you can watch me speed up symfony two fold in three hours... Seriously.
|
|
|
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #8910 is a reply to message #8815 ] |
Mon, 17 July 2006 16:07   |
|
We appreciate the tests and are glad there are people like you in the community benching and comparing the frameworks. It provides very valuable feedback about where we need to improve the most (propel?). Obviously, there will always be room for improvement...
Has anyone run ab tests?
[Updated on: Mon, 17 July 2006 16:08]
|
|
|
|
|
|
|
|
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10567 is a reply to message #10544 ] |
Mon, 21 August 2006 15:37   |
frank Messages: 22 Registered: August 2006 |
Junior Member |
|
|
|
Assuming Doctrine is ready for prime time (which does not seem to be the case from its site), I too would love to see Doctrine as a supported alternative to Propel. I much prefer its use of PDO and Active Record, and the performance increase would be welcome. The question is would I still be able to use YML in the same way for most of my configuration? Doctrine seems to shun this. Would the use of YML slow Doctrine down significantly? Am I totally misunderstanding the use of YML? Can Doctrine support the current features of Symfony with Propel?
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10585 is a reply to message #10567 ] |
Mon, 21 August 2006 17:16   |
zYne Messages: 12 Registered: August 2006 |
Junior Member |
|
|
You can use YML for configuration (guy named amadeus is working on the integration) but instead of using XML for mappings you use ActiveRecord runtime mapping.
I'm pretty confident Doctrine has every feature Propel has (if not let me know) and also a lot more as you can see of the following feature list:
http://swik.net/Doctrine
[Updated on: Mon, 21 August 2006 17:18]
|
|
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10722 is a reply to message #10642 ] |
Tue, 22 August 2006 19:12   |
frank Messages: 22 Registered: August 2006 |
Junior Member |
|
|
|
Assuming Doctrine (or something like it) does get fully integrated in the future, I wonder what a complex website that has been built with Propel will have to do to trade up to Doctrine. Ideally, it should be very little, and if so, there is far less risk in using Propel for current projects if a performance option looks promising in the future. I have a long term project(product) that I am going to be building with Symfony. I do not see it needing high performance for at least a year or more. I would sure like to know what the roadmap is, and road blocks are, for Doctrine integration. If it is just going to be an unsupported wiki option, it is clearly less applealing.
|
|
|
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10940 is a reply to message #10939 ] |
Fri, 25 August 2006 18:16   |
frank Messages: 22 Registered: August 2006 |
Junior Member |
|
|
OK, perhaps my bad. But why does netcraft list the site as running on PHP 5?
| Quote: | Apache/2.2.2 (FreeBSD) mod_ssl/2.2.2 OpenSSL/0.9.8b DAV/2 PHP/5.1.4 SVN/1.3.2 mod_vd/2.0 mod_fastcgi/2.4.2 proxy_html/2.5
|
Does Netcraft not see Ruby? Is Ruby always invisible. I have not checked on Ruby sites before, so perhaps I am using the wrong tool. What should I use?
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10958 is a reply to message #8815 ] |
Fri, 25 August 2006 22:21   |
frank Messages: 22 Registered: August 2006 |
Junior Member |
|
|
I am sure you are right about rubyonrails.org running on ruby. But why does the home page work with index.php? That seems odd if there is no PHP involved. Is that some sort of search engine redirect? BTW, the 37signals site also seems to work with the "odd" index.php on the home page.
http://www.rubyonrails.com/index.php
http://www.37signals.com/index.php
|
|
|
| Re: Symfony - Ruby on Rails - Django performance test [message #10961 is a reply to message #10958 ] |
Fri, 25 August 2006 22:40   |
awildeep Messages: 104 Registered: May 2006 Location: Buffalo, NY |
Senior Member |
|
|
frank,
I am no expert on Rail's site. However, if I had a working website I do not think I would care what language it was running on as long as I can maintain it.
For instance, Subversion used CVS as it's version control for a long time. It worked, even after Subversion became "better" than CVS (better is of course subjective in this case). The developers made an active choice to switch their app. But my point is, in no way does it reflect oon the application itself.
Also, to use your argument against you (please don't take offence) symfony-project.com uses 3rd party non-symfony based software, both FUDforum, and Trac come to mind. Does this express lack of confidence in symfony? I would say no. It's just that Trac and FUDforum both do an excellent job, and why reinvent the wheel again? Not to mention I have not seen anyone working on a symfony code/ticket tool to replace Trac (which I would love, I hate python), nor a symfony bulliten board.
So ultimately it doesn't matter to me what the Rails community uses for rubyonrails.com. What does matter to me is that symfony does a good job for what I need, and if I used Rails, I would expect the same from it.
Boiling this down to it's point: Don't judge a book by its cover.
PS: It's also not hard to create a rewrite rule for .php file extensions. Rails does have a pretty extensive URL rules engine. Not to mention, Ruby may be running under fast_cgi, since last I heard mod_ruby was considerably slower than fast_cgi.... (just some thoughts)
[Updated on: Fri, 25 August 2006 22:50]
|
|
|
|