This commit is contained in:
李子铭 2025-03-20 15:30:36 +08:00
parent bbf8875e30
commit bedabb1d17
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ func Test_db(t *testing.T) {
start2 := time.Now() start2 := time.Now()
errCount := 0 errCount := 0
var wg sync.WaitGroup var wg sync.WaitGroup
const concurrency = 50 // 调整并发数 const concurrency = 500 // 调整并发数
wg.Add(concurrency) wg.Add(concurrency)
for i := 0; i < concurrency; i++ { for i := 0; i < concurrency; i++ {
@ -49,5 +49,5 @@ func Test_db(t *testing.T) {
} }
wg.Wait() wg.Wait()
fmt.Printf("\n--------------连接请求,总请求耗时: %v,失败次数: %d--------------\n", time.Since(start2), errCount) fmt.Printf("\n--------------连接请求,总请求耗时: %v,总数: %d, 失败次数: %d--------------\n", time.Since(start2), concurrency, errCount)
} }