Live data from Hacker News

Web Framework Benchmarks Round 4

techempower.com

241–250 of 358 posts

Re: Web Framework Benchmarks Round 4

#241
post #215
post #164

Earlier quoted context omitted.

Some of the fastest implementations you see in these tests are not asynchronous. With Servlet for example, a worker thread is chosen from Resin's thread pool and used to handle a request. The Servlet then executes 20 queries sequentially and returns the resulting list data structure. This is Servlet 3.0 but not using Servlet 3.0 async. Async isn't making the top performers fast. Being fast is making them fast.

I agree, but what about the special case of hitting multiple shards and aggregating the results? Shouldn't the non-blocking win over the blocking?

Well depends exactly on the implementation.

Some may issue queries in parallel and aggregate the results, blocking until everything is done. Others may run them sequentially, which is the simplest but slowest way.

Re: Web Framework Benchmarks Round 4

#242

Earlier quoted context omitted.

Really. I've recently been getting into node/express after years of Java, and these results make me feel a whole lot less cool.

try our RingoJs: it's JS on the JVM. Scripting Java with JavaScript.

This, just in case noobs were not confused enough by Java/JavaScript? :)

Re: Web Framework Benchmarks Round 4

#243
Wow... some of these tests are still pretty severely hobbled.

Is there some reason that you use built in json serialization for some frameworks and not others?

There is also a lot of heterogeneity in the implementation of the multiple queries test. For instance, even if I only look at... say... java frameworks, you seem to implement the exact same feature in very different ways between platforms. For instance, for servlets, you will store all of the results in a simple array... and then write them out when you are done. Like so:

    final World[] worlds = new World[count];
    final Random random = ThreadLocalRandom.current();
    
    try (Connection conn = source.getConnection())
    {
      try (PreparedStatement statement = conn.prepareStatement(DB_QUERY,
          ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY))
      {
        // Run the query the number of times requested.
        for (int i = 0; i 
But for other frameworks, like Vert.x, you use CopyOnWriteArray to store all of the results... and then write them out when you are done. Like so:

    private final HttpServerRequest req;
    private final int queries;
    private final List worlds = new CopyOnWriteArrayList();

        .
        .
        .

    @Override
    public void handle(Message reply)
    {
      final JsonObject body = reply.body;

      if ("ok".equals(body.getString("status")))
      {
       this.worlds.add(body.getObject("result"));
      }

      if (this.worlds.size() == this.queries)
      {
        // All queries have completed; send the response.
        // final JsonArray arr = new JsonArray(worlds);
        try
        {
          final String result = mapper.writeValueAsString(worlds);
          final int contentLength = result.getBytes(StandardCharsets.UTF_8).length;
          this.req.response.putHeader("Content-Type", "application/json; charset=UTF-8");
          this.req.response.putHeader("Content-Length", contentLength);
          this.req.response.write(result);
          this.req.response.end();
        }
        catch (IOException e)
        {
          req.response.statusCode = 500;
          req.response.end();
        }
      }
    }


In other words, you literally create a new array each time you add a result to that CopyOnWriteArray. In fact, not only are you creating a new array, but you are creating new copies of the data in the array as well. Seems a little strange??? DEFINITELY inefficient. Is there a reason that is implemented differently? It seems to me that, at the least, they should both use arrays... but maybe there is something more you guys are testing???

The Onion C based code is written in an even MORE efficient manner for the multiple queries test. It actually stores it's results in json format from the outset! Like so:

    json_object *json=json_object_new_object();
    json_object *array=json_object_new_array();
    int i;
    for (i=0;i
The equivalent java code would be something like:

    private final HttpServerRequest req;
    private final int queries;
    // INSTEAD OF:
    //private final List worlds = new CopyOnWriteArrayList();
    // HAVE:
    private final JsonArray worlds = new JsonArray();

        .
        .
        .

    @Override
    public void handle(Message reply)
    {
      final JsonObject body = reply.body;

      if ("ok".equals(body.getString("status")))
      {
       // INSTEAD OF:
       //this.worlds.add(body.getObject("result"));
       // HAVE:
       this.worlds.addObject(body.getObject("result"));
      }

      if (this.worlds.size() == this.queries)
      {
        // All queries have completed; send the response.
        // final JsonArray arr = new JsonArray(worlds);
        try
        {
          // INSTEAD OF:
          //final String result = mapper.writeValueAsString(worlds);
          // HAVE:
          final String result = worlds.encode();

          final int contentLength = result.getBytes(StandardCharsets.UTF_8).length;
          this.req.response.putHeader("Content-Type", "application/json; charset=UTF-8");
          this.req.response.putHeader("Content-Length", contentLength);
          this.req.response.write(result);
          this.req.response.end();
        }
        catch (IOException e)
        {
          req.response.statusCode = 500;
          req.response.end();
        }
      }
    }
With a similar change for Servlets. According to the benchmark results, Onion comes out on top. It's the fastest. But how much of that's because it seems to be written correctly and other tests seem to be written without taking advantage of the same efficiencies.

Is it the case here that some people have sent you test code optimized for their own frameworks?

If that is so, you should add some tests that would not be so amenable to optimization. I'm not picking on Onion here by the way. In fact, the argument could be made that Onion is not actually 'optimized', so much as just written correctly, and the other frameworks have tests written incorrectly. But I just wanted to know if you guys actually intended to use these different implementations for some reason that I am unaware of? Do they make the tests more fair somehow???

Re: Web Framework Benchmarks Round 4

#244
post #16
post #2

This is the most recent update to our ongoing project measuring the performance of web application platforms and frameworks. In this round we've received several more community-contributed tests in Perl, PHP, Python, Java, and JavaScript. Go is a comeback champion thanks to changes made by Brad Fitzpatrick [1] and others in the Go community. A new "Fortunes" test was also added (implemented in 17 of the frameworks) t…

Any reason you didn't test ASP.NET MVC or ASP Web Forms?

ASP.Net kind of put themselves out of the benchmark game here:

Mono Issue #1, since the vast vast majority of ASP.Net websites run on windows a Mono performance test even if accurate is going to be of dubious value.

Mono Issue #2, since Mono is nowhere near as polished as the Microsoft .Net implementation the numbers wont really be meaningful.

Windows Issue #1, if you do the test on a different OS than every other test implementation, the results really wont be comparable in any fair way.

Microsoft Issue #1, dont know if it still holds now a days but in past official EULA for .Net prohibited publishing benchmark results. PERIOD.

I am a .net developer and as much as I like ASP.Net I dont think the effort of adding a .Net implementation really would pay off.

Re: Web Framework Benchmarks Round 4

#245

Earlier quoted context omitted.

This is a good point. Especially if you only cared about how fast you can make your app. But if you want to also consider how cheap you can run your app, you need to consider how many app servers will it take to saturate the DB? 1 or 10? At certain scales for certain tasks, the hosting costs matter more than the development costs.

>But if you want to also consider how cheap you can run your app, you need to consider how many app servers will it take to saturate the DB? Moore's law has made this sorta moot. Unless you're on Heroku, for a successful small-to-medium app, the denominator in your hosting costs is doing to be the salary of the engineer or sysadmin who tends to it. (If you're on Heroku, then you start worrying about dynos because, wi…

Moore's law hasn't made it moot. Running in the cloud is pretty slow and extremely expensive. Look at StackExchange for example - they used to handle a LOT of traffic on a handful of servers. Even these benchmarks say (or said) that the EC2 instance used is waaay slower than an i7 2600K.

Re: Web Framework Benchmarks Round 4

#246

Earlier quoted context omitted.

Really. I've recently been getting into node/express after years of Java, and these results make me feel a whole lot less cool.

I got on the Node thing for awhile too, but went back to Java/JBoss/Tomcat/Spring. If you are skilled with the Java stack it is hard to beat for performance and breadth. If you are not, well, I admit the learning curve is steep.

I definitely agree for large applications.

But for quickly spinning up a few light service endpoints, Node can't be beat. Especially if you are using JSON-based persistence like MongoDB or CouchDB, using JSON all the way from database to the client is a huge win. I get tired of writing lots of JAXB POJOs to map my JSON objects to and from, especially early on in development when those definitions change rapidly. That's why enjoy using Node, especially for "toy" projects. Less boilerplate and more productive quickly.

Side note: I find myself wishing Node had Annotations and AOP... one of Java's coolest (though oft-misused) features IMHO.

Re: Web Framework Benchmarks Round 4

#247

Earlier quoted context omitted.

The requests per second is importanct, but some frameworks seem to get high average throughput but at the expense of a few slow requests. Also when measuring latency, average and std dev are only revelent if the distribution is guassian in distrition. Which is unlikely. Better to show percentile based measurements. Like 90% of all requests served in 5ms, and 99% of requests served in 15ms. See Gil Tene's talk "How no…

"average and std dev are only revelent if the distribution is Gaussian in distrition" technically not true. Knowledge of the second order moment (variance) lets you uniquely identify other distributions like Poisson, or uniform. Knowledge of even higher order moments lets you fit more complicated statistical models. Low variance is good, regardless of underlying distribution.

Probably the statement should be that comparing mean and variance are only relevant if both metrics follow the same distribution. In the absence of distribution information (and it is usually absent in empirical tests like that) quantiles would help to do a better job at comparing performance.

Re: Web Framework Benchmarks Round 4

#248

Wow... some of these tests are still pretty severely hobbled. Is there some reason that you use built in json serialization for some frameworks and not others? There is also a lot of heterogeneity in the implementation of the multiple queries test. For instance, even if I only look at... say... java frameworks, you seem to implement the exact same feature in very different ways between platforms. For instance, for se…

Contribute and we'll see what it does in round 5 ;)

Re: Web Framework Benchmarks Round 4

#249
post #16

Earlier quoted context omitted.

Any reason you didn't test ASP.NET MVC or ASP Web Forms?

ASP.Net kind of put themselves out of the benchmark game here: Mono Issue #1, since the vast vast majority of ASP.Net websites run on windows a Mono performance test even if accurate is going to be of dubious value. Mono Issue #2, since Mono is nowhere near as polished as the Microsoft .Net implementation the numbers wont really be meaningful. Windows Issue #1, if you do the test on a different OS than every other te…

I completely understand your point, but I think it's fair to say that most .Net code will run on Windows server, and that pretty much everything else will run on some kind of linux flavor. Just like you have a "keep the default framework setting" approach to help compare very different frameworks because that's how the majority of people will use them, you may very well assume that comparing frameworks on their preferred OS is fair enough.

I know that i wouldn't mind switching to a windows+.Net environment if it proved to be much much faster than what i'm using right now.

Re: Web Framework Benchmarks Round 4

#250
post #192
post #75

Earlier quoted context omitted.

Java gets that wrap from originally being slow to execute, and also having a huge up-front cost to spin up a VM. The first isn't true any more: the Java VM competes with native code on most benchmarks, and due to its ability to perform runtime optimizations, can occasionally outperform native code. The second doesn't matter at all for web servers. The cost of starting up the web server is tertiary to uptime and perfo…

I agree with everything you've said here, but I'd like to add something about startup time. If it takes you 5s to start up your server, that's a lot of time you've added to each development iteration. Make a change, restart the server, wait 5s, see if it works/check debug output.

This is business as usual for me with ASP.NET. IIS Express has to start, then the app to load, then to initialize, then to compile the views.

And don't get me started on the Azure Compute Emulator.

Post reply on HN