码迷,mamicode.com
首页 > 其他好文 > 详细

wsl下的ab测试存在严重问题

时间:2020-06-26 20:03:59      阅读:61      评论:0      收藏:0      [点我收藏+]

标签:ab测试   pre   level   net   license   licensed   dia   flags   pac   

1. 简单的 golang http 服务器

package main

import "C"
import (
    "log"
    "net/http"
    "time"
)


func init() {
    log.SetFlags(log.Lshortfile | log.LstdFlags)

    log.Println("init done ", time.Now())
}

func main() {

    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello"))
    })

    http.ListenAndServe(":8001", nil)
}

wsl 下 ab 压测

ab -c 100 -n 10000 http://localhost:8001/
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:
Server Hostname:        localhost
Server Port:            8001

Document Path:          /
Document Length:        5 bytes

Concurrency Level:      100
Time taken for tests:   4.292 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      1210000 bytes
HTML transferred:       50000 bytes
Requests per second:    2329.67 [#/sec] (mean)
Time per request:       42.925 [ms] (mean)
Time per request:       0.429 [ms] (mean, across all concurrent requests)
Transfer rate:          275.28 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        9   21   4.2     21      31
Processing:     2   22   4.9     22      43
Waiting:        0   15   5.7     14      31
Total:         26   43   6.1     42      66

Percentage of the requests served within a certain time (ms)
  50%     42
  66%     45
  75%     47
  80%     48
  90%     51
  95%     54
  98%     55
  99%     55
 100%     66 (longest request)

ubuntu 2004 虚拟机内测试

ab -c 100 -n 100000 http://localhost:8001/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            8001

Document Path:          /
Document Length:        5 bytes

Concurrency Level:      100
Time taken for tests:   3.902 seconds
Complete requests:      100000
Failed requests:        0
Total transferred:      12100000 bytes
HTML transferred:       500000 bytes
Requests per second:    25627.61 [#/sec] (mean)
Time per request:       3.902 [ms] (mean)
Time per request:       0.039 [ms] (mean, across all concurrent requests)
Transfer rate:          3028.26 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.4      1       7
Processing:     0    3  20.7      2     502
Waiting:        0    2  20.6      1     502
Total:          0    4  20.6      3     503

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      3
  90%      3
  95%      3
  98%      4
  99%      6
 100%    503 (longest request)

经过多次测试,wsl 根本无法测试展示正常的 http 性能。

wsl下的ab测试存在严重问题

标签:ab测试   pre   level   net   license   licensed   dia   flags   pac   

原文地址:https://www.cnblogs.com/svji/p/13196099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!