[go-nuts] Re: goroutine priority

2024-09-25 Thread 'Zhao Weng' via golang-nuts
Just realized I now to use taskset to make sure all the goroutine run on the same CPU sudo taskset -c 7 ./sche -r 0.3s and It's working now On Thursday, September 26, 2024 at 11:49:53 AM UTC+8 Zhao Weng wrote: > Hi gophers, > I'm doing a research on how to prioritise some goroutines over other

[go-nuts] goroutine priority

2024-09-25 Thread 'Zhao Weng' via golang-nuts
Hi gophers, I'm doing a research on how to prioritise some goroutines over others.So I can allocate more CPU resource to more important part of the program. I try to do it by calling runtime.LockOSThread to assign the goroutine needs to be prioritise to a designated OS thread, and unix.SchedSetA

[go-nuts] strange perf sample when trying to understand the cause of high minor page fault

2024-05-09 Thread 'Zhao Weng' via golang-nuts
Hi gophers, We have a web service running with high minor page fault and I'm trying to understand why. I start by using linux perf: ```bash sudo perf record -e minor-faults -c 1 -C 0-2 -ag -- sleep 15 sudo perf script > perf.out ``` and in the output file perf.out, I found many strange trace reco

Re: [go-nuts] Some questions about GC and map[int]int

2023-11-26 Thread 'Zhao Weng' via golang-nuts
vice which has a long-lived >>>>> map[int]int in memory, we constantly add new data to it and maintain its >>>>> size by calling delete() when oversize, we assume there should not >>>>> result >>>>> in GC overhead growth as time goes by. >

[go-nuts] Some questions about GC and map[int]int, please help

2023-11-23 Thread 'Zhao Weng' via golang-nuts
Dear Gophers: I have some questions about GC and map[int]int, please help. consider the following program: ```go package main import ( "fmt" "os" "runtime/pprof" ) func main() { f, err := os.OpenFile("memory.pb.gz", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666 ) if err != nil { panic(err) } m := ma

[go-nuts] Some questions about GC and map[int]int

2023-11-23 Thread 'Zhao Weng' via golang-nuts
Dear Gophers: I have some questions about GC and map[int]int, please help. consider the following program: ```go package main import ( "fmt" "os" "runtime/pprof" ) func main() { f, err := os.OpenFile("memory.pb.gz", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666 ) if err != nil { panic(err) } m := ma

[go-nuts] Some questions about GC and map[int]int

2023-11-23 Thread 'Zhao Weng' via golang-nuts
Dear Gophers: I have some questions about GC and map[int]int, please help. consider the following program: ```go package main import ( "fmt" "os" "runtime/pprof" ) func main() { f, err := os.OpenFile("memory.pb.gz", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666 ) if err != nil { panic(err) } m := ma

[go-nuts] Some question about GC and map[int]int

2023-11-23 Thread 'Zhao Weng' via golang-nuts
consider the following program: ```go package main import ( "fmt" "os" "runtime/pprof" ) func main() { f, err := os.OpenFile("memory.pb.gz", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666 ) if err != nil { panic(err) } m := make(map[int]int) for i := 0; i < 10e6; i++ { m[i] = 2 * i } if err := pprof.W

[go-nuts] Re: Go 1.17.1 runtime seems retain too much memory from OS

2022-11-23 Thread &#x27;Zhao Weng&#x27; via golang-nuts
sorry for being not specific. my question is: according to my understanding about memstat ( correct me if I'm wrong) with GOGC set to 50, I can see from the graph above that GCGoal is ~ 26GB and heapIdle - heapReleased is how much memory go runtime retain from OS for later usage, how can it (he