Привет, я немного скажу, что мой маленький тест производительности показал, что производительность 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";
}
}
}
инструмент тестирования: ab, работающий на той же машине:
`ab -n 10000 -c 100 http://localhost/`
Результат воспроизведения:
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 разогреваются очень быстро, дважды выполните тест производительности, чтобы достичь максимальной производительности; в то время как Play достигает 4 или 5 раз, чтобы достичь своего ограничения.
Воспроизведение начинается в режиме Prod.
изменение одновременной настройки ab не сильно влияет на результат 2. IIS всегда вне игры.
Конфигурация моей машины: Windows 7 (32-битная) на HP 4720s, CPU: i5 M 430, 2,27 ГГц, 4 ядра; память 4ГБ
Так что я немного расстроен, потому что я большой фанат игры и работал на этой платформе более 2 лет. Кто-нибудь знает какой-нибудь способ улучшить производительность Play?