package main
import (
"fmt"
"net/http"
"sync"
"time"
)
func main() {
url := "https://www.baidu.com/"
numRequests := 99999999999999
numConcurrent := 99999999
var wg sync.WaitGroup
wg.Add(numRequests)
client := http.Client{
Timeout: time.Second * 10,
}
for i := 0; i < numConcurrent; i++ {
go func() {
for j := 0; j < numRequests/numConcurrent; j++ {
start := time.Now()
resp, err := client.Get(url)
if err != nil {
fmt.Println("Error:", err)
continue
}
defer resp.Body.Close()
duration := time.Since(start)
fmt.Printf("Status: %d, Response time: %v\n", resp.StatusCode, duration)
wg.Done()
}
}()
}
wg.Wait()
fmt.Println("Done!")
}