9 ms·
Web Framework Benchmarks
- ksec 8y agoThe Blog post [1] which explains things in details. Basically they discovered Docker! Given the amount of hype it had for the best 2-3 years I am surprise, Now it is all Kubernetes. ( Or was that a joke I am not getting ) They had new hardware, and I am surprised it was sponsored by Microsoft. They are also using Azure for Cloud. And the hardware is recent and much better represent the common usage. Before it was a Quad Socket CPU platform that I doubt many are using. I know a lot of these does not represent real world usage. But even if we pick, Full Stack Framework, ORM usage, Realistic implementation, ignoring the erroneous results at the bottom, we still have a gap of 50x difference in Fortune, which is the only results I look at. I didn't check out why Ruby + Racks were not working. Hanami wasn't working either. So the best results for Ruby were roda & sequel, both framework by Jeremy Evans. [1]https://www.techempower.com/blog/2018/06/06/framework-benchmarks-round-16/ https://www.techempower.com/blog/2018/06/06/framework-benchm...
- bhauer 8y ago> ( Or was that a joke I am not getting ) Yes, that was a bit of a joke in the blog entry. We suspected for years Docker would be a good fit for this project. Only within the past months did we find the time necessary to convert the hundreds of test permutations to Docker. It wasn't a quick thing, but we did get into a rhythm. The "joke," for whatever it's worth, is simply that we didn't sufficiently appreciate how useful it would be for this project and how insignificant the overhead would be. Perhaps we would have prioritized it higher in the past had we known. But it's done now! In brief, the Docker conversion effort has increased the stability and reliability of the results. There are a huge number of ways to consume the results and as many opinions. We welcome the diverse points of view and hope you find the data useful!
- wheaties 8y agoI love these but I've also seen in some of the implementations that I care about a bit of benchmark gaming. That saddens me and I wonder just how much of it is happening in languages and frameworks that I don't follow.
- brightball 8y agoIt's interesting to look at the source code. There's definitely some heavy differences in how each implementation is handling underlying aspects of the tests. Just looking at the database related ones to see about some of the differences in interesting. It also doesn't look like the Elixir code has really been updated in about 2 years (aside from version bumps). It's still using a JSON encoder (Poison) that's 4x slower than the primary one (Jason). For multiple queries, Ecto hands back the connection after every query for concurrency sake. Looks like the Plug logger is still setup on the endpoint. I'd be really interested to see the Discord folks look at that as a pet project. :-)
- nobleach 8y agoThat's the beauty of these "pinewood derbies" though. Sometimes they sit dormant until some kind soul says, "HEY!, that's not representative of my favorite framework!" and submits a PR to showcase its true capabilities.
- sqidyyy 8y agoI could never explain why mojolicions (Perl) was placed 5th on "Data updates" in Round 14. Guess that's a think of the past now. (53rd)
- bhauer 8y agoI wrote the blog entry for this round [1], and I would agree with ksec (elsewhere in these comments) in recommending that readers start there since it includes the highlights of this round. I apologize ahead of time for my humor. It's still a bit early out here in California, but if anyone has any questions, I will try to answer as I can! [1] https://www.techempower.com/blog/2018/06/06/framework-benchmarks-round-16/ https://www.techempower.com/blog/2018/06/06/framework-benchm...
- tomaha 8y agoDo you have any plans to add memory usage to the benchmarks? It adds an extra dimension and sometimes even shows if there's a problem with a specific implementation (e.g. in the benchmark game it's often a hint for a program that can be optimized if the ratio compared to other languages is off).
- bhauer 8y agoYes! In fact, I just responded to a similar question over at the Rust Subreddit thread about the same topic. We do in fact capture dstat data while executing the tests but as of today do not render these in any way. You can find raw CSV output from dstat at our logs server. For example at [1] are stats for Grizzly while measuring the "json" test type. I will create an issue at the project's GitHub repo to begin a conversation about which stats to render. I'd like to select a meaningful bite-size set of stats that we can render into a table view. Basically another tab in the results view similar to the latency tab. [1] http://tfb-logs.techempower.com/round-16/final/grizzly/json/stats.txt http://tfb-logs.techempower.com/round-16/final/grizzly/json/...
- tomaha 8y agoThat's great. Thanks.
- drunner 8y agoIf I could make a recommendation that would humor me personally, you could publicize the stats required to run the instance on an B1S or Fv2 Azure instance. I think it would be really interesting to see which frameworks are so costly upfront that they would impede a developer from prototyping with them on the cheap.
- bilbo0s 8y agoI had not checked these for a good long while. (Probably around round 10 or 11.) Looking back in on it now, holy MAN! C (C++) and Java. Wow. Even though I'm old, I'd sort of forgotten how speedy they can be. It's strange, because I actually work with Java and C in making streaming game engines. And you kind of get used to thinking in terms of millions on a set of hardware. So you think Java and C are slow. Then you realize if you were using Python or Node or anything other than C or Java really, you'd likely still be working out how to support tens of thousands on that same set of hardware. (If that.) We can get so used to what we have. Maybe that's just a human thing.
- christophilus 8y ago> Anything other than C or Java really Rust, C#, and Go also seem to fit the bill, according to these benchmarks. C# particularly has rocketed up since the last time I looked in depth at these. Pretty impressive work from the .NET Core folks, I'd say.
- sbhn 8y agoPlus one for c#, with compiler optimisations I was able to generate millions of sha256s a second, many more than my c++ version of the same code. Then I discovered CUDA, then I got bored and went onto something else.
- Spartan-S63 8y agoFor Rust, I'm interested to see what the future holds once the community coalesces around an async IO interface. Additionally, when procedural macros stabilizes (for real), the possibilities for ergonomic frameworks in Rust become endless. Rocket has been really interesting to work with, but it only works on nightly since it relies on experimental codegen/procedural macro features. Once procedural macros stabilizes, all the codegen can be ported to that. It doesn't support async IO yet, but that's because it's waiting for the community to coalesce before diving into it. I think there's a future where Rust web frameworks are as expressive as Rails or Laravel but bring type safety and sound, zero cost abstractions to the table.
- argonium 8y agoI've been following these benchmarks for some time, and am always shocked that Spring does so poorly (it's 7% here). I haven't had any performance issues with Spring in production, so these benchmarks are puzzling. Are the other frameworks really that much faster in practice?
- christophilus 8y agoWhat kind of traffic do you see in production? Rails gets hammered in these benchmarks, but does just fine for most companies' requirements. It's pretty rare that you'd actually need to eke out the raw numbers that the top contenders get. I'm of the opinion that-- within reason-- developer ergonomics, and ability to quickly solve business problems are more important than raw performance, so long as performance is good enough by some agreed upon metric.
- argonium 8y agoGood point. Thanks for the feedback. Our sites don't get a huge amount of traffic, so it's possible Spring doesn't have as good a concurrency story (or it's due to memory usage) as the higher-ranked frameworks, so it's been sufficient for our needs.
- atonse 8y agoYep I feel the same about Elixir and Phoenix. It's way down but again, the "way down" is 20k requests per second. Not too shabby. The biggest project I've worked on had 50 requests per second, and that was an E-Commerce site that brought in 9 figures a year in revenue. I'm sure IoT workflows are mainly where you start to see these more insane RPS numbers. But still, this just tells me there's so much great choice out there for pretty much any platform you want to stick with. I'd love to see another metric that normalizes between Cloud and Physical, like $ per request. We don't know how much the cloud server cost vs the physical, do we? I mean it's a 10x difference in performance, is it a 10x difference in price? Update: Azure D2v3 instances (used for the cloud benchmark) are about $55 a month. ($660 a year). Just the Xeon in the physical costs $1,500. The full server probably costs $5k? So assuming a server has a life of 3 years, you're looking at the Azure instance being $1,980, the Dell being maybe $5k? So it's about 10x performance for 3x the price. Someone please fix my math and fill in the gaps :)
- kizer 8y agoIs 'Fortunes' a test involving the quote generating program? Also, is the difference between 'Single Query' and 'Multiple Queries' concurrency? I always look at these but I have trouble understanding the test cases.
- bhauer 8y agoThe best resource to answer your questions is the Requirements for the various test types [1]. But in brief: * Yes, Fortunes is named after the Unix tool of the same name. In our case, it's a test that executes a query of all rows in a table, adds an additional item, sorts the values in the application code, escapes the values as a XSS countermeasure, and then renders them using a server-side templating library. * Yes, the single-query test is always executing a single-query per HTTP request and is measured at various concurrency levels. The multi-query test is measured with consistent concurrency and varies the number of queries executed per HTTP request. [1] https://www.techempower.com/benchmarks/#section=code https://www.techempower.com/benchmarks/#section=code
- kizer 8y agoThank you
- onion2k 8y agoThese are fun benchmarks, but every single framework in the top 250 or so is more than fast enough for most apps. Even the slowest in the list manages 366/requests per second, which is probably enough to prove an idea before optimizing for speed. We're approaching the point where speed is essentially a solved problem unless you're at Google-scale.
- lllr_finger 8y agoIs it? Concurrent connection handling at scale is a major problem, and plenty of Fortune 1000 companies would jump at the chance to have even 5% fewer instances deployed. 366 rps in a test scenario doesn't scratch the surface of what I need, and I'm not doing anything I'd consider crazy scale. When you need to support hundreds of thousands of rps, small improvements can be very noticeable.
- bpicolo 8y ago> plenty of Fortune 1000 companies would jump at the chance to have even 5% fewer instances deployed. Becoming a Fortune 1000 company isn't "most apps"
- mkirklions 8y agoI'll tell you what. When I'm a fortune 10,000 company, we can afford to rewrite the web app.
- ddorian43 8y agoBut do they rewrite ? Twitter did. Facebook didn't.
- chipotle_coyote 8y agoFacebook wrote a new PHP VM and forked the language, so while it may not technically be rewriting...
- tomnipotent 8y ago
- reacharavindh 8y agoIt is interesting to watch the latency numbers from the table(in a separate tab). I suppose latency is more important to most users than the peak throughput, considering that production applications almost never hit peak throughput and are often supplied with extra hardware before utilisation gets there.
- mozumder 8y agoHow different are the various frameworks here? Are they all running with SSL? Do they keep track of session cookies? Do they have Content Security Policy headers? etc.. There's probably a million different feature configuration differences between each framework.
- bhauer 8y ago> How different are the various frameworks here? Quite different. We have included test implementations for frameworks that span 26 computer languages. There are an infinite variety of opinions about how to do things in computer programming in general, and our project is no exception. And on the other hand, fairly similar. Tests should stick to the requirements [1], which are designed to be permissive but sufficiently clear on the expected work load of each test type. The principal goal is that test implementations should be realistic, and we will mark those the community believes are not realistic as "stripped" implementations. > Are they all running with SSL? No, not yet. But planned future test types would include SSL/TLS. > Do they keep track of session cookies? Generally no. These are intended to exercise anonymous requests. But a future test type could include session management. > Do they have Content Security Policy headers? No, that is not a requirement of our tests. We have specified which headers we expect. Others are optional. > There's probably a million different feature configuration differences between each framework. Yes. And it can be challenging at times to get all of these opinions to fit into the same box. For example, we've to-date kept SQLite implementations out of the project since those would not incur network costs. And other times the box has to be reshaped a bit to make room for new consensus opinions about what is suitable for "production." We recently made a decision to allow for innovative features in the Postgres protocol that are—in a manner of speaking—analogous to automatic pipelining. That conversation is still ongoing on our discussion forum. [1] https://www.techempower.com/benchmarks/#section=code https://www.techempower.com/benchmarks/#section=code
- mozumder 8y agoSo, anyone can submit a framework here as a docker container? I'd love to send in my custom framework for benchmarking.
- dorfsmay 8y agoIt looks like the bottleneck here is the database driver (or possibly ORM when used). The plaintext test shows a very different picture: https://www.techempower.com/benchmarks/#section=#section=data-r16&hw=ph&test=plaintext https://www.techempower.com/benchmarks/#section=#section=dat... PS: As a side note, I do not like golang, my focus has been on python and now rust, but I am very impressed by both the plaintext and the DB test!
- tomchristie 8y agoI think TechEmpower are doing a great job on these generally, but the plaintext benchmark is problematic because they allow pipelining. (Which isn’t enabled in browsers, isn’t typically used in request libraries and tools, and has generally been sidelined) Frameworks which are tailored with that in place can get a big boost in the ratings there. If you want a measure of plain request/response I’d use the JSON benchmarks as the baseline.
- bpicolo 8y agoThe bottleneck on plaintext appears to potentially be physical network bandwidth. https://github.com/TechEmpower/FrameworkBenchmarks/issues/3538 https://github.com/TechEmpower/FrameworkBenchmarks/issues/35...
- dorfsmay 8y agoAgreed, but it shows the framework that are able to reduce their overhead, since they aren't all at 100% of the fastest.
- narrator 8y agoOne thing I've noticed is that all the fastest implementations now run PostgreSQL. For the longest time MySQL was thought to be faster, so I guess PostgreSQL really caught up recently. I'm seeing it be the default database in a lot of new open source projects.
- aninteger 8y agoThis is probably due to the fact that PostgreSQL (libpq) has an "async" interfere built in and MySQL/MariaDB don't. These benchmarks are running very basic queries that perform well on either MySQL or PostgreSQL.
- db-dzine 8y agoCan someone explain me why php5 is faster than php7?
- systematical 8y agoI'm confused by this as well. Though I've seen odd things locally like 7.1 being significantly slower than 7.0 when doing local AB tests.
- jaequery 8y agotheres a lot of weird things that dont make sense. like how a minimalistic framework sinatra/padrino is slower than rails doesnt seem to make sense at all. i feel these benchmarks are misleading to say the least.
- gregoriol 8y ago+1, and the test seems to use php 5.5, this is definitely not OK Also since we are at php, how Laravel is much faster than Symfony? and why Symfony has so many error?...
- IshKebab 8y agoThis should clearly show this as time per request rather than requests per second, since these are really trivial requests and aren't going to be representative of actual performance differences in the real world.
- dorfsmay 8y agoIt is really surprising that the same frameworks are much slower running pypy than cpython. I'm assuming all the result are run from cold... Considering that webserver rund for long period of time, it'd be interesting to measure after several runs, and see how the JITted platforms (pypy, java etc...) place in comparison.
- tomchristie 8y agoNope, they run a warm up stage.
- dorfsmay 8y agoThanks, I browsed quickly through the explanations and didn't see that. That explains why java frameworks are doing so well but raises questions about pypy! EDIT: Looking closer, tornado is faster running pypy.
- akmittal 8y agoJust a reminder if speed was the only thing that mattered we all would be using assembly now.
- mkirklions 8y agoIm with you, although we will see if animations can hide loading times. Btw, you will always have people that disagree with you. I get crap about the loading time of my website, but since I changed to a massive beautiful change, my conversion doubled overnight. I think a human can decide for themselves if something takes too long. I ran into this issue and optimized, but I wouldnt be chasing benchmarks.
- akmittal 8y agoI'm not saying performance doesn't matter I'm saying performance is NOT ONLY thing which matter.
- meritt 8y agoThis is the first time the PHP extension swoole (an async library) was on the test. It took #10 place on the JSON serialization test. The remainder of the tests rank terribly because the implementation incorrectly uses synchronous DB calls, but once that's fixed it should be very promising.
- beal 8y agoThere is a lot of effort being spent measuring what is very rarely a performance bottleneck in web applications.
- blunte 8y agoI'm not familiar with this site and benchmarks, but from reading comments it seems to be respected. Given that, I'm confused why this is called "web framework" benchmarks. It looks to me like it is comparing some actual frameworks (which rank very poorly) against minimalist, task-focused http servers (which rank highly).
- aninteger 8y agoYes, exactly. I'd love to see some examples of a CRUD based API built on top of h2o. At least this appears to be possible with one of the higher performers (cppcms).
- ksec 8y agoInteresting I just submitted h20 2.3 Beta, but it seems to be not getting much interest on HN. It could have been called 3.0 with so many new features.
- spullara 8y agoI think that it allows you to evaluate the tradeoff between DIY services on raw http servers and using a framework that reduces development time but is much slower in production.
- bhauer 8y agoWe use the word "framework" as a term of convenience covering the full spectrum from platforms, micro-frameworks, to full-stack frameworks. We are also liberal with accepting contributions from the community, which means we do indeed include several frameworks that are well outside the mainstream. That said, in tests such as Fortunes, you will see many full-stack frameworks demonstrating their capability to deliver myriad web application fundamentals (such as request routing, database connection pooling, ORM, XSS countermeasures, character encoding, data structures, and server-side templates) at very high performance levels. This project establishes a high-water mark of performance. Very few web applications process anything remotely close to the requests per second we're measuring. But using Fortunes as a proxy and applying a coefficient (e.g., 0.005) to adjust for real-world application sizing can give you a very rough but nevertheless potentially useful approximation of real-world expectations. For example, one can guess their application is 200 times more complex than our Fortunes test. Rough back-of-the-envelope math will then estimate a framework from the ultra-high performance tier (~200,000 fortunes/sec) might yield a generous ~1,000 real-world app requests per second on a modern Xeon server. Meanwhile, a framework in the middle tier (~10,000 fortunes/sec) would yield a more constraining ~50 real-world app requests per second. Again, this math is hand-waving and you can interpret the results in whatever way you prefer; you can dismiss the validity of approximating things so coarsely. But my experience is that real-world applications based on frameworks I've used—which are sprinkled among all tiers of our results—do align with this hand-waving approximation. Edit: I invite you to read the last section of the blog entry about this round [2] where I argue the same point in another way and share one of the tweets from an application developer whose real world application benefited from the performance improvements made to his favorite framework. [1] https://www.techempower.com/benchmarks/#section=motivation https://www.techempower.com/benchmarks/#section=motivation [2] https://www.techempower.com/blog/2018/06/06/framework-benchmarks-round-16/ https://www.techempower.com/blog/2018/06/06/framework-benchm...
- stunt 8y agoTrust me. You won't hit 424,712 requests per seconds per each node (that is 1,528,963,200 per hour). You need to have many nodes and a a well distributed and scalable infrastructure to handle 1B req/hr. There is no point to benchmark your programming-language/framework when doing web development. When it comes to web, you will hit N different capacity limits before that even with slowest framework, starting from your database, network connections, bandwidth, third-party API rate limits, IO performance etc... Consider only a few options base on project requirements, ecosystem, productivity, and available human resources. then compare the top two on performance. You can't compare H2O and Rails on the same list. they are two different animals. Moreover, I'm sure all of these frameworks are not well optimized for a raw performance benchmark, and also these results are heavily affected by filters you are choosing. Don't spend time on pointless benchmarks.
- 3pt14159 8y agoYep. It took me about six months to write a replacement of ActiveRecord with an identical API (for what was needed) that could scale to arbitrarily large number of writes. Shit, pre-A16Z raise 500px ran on Rails and they were a social network around photography. You think Twitter is bad? Try timelines where you have half a million photographers liking hundreds of photos an hour and every like gets pushed into every feed of the people following them. Guys syncing their entire photo library. It was 5 application servers, 4 MongoDB servers for the timeline with some crazy data structures, one or two MySQL DBs. I think most web projects these days should be in either Pheonix, Rails, or similar. If you need something really fast here or there just fork off the request in Nginx or compile something in Rust or C and extend it into Ruby (or whatever). Or have a compiled worker that communicates through the DB or Redis. There is this long tail of UI you need to make for every web project and nobody uses it 99.999% of the time. It should be in whatever secure language / framework that brings it to market fastest.
- ksec 8y ago>Yep. It took me about six months to write a replacement of ActiveRecord with an identical API (for what was needed) that could scale to arbitrarily large number of writes Sorry to ask, would that be open sourced? >It was 5 application servers, 4 MongoDB servers for the timeline with some crazy data structures, one or two MySQL DBs. That is a little hard to warp my head around, because pre-A16z 500px was a long time ago? Hardware should be much slower and Ruby was way slower as well. We have 2-3x faster hardware and faster ruby today, and the same hardware surely won't do much with Discourse and Gitlab scale.
- marsrover 8y agoI have been working with .NET Core since RC1 and I am so excited about the performance it's getting. Ranked 7? That's seriously impressive. Just go look at some of the past benchmarks.
- hungerstrike 8y agoI think it would have been even faster if they'd test with SQL Server because you can do things with SQL Server that you simply cannot do in PG such as stored procedures that return multiple resultsets, which saves a ton of round-trips.
- zapov 8y agoYou can do even more advanced stuff in Postgres, but they've changed the rules to dissalow it since it much more faster than the the current best ones. Something about being fair to other frameworks...
- hungerstrike 8y agoCan you request multiple heterogeneous result-sets from PG now, with something that looks like a stored procedure? I'd love to see what that looks like. In SQL Server it's as easy as putting 2 SELECT statements in the same procedure.
- zapov 8y agoHere is an old post of mine about that: https://blog.dsl-platform.com/multiple-result-sets-alternatives-in-postgres-3/ https://blog.dsl-platform.com/multiple-result-sets-alternati...
- anarazel 8y ago> Can you request multiple heterogeneous result-sets from PG now, with something that looks like a stored procedure? Not prettily. You can return cursors, you can use json etc, ... But you can pipeline SQL statements. I.e. just send N SQL statements (including bind parameters etc, the protocol is the same) without waiting for results, and then process the results as they come in. If you want to avoid latency penalties that makes much more sense in my opinion than having to wrap multiple statements in a function.
- spullara 8y agoCheck out vertx on the multiple query benchmark - it is almost twice as fast as the next entry. Just got confirmation from TechEmpower that they are using a new pipelining feature in postgres to wipe the floor with the rest of the field. https://twitter.com/sampullara/status/1004753777209962497 https://twitter.com/sampullara/status/1004753777209962497
- handbanana 8y agoRails :(. Would be interested to see how it fairs using the most up to date rails/ruby versions