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