Giter VIP home page Giter VIP logo

gogctuner's Introduction

GOGCTuner

idea is from this article How We Saved 70K Cores Across 30 Mission-Critical Services (Large-Scale, Semi-Automated Go GC Tuning @Uber)

How to use this lib?

just call NewTuner when initializing app :

func initProcess() {
	var (
		inCgroup = true
		percent = 70
	)
	go NewTuner(inCgroup, percent)
}

Current Status

Go 1.19 adds a soft memory limit which changes its pacer algorithm and scvg behavior, we'll see what go team will provide in the new version. Maybe this lib can be deprecated in Go 1.19.

official guide for gogc and memory limit params:

https://tip.golang.org/doc/gc-guide

gogctuner's People

Contributors

antiengineer avatar ashtonian avatar cch123 avatar xwi88 avatar zhangcheng9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gogctuner's Issues

why use memory usage to calucate gc percent?

  1. Based on scavenging policy, go will not return released memory to os immediately, but nextgc use heapMarked, it diff with memory usage

  2. memory usage from /proc/ may be delay, when trigger gc, and may lead gc percent incorrectly.

Why not automatically determine the environment in which the program is running?

It seems better to use gogcturner as a sidecar to the project.

If your application runs on the host now, and then you want to change it to run on the Docker, you must change the code and compile the application once.

On the other hand, If you miss changing the env, it will make some strange mistake which maybe a little to trace.

Algo values aren't a % / race condition

I added some tests in #7 and some logging info and the tests logged:

2022/05/26 17:46:35 GC Tuner initialized. GOGC: 100 Target percentage: 70
2022/05/26 17:46:35 adjusting GOGC - from 100 to 582442.2222222222
2022/05/26 17:46:36 adjusting GOGC - from 100 to 43994.20740406999
2022/05/26 17:46:38 adjusting GOGC - from 582442 to 19957.129779857565

Seems like the values being calculated aren't a % and also like there is a bit of a race as one of the values didn't actually get set.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.