We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
测试代码如下
package main import ( "fmt" "github.com/gin-gonic/gin" "github.com/guonaihong/gout" "net/http" "sync" "time" ) func server() { router := gin.New() router.POST("/colorjson", func(c *gin.Context) { c.String(200, string(make([]byte, 2*1024))) }) router.Run() } const nthread = 450 const total = 10000 func useMap() { c := &http.Client{ Transport: &http.Transport{ MaxIdleConnsPerHost: 500, }, } var wg sync.WaitGroup wg.Add(nthread) now := time.Now() defer func() { wg.Wait() fmt.Printf("total:%v\n", time.Now().Sub(now)) }() done := make(chan struct{}) go func() { for i := 0; i < total; i++ { done <- struct{}{} } close(done) }() for i := 0; i < nthread; i++ { go func() { defer wg.Done() for range done { err := gout.New(c).POST(":8080/colorjson"). //Debug(true). SetJSON(gout.H{"str": "foo", "num": 100, "bool": false, "null": nil, "array": gout.A{"foo", "bar", "baz"}, "obj": gout.H{"a": 1, "b": 2}, }). Do() if err != nil { fmt.Printf("err = %v\n", err) } } }() } } func main() { go server() time.Sleep(time.Millisecond * 200) useMap() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
测试代码如下
The text was updated successfully, but these errors were encountered: