http.ListenAndServe(":6000", http.DefaultServeMux)
and I create a small ballast on my Digital Ocean 1 GB ram droplet (the twitch blog post said they made a ballast of 10 <<30) but I did 10 << 20
ballast := make([]byte, 10<<20)
I then sent a million requests to it
ab -k -c 8 -n 1000000 "http://127.0.0.1:6000/"
I also did the same without the heap ballast.
The results (see attached images) surprised me because there was basically the same number of garbage collections with and without the ballast. The only difference the ballast seems to have made was that it increased HeapIdle enormously. How do people use Heap Ballast to reduce the number of GCs?
go version go1.21.1 linux/amd64
I have read many people referring to this Heap Ballast technique as a way to reduce the number of garbage collections with a small heap size. In fact, this is what it says in the Twitch article
At steady state, our application was triggering ~8–10 garbage collection (GC) cycles a second (400–600 per minute).
30% of CPU cycles were being spent in function calls related to GC
During traffic spikes the number of GC cycles would increase
Our heap size on average was fairly small (<450Mib)
At steady state, our application was triggering ~8–10 garbage collection (GC) cycles a second (400–600 per minute).
30% of CPU cycles were being spent in function calls related to GC
During traffic spikes the number of GC cycles would increase
Our heap size on average was fairly small (<450Mib)
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/YmpDtEkZcAc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.