While analyzing some goroutine dumps from purged on cp7001 I've noticed that in 8 days purged created more than 1.25 billion goroutines, after checking the code this seems to be caused by:
// Send parsed URL to frontend workers time.AfterFunc(time.Duration(*frontendDelay)*time.Millisecond, delayedPurge(chout, *parsedURL))
This effectively ties ATS PURGE throughput to goroutine creation rate in purged. This goroutine just publishes a message into a channel and exists:
// delayedPurge sends the given url on the given channel. The reason for // returning a function here is that we want to use time.AfterFunc, which takes // a function as an argument -- just func(), without parameters. func delayedPurge(chout chan url.URL, toPurge url.URL) func() { return func() { chout <- toPurge } }
as a result, go scheduler and GC are busy creating and destroying >1k goroutines per second