Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play framework on Mac, performance issue

I have installed Play framework on my Macbook pro. Play 1.2.4 on the latest 10.7.3. I have 8 GB memory and i7 Quad core cpu (shows 8 cores).

This is all extremely cool and I am having fun coding in play. But then I just wanted to see what a performance I should be getting in production, so I changed the application config like this :

prod.application.mode=prod

My application class only has 1 method

public static void index() {
    String theman = "You are the man";
    render(theman);
}

and my application template for index is this :

#{extends 'main.html' /}
#{set title:'Home' /}

The man is ${theman}

Thats all.

When I run apache benchmark on this like :

ab -n 1 -c 1 http://localhost:9000/

I get good numbers, but if I got to -n 10 everything just hangs and my computer goes to 100% load on 1 core and just stays there for ever.

I used to get HEAP errors but I set this as an environmental variable :

export _JAVA_OPTIONS="-Xms800m -Xmx1500m"

And now I no longer get any errors, anywhere.

My co-worker tried my app which I tarred and gzipped before sending over, he can easily do -n 10000 -c 1000 an dit just runs and finished in no time at all, almost instantaniously.

So my question is, do I have to set any other system variables or what do I need to do to make my Play app run on my mac ?

Just to clear things, my mac is totally up to date by today, everything is 99% as it came from the factory, probably closer to 100%, except that I do have xcode and such installed.

My java is :

java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

uname -sa

Darwin xxx.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
like image 825
Trausti Thor Avatar asked Oct 08 '22 08:10

Trausti Thor


1 Answers

I also had this problem.

The Apache Benchmark utility that comes with Mac OS X Lion has a strange bug that manifests itself with Play 2.0 but not Play 1.2.x. On my machine, it duplicates each request, sometimes up to a dozen times.

You can verify this by running a single test and then seeing how many hits are in your log files.

More recent versions of ab do not have this problem. You can build it yourself or download a binary that someone made.

like image 146
msponer Avatar answered Oct 13 '22 10:10

msponer