搜狐后台开发 pre-interview 题目

2016-02-29 20:18:42 +08:00
 yangxin0

问题: 编写一个 ab(Apache Benchmark) 的替代程序,请尽可能的兼容 ab 你所认为重要的功能和参数。

ab [options] http://hostname[:port][/path]
-n requests number of requests to perform
-c concurrency number of multiple requests to make
-t timelimit seconds to max. wait for responses
-i use HEAD instead of GET
-v verbose

代码在这里: https://github.com/YangXin/ab

使用它: 切换到 ab 的目录直接 make , 然后尝试一下 ./ab -c 20 -n 100 http://blog.csdn.net/johnstrive/article/details/50667557

注意:
1 、在计算一些数据大小的时候我与 ab 有一些不同, 我没有研究 ab 内部实现,但是这些区别不影响我们对结果分析
- 在计算 transfer data 的时候, 我计算从 TCP 拿到的所有数据
- 在计算 html data 的时候, 我计算 http 的 payload

2 、对于 http 协议我也是只实现了一个子集, 我实现了基本的 chunked 模式和 content-length

PS :各位同行有后台开发坑位没, 联系方式 351623084@qq.com

1454 次点击
所在节点    程序员
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/259995

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX