Real-world performance of the Play framework on EC2

Recently there have been discussions about the performance of the play framework, after a large collection of web framework test results has been posted on TechEmpower.

Play does well on these tests, but it’s not exceptionally fast. In the article, simple JSON responses are tested on an EC2 large instance, one of Amazon’s faster virtual servers. According to the authors,

  • Play serves ~9000 requests/sec
  • PHP serves ~4000 requests/sec
  • Netty serves ~40000 (!) requests/sec

… just to name a few of the tested frameworks.

Netty was the fastest “framework” in the test, but it’s actually more a web server than a web framework. As a side note, Play uses Netty for serving HTTP requests.

But how how does that compare to a real-world scenario?

Testing what users (and their browsers) really do

Since we’re also using the play framework (2.1.1-scala) in production, we wanted to see how many pages per second we can really serve in our Amazon EC2 environment.

In contrast to the above article, the following results are obtained by load-testing complete pages that we use in production. This means that we download not only the HTML from the server, but also all images, CSS, Javascripts, like normal browsers do.

There were 3 different tests, run on EC2 micro and large instances. (Look how much you can do with a micro instance!)


Test 1 – Small page with database access

A small page with CSS, Javascript, and a picture. It also selects data from a MySQL database, but it’s a simple indexed query. We use Slick for database access.

  • Total page size: 30 kb
  • Total # of requests per page: 4 (Html, Css, Javascript, Png-Image)
  • EC2 Micro Instance result: 30 pages/sec  (120 requests/sec)
  • EC2 Large Instance result: 600 pages/sec (2400 requests/sec)
  • Bottleneck: CPU


Test 2 – Page with lots of content

A larger page with CSS, Javascript and lots of pictures. No database query here. The page is multi-language and uses Play’s Internationalization feature.

  • Total page size: 900 kb
  • Total # of requests per page: 15 (Html, Css, Javascript, 10 Png-Images)
  • EC2 Micro Instance result: 8 pages/sec  (120 requests/sec)
  • EC2 Large Instance result: 90 pages/sec (1350 requests/sec)
  • Bottleneck: Disk/Bandwidth


Test 3 – On-the-fly server-side image resizing

In this test, just one request is made. The server loads a JPEG image from an Amazon S3 bucket, resizes it from 800×600 to a 300×225 thumbnail, and sends it again JPEG-encoded to the client.

  • Total response size: 12 kb
  • Total # of requests: 1 (JPEG-Image)
  • EC2 Micro Instance result: 4 requests /sec
  • EC2 Large Instance result: 160 requests /sec
  • Bottleneck: CPU (the image rescaling algorithm)


Conclusion
: We can serve quite a lot of users with the play framework, using its default settings. Because we did not optimize our code for the benchmarks, we could not serve as many requests as in the article on TechEmpower; but the results are in the same ballpark.

Surprising EC2 micro instance performance

The EC2 micro instances can actually sustain quite a high number of requests per second. If you need to serve 30 full page requests per second (like in Test 1) during peak hours, you’ll probably serve an average of 8 requests per second during the day (4 times less). That’s about 20 GB of data per day, which means you will actually pay an order of magnitude more for the traffic than for the virtual server itself.

(However, running a production server on a micro instance may not be your thing. AWS allows only around 16% of sustained CPU usage on these instances, meaning it’s trivial to DoS-attack your server.)

From an economic perspective, play’s performance means you will be able to focus on other issues, such as saving bandwidth 😉

Posted in Play framework | Tagged , | 9 Comments

Being open to feedback, setting new priorities

As someone who is experienced in tech, but not as much in business, it was interesting to see how many different opinions you can get about your business idea by talking to other founders, investors and business advisors. Just as some programmers may be very religious about using Ruby on Rails, or Python/Django vs. any other technology, many business people seem to be religious about one specific way of doing or growing a business.

So while not all feedback is useful, and while it’s not always clear what is the Right Way To Do It ™, we felt we have to take all of it as serious as possible, and get answers to all the questions people were asking us. And this was an extremely valuable thing to do.

Last week we went to Berlin, and were lucky to get incredibly high-level feedback from a wide range of talented people in the field. It seems that in the course of developing our product, we accumulated an immense amount of ideas and features that could be very important for our community market place in the long run. But the huge amount of features also meant we would need a lot of time to get validation from the market.

Talking with all those people helped us focus again. We need to go back and validate the main value for our customers and getting feedback from them right now. All those cool features have to wait until later. So we will start putting online the very first travel guides soon, and getting feedback as early as possible. 

May the force be with us.

Posted in Startups | Tagged , | Leave a comment

Up and running in 3 days

At the Startup Live Vienna 8 we wanted to get our launch page online in just three days, and that was quite a challenge. A room full of people and a lot of distractions can make it hard to be productive. But then there is the exciting atmosphere and the people staying and working till late in the evening!

I didn’t bring my own laptop for development, and so I had to borrow the MacBook from Biancaco-founder and product designer here at miavia. Only at the event I realized that this was a crazy idea – having a mostly Windows/Linux background, I never worked on a Mac before, and was quite slow to get started with the most basic technical stuff (git, SCP, etc.). Fortunately, we had a great team at the event, I got help to get everything up and running on the Mac – many thanks go to Luis Nell! 😉 Also, we had great support from Stefan Raffeiner, who was quick to implement the HTML and CSS.

So we managed to do it! And this is what we used:

  • We hosted our git repository on dropbox – everyone shouting loud and clear when they would make a commit, so we don’t get a dropbox conflict, hehe
  • The Play Framework has a local development mode, so we could quickly check our changes on a local web server.
  • Stefan worked mostly on the page styles, Luis worked out how to make beautiful cross-device HTML emails, and supported me on the Mac 😀
  • I used the IntelliJ Idea IDE for Scala/CSS/HTML etc., and from time to time checking how the page looks like in Internet Explorer on my netbook

image

From left to right: Stefan, me and Luis. This is going to be a rare picture: me working on a Mac!

Thanks to everyone on our team at Startup Live, what a weekend!

Btw, here is our launch page:

image

Check it out at http://miavia.in !

Posted in Startups | Leave a comment