the blog for developers

Unscientific Jetty versus Glassfish for REST

This post was too unscientific and was updated. Jetty is an excellent container and the container of choice whenever I do something with servlets. Ever since we’ve developed SnipSnap some years ago I love Jetty. Glassfish has some very promising features like the admin console and I´m eager to try Glassfish in a project sometimes in the future.

Reading about another story of Rails performance, I grabbed JMeter to benchmark one of my current projects. Not so much as a comparison for Ruby – which managed 320 requests per second – but more as a comparison of Jetty and Glassfish.

The application is a small REST server which reads data from a JDBM storage, transforms it with my own framework to Json and delivers the result with Jersey.

Both servers were started with their default configuration through their maven plugins (wonderful easy to use mvn glassfish:run). Unscientific as it may be, the numbers are:

  • around 1000 requests/sec for both containers

Both with 200 threads and 50 requests per thread. Both numbers are great for my MacBookPro and good enough for me. They also are so close to each other so they are not a deciding factor for either Glassfish or Jetty. At the risk of comparing apples to oranges I have no fear of deploying this to a production system and scaling cheap (and even better with E-Tag caching), keeping in mind the requests per second with 25 servers in the Rails example.

Thanks for listening.

Update:: Another Rails application which thinks it did scale – at least with Merb, to 650k page views per day, well that’s “650K hits per day is ‘only’ around 8 per second (assumed a 20 hour day to spike it a little). This doesnt actual seem all that much?”.

The JMeter speed and 1000req/sec (for an admittantly simple REST GET) results in … 86.4M requests per day. Uh. On my MacBookPro.

You can leave a Reply here. Of course, you should follow me on twitter here.

You can share this post!
Do you want to tell others about this article? Use the social bookmark icons to submit this artice to the service of your choice. Thanks.

About the author: Stephan Schmidt is head of development at brands4friends. He has more than 15 years of internet technology experience and 10 years experience in agile. He was head of development, consultant and CTO and is a speaker, author and blog writer. He specializes in organizing and optimizing software development helping companies by increasing productivity with lean software development and agile methodologies. Want to know more? All views are only his own.
Leave a reply.

Comments

hi Stephan,

thanks for the info.

E-Tag : I’ve been reading up on this for a while. Would you know of a tutorial /introduction on how to use it efficiently ?

Thank you,

BR,
~A

stephan

Sorry, I don’t have a tutorial at hand, everytime I implement something new wit etags I use google to find the information I need. It’s usually not very often.

Peace
-stephan

Greg Wilkins

Stephan,

What versions of jetty/glassfish were compared? Also, any chance you can make the source for this project available, or at least something similar.

The difference between jetty/glassfish may be something as simple as default configured depth of accept queues. Unscientific as it is, its no fun having psuedo benchmarks published that you can’t analyse or respond to.

cheers

lumpynose

With Rails it was 320 requests per seconds with what, 25 servers? Given my experience probably a significant percentage of those servers were needed because so many are being restarted by some external monitoring process because the Mongrel, Webrick, or whatever, was hung. One of the Rails fanboys here was complaining that the monitoring program he uses, god, was sending him several false positives emails a day about the server being hung. Talk about adding insult to injury. But he doesn’t see it that way or what black comedy the whole Rails thing is.

stephan

What I miss when people talk about scalability, is not if somethings scales or not (your app should be designed in a way that it scales), but how much it will cost. Linear scalability for academics is the same independent of the scaling factor (2n or 10n), for business it makes a huge difference (5x more money though both technologies scale linear).

I think it’s funny that VCs don’t care about how much a chosen technology costs to scale.

And no, I have no facts that Rails doesn’t scale as good as e.g. Spring, just a gut feeling.

But the post was mainly to reassure me that my scaling factor for the REST solution is cheap, not to bash Rails/Ruby (I was afraid after reading the report).

lumpynose

Very true.

I think the Rails scalability issue bothers me because I work with people who are Rails fanatics and their fanaticism blinds them to the scalability and reliability issues with Rails. The Rails people are typically chanting about how with it you can crank out a web app in no time at all, and within the Rails community you find very few people who think about the design and architecture of web applications. The whole mind set is to just use the tools that Rails gives you and be thankful that you don’t have to think about the gritty under the hood implementation details or alternative choices. They think of that as time wasted. I call it the Duncan Hines mind set. Duncan Hines is a cake mix in a box here in the states.

stephan

@Greg: Sorry, no source code yet, but it’s a simple Jersey REST resource which returns Json.

The versions were probably not the newest, the Jetty plugin is 6.1.10, the Glassfish plugin is 1.0-alpha-4.

“The difference between jetty/glassfish may be something as simple as default configured depth of accept queues. Unscientific as it is, its no fun having psuedo benchmarks published that you can’t analyse or respond to.”

I’m sorry, with some hindsight I wasn’t clever to publish numbers, a “around 1000req/sec” would have been enough. As I’ve said, both are so fast, that the numbers are really no problem to me (but might be for others, I agree).

It probably wouldn’t help if I do another benchmark, with published source code and documented configuration.

That aside, Jetty is an excellent container and the container of choice whenever I do something with servlets. Ever since we’ve developed SnipSnap some years ago I love Jetty.

Leave a Reply

What people wrote somewhere else:

Additional comments powered by BackType

Guide to CodeMonkeyism

Over the last 4 years I wrote many articles on this blog. To make it easier for you to find the relevant ones, I've organized them into topics.

Top 10

6 reasons why my VC funded startup did fail

Go Ahead: Next Generation Java Programming Style

Java Interview questions: Write a String Reverser

The dark side of NoSQL

7 Bad Signs not to Work for a Software Company or Startup

Is Java dead?

Scala vs. Clojure

Never, never, never use String in Java

No future for functional programming in 2008 – Scala, F# and Nu

Clojure vs Scala, Part 2

Job Seeker

Another Good (Java) Interview Question

7 Bad Signs not to Work for a Software Company or Startup

Java Interview questions: Write a String Reverser (and use Recursion!)

Java Interview questions: Multiple Inheritance

As a Manager: What I value in developers

Top 10 Tips (+1) to Get a Pay Raise

Java Developer

Is Java Dead?

Go Ahead: Next Generation Java Programming Style

Be careful with magical code

All variables in Java must be final

Never, never, never use String in Java

Bending Java: More readable code with methods that do nothing?

Startup/CTO

Development Dream Teams

6 reasons why my VC funded startup did fail

American vs. European style of Software Development

12 Things to Reduce Your Lead Time and Time to Market

The high cost of overhead when working in parallel

Essential storage tradeoff: Simple Reads vs. Simple Writes

Agilist

What Developers Need to Know About Agile

5 Practices Better to Change in Your Scrum Implementation

Scrum is not about engineering practices

ScrumMaster and ZenMaster: The joke of certification

What is Trans-Scrum?