influxdb-client-go icon indicating copy to clipboard operation
influxdb-client-go copied to clipboard

Goroutine sustained growth

Open liliang8858 opened this issue 2 years ago • 1 comments

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

curl http://127.0.0.1:8000/debug/pprof/goroutine?debug=1
goroutine profile: total 52019
21104 @ 0x43ab85 0x4059fa 0x405755 0x8061b8 0x80a5a4 0x80ad36 0x470c61
#       0x8061b7        github.com/influxdata/influxdb-client-go/v2/api.(*WriteAPIImpl).WriteRecord+0xb7        F:/go/pkg/mod/github.com/influxdata/influxdb-client-go/[email protected]/api/write.go:231

Expected behavior: How to reduce Goroutine

Actual behavior: Goroutine sustained growth

Specifications:

  • Client Version:v2.5.0
  • InfluxDB Version:v2.5.0
  • Platform:linux

liliang8858 avatar Sep 01 '21 07:09 liliang8858

@liliang8858, this library creates itself only two internal goroutines. It seems there are many goroutines using WriteRecord in the test app. How many?

There is a main goroutine sending data to a server using a single connection. If this goroutine does not manage to send data quickly other routines must wait. You have to balance the number of writing goroutines.

You can use multiple clients to write using multiple connections.

vlastahajek avatar Sep 01 '21 09:09 vlastahajek