测试一下f1c100s的极限性能,开启1000个goroutine同时打印hello。
待机状态top:
并行hello状态top:
前台打印:
package main
import (
	"fmt"
	"strconv"
	"time"
)
const n = 1000
func hello(i int) {
	for {
		fmt.Println("hello:" + strconv.Itoa(i))
		time.Sleep(time.Second)
	}
}
func main() {
	c := make(chan bool)
	for i := 0; i < n; i++ {
		go hello(i)
	}
	<-c
}离线