Code Monkey home page Code Monkey logo

ezlippi / webbench Goto Github PK

View Code? Open in Web Editor NEW
2.6K 120.0 1.2K 74 KB

Webbench是Radim Kolar在1997年写的一个在linux下使用的非常简单的网站压测工具。它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力。官网地址:http://home.tiscali.cz/~cz210552/webbench.html

License: GNU General Public License v3.0

Makefile 7.53% C 78.52% Roff 13.95%

webbench's Issues

mac 下安装报错

➜ WebBench git:(master) sudo make && make install
Password:
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c:77:31: warning: unused parameter 'signal' [-Wunused-parameter]
static void alarm_handler(int signal)
^
1 warning generated.
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install: /usr/local/man/man1: No such file or directory
make: *** [install] Error 71

Ask about the purpose and meaning of some code

This was the first project I studied, probably because of my limited ability, and I found that some places were not well understood. The following three points are some of my questions. Thank you for your guidance.

(1) Why isn't pid < 3 here? Is there any special meaning for pid being 2?

WebBench/webbench.c

Lines 411 to 416 in b1acf3c

pid=fscanf(f,"%d %d %d",&i,&j,&k);
if(pid<2)
{
fprintf(stderr,"Some of our childrens died.\n");
break;
}

(2) Why does the bench() function return i? Isn't this the speed value that the parent process successfully read the last time? Could I change the program to return 0?

return i;

(3) Add close(sock); is it more rigorous?

WebBench/socket.c

Lines 54 to 55 in b1acf3c

if (connect(sock, (struct sockaddr *)&ad, sizeof(ad)) < 0)
return -1;

关于http request的请求方法

HTTP1.0定义了三种请求方法: GET, POST 和 HEAD方法。
HTTP1.1新增了五种请求方法:OPTIONS, PUT, DELETE, TRACE 和 CONNECT 方法。
而代码中仅仅提到了get head options trace,剩余的都没有涉及,是有什么特殊原因吗?

centos8 编译报错

[root@k8s-master WebBench]# sudo make && sudo make install PREFIX=your_path_to_webbench
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c:22:10: 致命错误:rpc/types.h:没有那个文件或目录
#include <rpc/types.h>
^~~~~~~~~~~~~
编译中断。
make: *** [<内置>:webbench.o] 错误 1

variable usage

411 pid=fscanf(f,"%d %d %d",&i,&j,&k);

I think need a new variable here. Otherwise, It may hard to understand.

实现原理

你好,我看了下代码,原理是不是就是通过fork()多个线程然后向http服务器发送请求,你是如何测试的,自己的服务器吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.