玩框架1.2.3 VS IIS 7.5+;ASP.NET4.0

玩框架1.2.3 VS IIS 7.5+;ASP.NET4.0,asp.net,performance,iis,playframework,benchmarking,Asp.net,Performance,Iis,Playframework,Benchmarking,您好,我有点想说,我的小基准测试表明Play的性能无法与.net匹敌,至少在我的小笔记本电脑上是如此。详情如下: 播放代码 // Controller public class Benchmark extends Controller { @CacheFor public static void hello() { String who = "world"; render(who); } } // View hello ${who}! A

您好,我有点想说,我的小基准测试表明Play的性能无法与.net匹敌,至少在我的小笔记本电脑上是如此。详情如下:

播放代码

// Controller
public class Benchmark extends Controller {
    @CacheFor
    public static void hello() {
        String who = "world";
        render(who);
    }
}
// View
hello ${who}!
ASP.Net代码

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Benchmark.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p>Hello <span id="spnName" runat="server"></span></p>
    </div>
    </form>
</body>
</html>

using System;

namespace Benchmark {
    public partial class Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            spnName.InnerText = "world";
        }
    }
}
播放结果:

Server Software:        Play!
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        13 bytes

Concurrency Level:      100
Time taken for tests:   4.839 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      3650000 bytes
HTML transferred:       130000 bytes
Requests per second:    2066.42 [#/sec] (mean)
Time per request:       48.393 [ms] (mean)
Time per request:       0.484 [ms] (mean, across all concurrent requests)
Transfer rate:          736.57 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       7
Processing:     5   48   7.0     45      79
Waiting:        2   33  11.3     34      74
Total:          5   48   7.1     45      80

Percentage of the requests served within a certain time (ms)
  50%     45
  66%     47
  75%     49
  80%     53
  90%     58
  95%     62
  98%     69
  99%     72
 100%     80 (longest request)
asp.net结果:

Server Software:        Microsoft-IIS/7.5
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        5160 bytes

Concurrency Level:      100
Time taken for tests:   3.806 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Non-2xx responses:      10000
Total transferred:      53780000 bytes
HTML transferred:       51600000 bytes
Requests per second:    2627.28 [#/sec] (mean)
Time per request:       38.062 [ms] (mean)
Time per request:       0.381 [ms] (mean, across all concurrent requests)
Transfer rate:          13798.35 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       2
Processing:     6   38   3.8     37      61
Waiting:        4   27   7.6     28      57
Total:          6   38   3.8     37      61

Percentage of the requests served within a certain time (ms)
  50%     37
  66%     38
  75%     39
  80%     40
  90%     43
  95%     44
  98%     48
  99%     51
 100%     61 (longest request)
注:

  • IIS预热非常快,运行基准测试2次以达到其最高性能;而游戏需要4到5次才能达到它的极限

  • 在prod模式下开始播放

  • 更改ab的并发设置对结果2影响不大。我总是在比赛中出局

  • 我的机器配置:Windows7(32位)在HP 4720s上,CPU:i5 M 430 2.27GHz 4核;内存4GB


  • 所以我有点沮丧,因为我是一个剧迷,在这个平台上工作了两年多。有人知道提高Play性能的方法吗?

    我认为Play 1中默认groovy模板支持的性能很差

    在重头戏2中,有一个更快的基于scala的模板引擎

    对于Play 1,有许多其他的模板系统被实现,例如:Japid,我想


    另外:Play1有一个更快的groovy模板引擎实现,您可以在这里找到相关信息:

    以下是我的经验

  • Play在linux/ngix或linux/apache上的运行速度比在windows/iis上快得多

  • Play1.2.x的问题在于它的groovy(动态)渲染引擎;因此,我建议播放2以提高性能和降低内存使用率。正如您所知,Play2的模板引擎基于静态编译的scala代码,我可以说Play2是我见过的最快的web框架

  • 很多时候,我们看到围绕框架的“炒作”,找到真相的唯一方法是自己测试或寻找专业基准。我建议您检查基准测试结果“”。您会惊讶地发现,老式的“JavaServletRaw”在性能框架列表中名列前茅,而忽略了“非阻塞”、Scala和NodeJS等术语


    与Play1相比,Play2可能具有更好的性能,但“低内存使用率”绝对不是事实。运行bootstrap Play1应用程序仅消耗50m内存,运行bootstrap Play2应用程序很容易消耗超过300m内存。

    您是否在应用程序中设置了play.pool=nb proc+1。confI发现将您的结果与我的结果进行比较很有趣()。在我的MacBookPro i7上,我的吞吐量比你大得多。(我知道我有不同的硬件和不同的ab参数。这里有更多信息:如果Windows本机编译的代码在使用Microsoft IIS服务器的Windows平台上运行得比这慢,还有谁认为这会是一件非常遗憾的事?;-)对于我的dev i7笔记本电脑中的空hello world应用,我见过asp.net mvc 4/razor/iis/windows 7/release模式下的4K请求/秒,Mint Linux/Apache/Play 2.0/Scala模式下的9K请求/秒,Mint Linux/Nginx/Play 2.0/ScalaIt模式下的17K请求/秒不是真的。1.这个观点太简单了。2.该请求被缓存1小时,除了第一个请求,所有其他请求都从缓存返回,而不是调用groovy view rendering.agree。。渲染只执行一次,同样,在这个基准测试中,groovy模板没有任何内容。请参阅我在下面回复@mbknor中的评论。我可以接受Play正在linux/nginx point上运行。但是需要验证。play 1.2.x和2.0的区别不仅在于模板系统,还有静态路由、与akka更好的并发性等等。还可以看看这个基准。在这个基准测试中,正如您所看到的,Play1.2.1Groovy比一些框架(一些rails变体和groovy…)慢,但是使用japid或scala模块的Play1.2是最快的。
    Server Software:        Microsoft-IIS/7.5
    Server Hostname:        localhost
    Server Port:            80
    
    Document Path:          /
    Document Length:        5160 bytes
    
    Concurrency Level:      100
    Time taken for tests:   3.806 seconds
    Complete requests:      10000
    Failed requests:        0
    Write errors:           0
    Non-2xx responses:      10000
    Total transferred:      53780000 bytes
    HTML transferred:       51600000 bytes
    Requests per second:    2627.28 [#/sec] (mean)
    Time per request:       38.062 [ms] (mean)
    Time per request:       0.381 [ms] (mean, across all concurrent requests)
    Transfer rate:          13798.35 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        0    0   0.4      0       2
    Processing:     6   38   3.8     37      61
    Waiting:        4   27   7.6     28      57
    Total:          6   38   3.8     37      61
    
    Percentage of the requests served within a certain time (ms)
      50%     37
      66%     38
      75%     39
      80%     40
      90%     43
      95%     44
      98%     48
      99%     51
     100%     61 (longest request)