```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
更多评论