Skip to content
New issue

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

gc tunner not Use in not web application #146

Open
johnsGuo opened this issue Jul 13, 2022 · 0 comments
Open

gc tunner not Use in not web application #146

johnsGuo opened this issue Jul 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@johnsGuo
Copy link

johnsGuo commented Jul 13, 2022

Operating System

Linux

Go Version

go version go1.16.15 darwin/amd64

Package Version

develop

Affected Packages

gctunner

Expected Behavior

use GODEBUG=gctrace=1 go run main.go to start
want see gc not frequent

Actual Behavior

gc frequent
gc 1 @1.007s 0%: 0.015+0.21+0.018 ms clock, 0.18+0.11/0.13/0.072+0.21 ms cpu, 4->4->0 MB, 5 MB goal, 12 P
gc 2 @1.017s 0%: 0.011+0.19+0.016 ms clock, 0.14+0.076/0.099/0.009+0.19 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 3 @1.021s 0%: 0.010+0.28+0.047 ms clock, 0.12+0.061/0.076/0.012+0.56 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 4 @1.025s 0%: 0.009+0.19+0.027 ms clock, 0.11+0.065/0.071/0.029+0.33 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 5 @1.028s 0%: 0.008+0.21+0.014 ms clock, 0.10+0.059/0.16/0.048+0.17 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 6 @1.032s 0%: 0.010+0.17+0.027 ms clock, 0.12+0.075/0.065/0.007+0.32 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 7 @1.035s 0%: 0.009+0.15+0.019 ms clock, 0.11+0.056/0.061/0.006+0.23 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 8 @1.039s 0%: 0.009+0.17+0.018 ms clock, 0.11+0.055/0.084/0.005+0.21 ms cpu, 20->20->0 MB, 21 MB goal, 12 P
gc 9 @1.042s 0%: 0.008+0.17+0.059 ms clock, 0.10+0.054/0.059/0.002+0.71 ms cpu, 20->20->0 MB, 21 MB goal, 12 P

Reproduction Steps

  1. run following code
package main

import (
	"global/gctuner"
)

func main() {

	const gb = 1024 * 1024 * 1024
	threshold := gb * 4

	gctuner.Tuning(uint64(threshold))
	println(gctuner.GetGCPercent())

	// 执行具体的业务逻辑
	for {
		data1 := make([]int, 10000, 10000)
		data2 := make([]int, 10000, 10000)
		for i, _ := range data1 {
			data1[i] = i
		}
		for i, _ := range data2 {
			data2[i] = i
		}
		result := 0
		for i, _ := range data1 {
			result += data1[i] * data2[i]
		}
	}

}

  1. Then run it with command, You will see the gc info
 GODEBUG=gctrace=1 go run main.go

Other Information

No response

@johnsGuo johnsGuo added the bug Something isn't working label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant