webbench

本文深入探讨了webbench网站压力测试的过程与方法,详细解释了如何评估网站在高访问量下的性能表现,并通过示例代码展示了关键函数的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

webbench 网站压力测试


在一个网站上线之前,能承受多大访问量,在大访问量情况下性能怎么样。

压力测试


#include <string.h>
const char * strrchr ( const char * str, int character );
      char * strrchr (       char * str, int character );
returns a pointer to the last occurrence of character in string str. 
char* strstr(const char* haystack, const char* needle);
This function returns a pointer to the first occurrence in haystack of any of the entire sequence of characters specified in needle, or a null pointer if the sequence is not present in haystack.


char* index(const char* s, char c)
index()用来找出参数s 字符串中第一个出现的参数c 地址,然后将该字符出现的地址返回。字符串结束字符(NULL)也视为字符串一部分


strcat
strcpy
strlen
fdopen
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
examine and change a signal action, oldact is to save the old action of signal. 
signum specifies the signal and can be any valid signal except SIGKILL and SIGSTOP
return 0 if success, return -1 if failed. 


#inlcude <unistd.h>
unsigned in alarm(unsigned int seconds)
alarm() arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds.
shutdown/close socket
int shutdown(int s, int how)
how = 0; 终止读取操作
how = 1; 终止写操作
how = 2; 终止读取及写操作
return 0 if success, return -1 if fail


close 关闭本进程的socket id, 便链接还是开着的,用这个socket的其他进程还能用这个链接,能读或者写这个socket id
shutdown 破坏了socket链接,


goto




in_addr_t inet_addr(const char* cp)
The inet_addr() function converts the Internet host address cp from IPv4 numbers-and-dots notation into binary data in network byte order. If the input is invalid, INADDR_NONE (usually -1) is returned. Use of this function is problematic because -1 is a valid address (255.255.255.255). Avoid its use in favor of inet_aton(), inet_pton(3), or getaddrinfo(3) which provide a cleaner way to indicate error return.
           struct sockaddr_in {
               sa_family_t    sin_family; /* address family: AF_INET */
               in_port_t      sin_port;   /* port in network byte order */
               struct in_addr sin_addr;   /* internet address */
           };


           /* Internet address. */
           struct in_addr {
               uint32_t       s_addr;     /* address in network byte order */
           };
void *memcpy(void *dest, const void *src, size_t n);


#include <netdb.h>
struct hostent *gethostbyname(const char *name);


   struct hostent {
               char  *h_name;            /* official name of host */
               char **h_aliases;         /* alias list */
               int    h_addrtype;        /* host address type */
               int    h_length;          /* length of address */
               char **h_addr_list;       /* list of addresses */
           }
#define h_addr h_addr_list[0] /* for backward compatibility */
#include <arpa/inet.h>
uint16_t htons(uint16_t hostshort);
The htons() function converts the unsigned short integer hostshort
       from host byte order to network byte order.


#include <sys/types.h>
#include <sys/socket.h>
int connect(int sockfd, const struct sockaddr* addr, socklen_t addrlen);



                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值