Skip to content
Testing performance of Rails 2.3 and Yesod 0.7
Haskell Ruby JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
rails-test
yesod-test
.gitignore
LICENSE
README
data.sql
hdbc-test.hs
persist-test.hs
persistent.cabal

README

Comparing performance of a simple model-load and show between yesod 0.7 and rails 2.3

Results
-------

Rails (in production mode, running with mongrel webserver, ruby 1.8.7) is six times slower than yesod (compiled in production mode).

Rails, development mode:

ransactions:                     250 hits
Availability:                 100.00 %
Elapsed time:                  26.82 secs
Data transferred:               5.53 MB
Response time:                  0.53 secs
Transaction rate:               9.32 trans/sec
Throughput:                     0.21 MB/sec
Concurrency:                    4.96
Successful transactions:         250
Failed transactions:               0
Longest transaction:            0.59
Shortest transaction:           0.17


Rails, production mode

ransactions:                     250 hits
Availability:                 100.00 %
Elapsed time:                  22.37 secs
Data transferred:               5.53 MB
Response time:                  0.44 secs
Transaction rate:              11.18 trans/sec
Throughput:                     0.25 MB/sec
Concurrency:                    4.97
Successful transactions:         250
Failed transactions:               0
Longest transaction:            0.52
Shortest transaction:           0.15



Yesod, old (hamlet <0.7.3, 14 times slower than rails):

ransactions:                     250 hits
Availability:                 100.00 %
Elapsed time:                 377.51 secs
Data transferred:               0.79 MB
Response time:                  7.55 secs
Transaction rate:               0.66 trans/sec
Throughput:                     0.00 MB/sec
Concurrency:                    5.00
Successful transactions:         250
Failed transactions:               0
Longest transaction:            8.35
Shortest transaction:           7.02


Yesod, updated Version (hamlet 0.7.3):

ransactions:                     250 hits
Availability:                 100.00 %
Elapsed time:                  82.29 secs
Data transferred:               0.79 MB
Response time:                  1.64 secs
Transaction rate:               3.04 trans/sec
Throughput:                     0.01 MB/sec
Concurrency:                    4.99
Successful transactions:         250
Failed transactions:               0
Longest transaction:            1.74
Shortest transaction:           1.36


Yesod, updated again (persistent-postgresql 0.4.0.1)

ransactions:                     250 hits
Availability:                 100.00 %
Elapsed time:                   3.70 secs
Data transferred:               0.37 MB
Response time:                  0.07 secs
Transaction rate:              67.57 trans/sec
Throughput:                     0.10 MB/sec
Concurrency:                    4.78
Successful transactions:         250
Failed transactions:               0
Longest transaction:            0.14
Shortest transaction:           0.05


To reproduce results
--------------------

You will need a PostgreSQL Server, Rails and Yesod installed.

1. Create a Database called "haskell"
2. Import SQL dump

   psql haskell < data.sql

3. Configure the database connection by editing rails-test/config/database.yml

4. In the rails-test directory start the server

   ./script/server

5. Access http://localhost:3000 and measure the time it takes to get 1000 quotes and display the values

6. Configure the database connection by editing yesod-test/Settings.hs (make sure to set the production settings)

7. In the yesod-test directory compile the app in production mode

   cabal install -f "production"

8. Start the app ./dist/build/yesod-test-production/yesod-test-production

9. Access http://localhost:3000/quotes and measure the time it takes to get 1000 quotes and display the values


Testing with siege:

siege -b -c 5 -r 50 localhost:3000

Something went wrong with that request. Please try again.