简体   繁体   English

在Mac上播放框架,性能问题

[英]Play framework on Mac, performance issue

I have installed Play framework on my Macbook pro. 我在我的Macbook pro上安装了Play框架。 Play 1.2.4 on the latest 10.7.3. 在最新的10.7.3上播放1.2.4。 I have 8 GB memory and i7 Quad core cpu (shows 8 cores). 我有8 GB内存和i7四核CPU(显示8核)。

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 我的应用程序类只有1个方法

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 : 当我在这上面运行apache基准时:

ab -n 1 -c 1 http://localhost:9000/ 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. 我得到了很好的数字,但是如果我得到了-n 10,那么所有东西都会挂起来,而我的计算机会在1核心上100%加载并永远保持在那里。

I used to get HEAP errors but I set this as an environmental variable : 我以前得到HEAP错误,但我将其设置为环境变量:

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. 我的同事尝试了我的应用程序,在发送之前我涂焦油和gzipped,他可以很容易地做到-n 10000 -c 1000 dit只是运行并且几乎立即完成,几乎是瞬间完成的。

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 ? 所以我的问题是,我是否必须设置任何其他系统变量或我需要做什么才能使我的Play应用程序在我的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. 只是为了清除事情,我的mac在今天完全是最新的,一切都是99%,因为它来自工厂,可能接近100%,除了我有xcode和这样的安装。

My java is : 我的java是:

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

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. Mac OS X Lion附带的Apache Benchmark实用程序有一个奇怪的错误,它表现在Play 2.0但不是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. 更新版本的ab没有这个问题。 You can build it yourself or download a binary that someone made . 您可以自己构建它或下载某人创建二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM