
Mongrel是一种快速的Http server for Ruby 她是纯Ruby完成的Http server,她的能力十分强大,同时支持Ruby On Rails, Og+Nitro, and Camping frameworks,你需要安装Ruby1.8.4
安装方法:(windows下)
1.使用gem安装
$ gem install win32-service (pick the most recent one)
$ gem install mongrel (pick the win32 pre-built)
$ gem install mongrel_service
2.开启服务器
$ mongrel_rails service::install -N myapp \
-c c:\my\path\to\myapp -p 4000 -e production
上面的步骤把mongrel加入到windows服务中了
$ mongrel_rails service::start -N myapp
----------------------
One moment, start pending
One moment, start pending
One moment, start pending
One moment, start pending
hi service started
----------------------
*这里hi是我的web app
服务器将在后台运行
这里也可以通过 我的电脑---管理---服务,来启动它
3.关闭服务(器)
$ mongrel_rails service::stop -N myapp
----------------------
There was a problem stopping the service:
当处理控制请求时,在服务中发生异常。
----------------------
*结束时出现错误,不过再次结束的时候出现:
----------------------
There was a problem stopping the service:
服务未启动。
----------------------
*说明服务已经结束
测试:
我这里对Webrick和Mongrel做了一个测试:
测试软件Web-CT,同时使用40次/s,持续10s的测试方式,测试结果如下
Webrick:
|
测试频率:40 测试次数:400 持续时间:10 成功次数:400 接收流量:3020800 平均流速:601 下载文件尺寸:7552 成功率:100% 平均响应时间:12571 |
Mongrel
|
测试频率:40 测试次数:400 持续时间:10 成功次数:400 接收流量:3020800 平均流速:329278 下载文件尺寸:7552 成功率:100% 平均响应时间:22 |
我们注意到平均流速和平均相应时间,我们可以看到他们的差距是惊人的。所以,赶快离开Webrick的世界吧。
当然,Webrick可能会在开发学习阶段给我们带来好处:)
使用WAS测试:
Webrick
|
Stress level(threads):50 Stress multiplier:1 Page Summary
Socket Connects: 2353 |
Mongrel
|
Stress level(threads):50 Stress multiplier:1 Page Summary
Socket Connects: 4919 |
假如对本文有任何意见,已经如果有本方面的信息,请与我联系
Powered by Haiwit