通过node js几行代码即可实现静态资源处理服务器.
var connect = require("connect"); var serveStatic = require("serve-static"); var app = connect(); app.use(serveStatic("/home/用户名/file"),{ maxAge: '30d' }); app.listen(5000); //监听5000端口
通过ab压测对比 tomcat ,在https下
ab -n 1000 -c 1000 https://XXXXXXXXXX
tomcat | nodes | |
50% | 280 | 269 |
66% | 499 | 332 |
75% | 680 | 524 |
80% | 751 | 699 |
90% | 1771 | 1559 |
95% | 3546 | 3380 |
98% | 13712 | 7007 |
99% | 13932 | 13848 |
100% | 14173 | 14139 |
ab -n 1000 -c 500 https://XXXXXXXXXX
tomcat | nodes | |
50% | 1730 | 1356 |
66% | 3730 | 3273 |
75% | 6672 | 6535 |
80% | 8303 | 7993 |
90% | 15027 | 14869 |
95% | 15847 | 14970 |
98% | 16371 | 15196 |
99% | 16432 | 15214 |
100% | 16865 | 15398 |
打开的图片越大,访问越多,区别越明显.