http server吞吐量测试

环境:windows10 pro

硬件:4核 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GH  16G内存

配置:各个服务器打开长链接,并设置单连接可以保持60秒以上,100万次请求;

每类服务,请求1w次:

apache2.4.391.html 耗时 2016 ms
Nginx1.15.111.html耗时 1158 ms
go http等长字符串耗时 192ms

其中GO的服务代码如下:

package main
import (
    "fmt"
    "net/http"
)
 
func IndexHandlers(w http.ResponseWriter, r *http.Request){

	// fmt.Println("============================")
	 id := r.Header["Pipeline-Id"][0]
	// if len(r.Header) > 0 {
    //   for k,v := range r.Header {
	// 	if (k == "Pipeline-Id"){
	// 	id = v[0]
	// 	}
    //      fmt.Printf("%s=%s\n", k, v[0])
    //   }
	// }
	// fmt.Println("");
    fmt.Fprintln(w, "hello, world===========================================================" + id)
}
 
func main (){
    http.HandleFunc("/", IndexHandlers)
	http.HandleFunc("/hi", IndexHandlers)
    err := http.ListenAndServe("10.128.6.15:80", nil)
    if err != nil {
        fmt.Printf("listen error:[%v]", err.Error())
    }
}

关于pipelining参考:

HTTP管线化(HTTP pipelining) - dzqabc - 博客园

HTTP pipelining - dzqabc - 博客园

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值