Deployed to server, getting for poor requests per second

So I created a very very simple rails application using jruby.

jruby 1.6.7

rails new testapp

rails g controller home index loop insert

rails g model User name:string age:integer

rake db:migrate

  • updated routes, set production.rb environment to compile css etc.

  • modified by warble config to use ruby 1.9

  • created the .war file

So I pushed it to my server to tomcat6, and when I apache bench:

ab -n 100 -c 1 http://127.0.0.1/home/index

I am getting only like 15-30 requests per second. I was expecting a few
hundred at least.

I recall I was getting around 100 requests per second using
ruby/nginx/phusion passenger.

I must be doing something wrong here? :slight_smile:

Any comments/advice on these performance numbers?

Why not do an executable WAR and see if it’s as slow?
There are many many knobs to twiddle in Tomcat, and one
of those might be your problem.

warble executable war
java -jar yourapp.war

Agreed, but I mean a hello world should be very fast none the less.

I did try hitting it with more requests, and it basically stopped
processing after a few hundred.

Something is def. wrong here…

A few comments:

-Try is to run many many more requests than 100. If you look at the
report you will see some huge outliers taking in excess of 1s (some
requests end up JIT’ing lots of methods at the same time and heavily
skew stats early on). JVM/JRuby takes a while to warm up and 100 is
not very many. You should see things speed up over time.

  • If I remember right ab is forcing construction of a new session
    every request. It may still be an apples to apples comparison, but
    benchmarking is meant to test what is important to you and I suspect
    people who only hit you page once is not your goal.

  • Reinforcement of last point…performance is a big beast where
    something things are much faster or slower than others between Ruby
    impls. If you are trying to figure out performance then having an app
    closer to what you want to test will help figure out how well
    performance is between implementations. Most web apps have a
    reasonable amount of IO and a collection of different sized pages hit
    in a single session. The closer you get to hello world the murkier
    the picture will be (to be fair you are hitting a db – I assume data
    has also been added).

-Tom

On Sun, Mar 25, 2012 at 10:13 AM, S Ahmed [email protected] wrote:

rake db:migrate
I am getting only like 15-30 requests per second. I was expecting a few
hundred at least.

I recall I was getting around 100 requests per second using
ruby/nginx/phusion passenger.

I must be doing something wrong here? :slight_smile:


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]

How to I precompile assets when doing that executable war?

Before I ran it, I did:

rake assets:precompile RAILS_ENV=production

Still get the erorr:

application.css isn’t precompiled