play framework 2 performance issues on virtual machine
Asked Answered
F

1

23

I have recently implemented a very tiny Cassandra web application on both PHP and play frameworks to compare these technologies. I'm running these tests on a virtual machine that has ubuntu-server in it. In both PHP and play framework applications, there is only one URL that makes an insertion to a Cassandra keyspace.

In PHP, I ran the following apache benchmark test;

ab -n 100000 -c 100 http://example.com/insert The test results show that the server can serve 120#/sec (requests per sec)

I have made almost the same application in the play framework using Netflix's Astyanax Cassandra library. However, the server seems to be crushing even at the start of ab.

I'm making the play framework test in production, by play start command on terminal.

So, I know that the play framework is production-ready. So, what am I doing wrong here?

Frants answered 14/6, 2013 at 20:13 Comment(14)
Can you please add more details regarding your VM (how much RAM it can use; is cassandra in the same VM?). Despite I never measured it, I always had the impression Java applications use a lot of memory.Barner
cassandra & play framework & apache2 are in the same vm. It has 2 core cpu's and 2gb of memory. So, it's better than amazon ec2 micro. I'm using Thrift C extension in php. Could the difference be that ?Frants
@Barner btw, I always had the same impression. However, I read that netty servers can do 10 times more requests per secondFrants
Could you put some timers in your Play application, to see where the delay is? Is it in initialisation, loading of libraries, your code, etc.Thievish
@Thievish Well, I have recently tested on the local ubuntu machine of mine. I didn't include any libraries, just wrote a hello world. the result is amazing Requests per second: 2724.22 [#/sec] (mean). So, it's obvious that astyanax made the application super slow. Any clues on how to improve that ??Frants
I'm not familiar with that library, but if the problem is the library and not the framework, I'd approach the library's mailing list or IRC and see if they've encountered it.Thievish
@Frants What version of Play? Can you share the test project?Gooch
@JamesWard it's 2.1.1 version. It's the astyanax library or the virtual machine that runs so slow. Since astyanax is used by netflix actively, I think it's the virtual machine that I'm running.Frants
Just a wild guess here but did you set up your thread pools? Play uses only a small thread pool by default and if your application is doing blocking operations (astyanax is not an asynchronous library afaik), it may be the reason why it appears so slow. Try looking at playframework.com/documentation/2.1.1/ScalaAsync and playframework.com/documentation/2.1.1/ThreadPoolsAntiseptic
very correct, we had to go to 25 threads in playframework as well and got a huge performance boost.Brena
@MartinKolinek I am currently very new to playframework. I'll check thread pool issue and async results, do the recommended and post here. Thank youFrants
You should really try DataStax Java Driver for Cassandra. It uses Netty underneath, allows to execute queries asynchronously, and faster.Cockrell
@Frants What errors are you seeing?Boston
Wow. It's been a long time since the question. It was the time when datastax haven't a java driver. The problem was in the requests per second and I didn't set the thread pools. At that time, it seems that play framework consumes so much memory even the thread pools were default.Frants
P
1

The problem was in the requests per second and I didn't set the thread pools. At that time, it seems that play framework consumes so much memory even the thread pools were default. – aacanakin

Pigskin answered 14/6, 2013 at 20:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.