GO请求后端为什么这么慢

michael_xu · · 2818 次点击
![WX20171107-200230.png](https://static.studygolang.com/171107/f543ffe97e8c20e6d043f30b6c16b223.png)
#4
更多评论
```go package main import ( "fmt" "time" "net/http" ) var netClient = &http.Client{} func init() { tr := &http.Transport{ MaxIdleConns: 100000000, MaxIdleConnsPerHost: 100000000, } netClient = &http.Client{Transport: tr} } func R(logid string){ timer_1 := time.Now().UnixNano() _, err := netClient.Get("http://127.0.0.1:8080/profile/encrypt?keys=1") timer_2 := time.Now().UnixNano() fmt.Println(logid, ((timer_2 - timer_1)/1000000), "ms", err) } func main() { for n := 0; n <= 500; n++ { //time.Sleep(time.Microsecond * 2) go R(fmt.Sprintf("%d-%d",n, time.Now().UnixNano())) } time.Sleep(15 * time.Second) } ```
#1
怎么慢法?QPS和RT能到多少?服务器端什么实现?技术问题不应该只提供情绪和感受吧?
#2