Noop Handler – Catching 80K requests per second without breaking a sweat

March 24, 2011 Mike Barinek

Sure it’s a noop test and running on a iMac i7, but 80K requests per second is pretty impressive for 40 lines of code.

package manual;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.thread.QueuedThreadPool;

public class NoopHandler {
    public static void main(String[] args) throws Exception {
        QueuedThreadPool pool = new QueuedThreadPool();

        Server server = new Server();
        server.setHandler(new AbstractHandler() {
            public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

        SelectChannelConnector connector = new SelectChannelConnector();

Here’s the apache benchmark information.

juniper:~ pivotal$ ab -n10000 -c20 -k http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests

Server Software:        Jetty(7.2.2.v20101205)
Server Hostname:        localhost
Server Port:            8080

Document Path:          /
Document Length:        4 bytes

Concurrency Level:      20
Time taken for tests:   0.127 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    10000
Total transferred:      980392 bytes
HTML transferred:       40016 bytes
Requests per second:    78840.73 [#/sec] (mean)
Time per request:       0.254 [ms] (mean)
Time per request:       0.013 [ms] (mean, across all concurrent requests)
Transfer rate:          7548.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     0    0   0.1      0       3
Waiting:        0    0   0.1      0       3
Total:          0    0   0.1      0       3

Percentage of the requests served within a certain time (ms)
  50%      0
  66%      0
  75%      0
  80%      0
  90%      0
  95%      0
  98%      0
  99%      1
 100%      3 (longest request)

I’ve also been playing around with Mizuno and jruby-rack quite a bit recently. We’re hoping to find a high-performing solution for jruby.

About the Author


New in Tracker: Story assignment notification, API additions
New in Tracker: Story assignment notification, API additions

We've added a new email notification to Pivotal Tracker which will let you know when someone assigns a stor...

Using Firebug with WebDriver in Capybara/Cucumber – New and Improved
Using Firebug with WebDriver in Capybara/Cucumber – New and Improved

Forget the steps I published earlier...just install the capybara-firebug gem and away you go. Thanks jfire...

SpringOne. Catch all the highlights

Watch now