1
掛我有這個Google Dart測試程序:一個簡單的飛鏢HTTP服務器上的Apache臺
#import('dart:io');
main() {
var s = new HttpServer();
s.defaultRequestHandler = (HttpRequest req, HttpResponse res) {
res.statusCode = 200;
res.contentLength = 4;
res.outputStream.writeString("sup!!");
res.outputStream.close();
};
s.listen('127.0.0.1', 80);
print('its up!');
}
它適用於Chrome和Firefox罰款,我得到的SUP -messages。
然而,當我嘗試阿帕奇工作臺反對它,它掛起(ab
掛起):
Z:\www>ab -n 1 -c 1 "http://127.0.0.1/"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)...apr_poll: The timeout specified has expired (70007)
您可以通過安裝Apache HTTP服務器找到ab
,它會在bin
文件夾下的定位。
在旁註:是否有一些其他基準測試工具類似ab
,我可能會使用(並不掛)?
這個,也調用'res.persistentConnection = false'這個技巧! – Tower 2012-07-16 18:58:39