aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
429 stars 199 forks source link

ClientPolicy.MaxQueueSize does not exist #369

Closed dictav closed 2 years ago

dictav commented 2 years ago

I uses aerospike-client-go v5.7.0, and server v4.9.0.11.

I've gotten ErrConnectionPoolEmpty error by using Client.BatchGetObjects(), so I'd like to fix this problem.

I found the following comment: https://github.com/aerospike/aerospike-client-go/blob/v5/node.go#L395-L400

If no pooled connection is available, a new connection will be created, unless ClientPolicy.MaxQueueSize number of connections are already created.

However, ClientPolicy.MaxQueueSize does not exist anywhere on v5 branch. In addition, I ran Client.WarmUp (0) and still got ErrConnectionPoolEmpty error.

Which parameters other than Client.MaxQueueSize should I change to control the connection pool?

khaf commented 2 years ago

It was renamed to ConnectionQueueSize. Keep in mind that in the end every batch call will take a connection from each node connection pool and the number of simultaneous calls will be determined by the size of the connection pool.

dictav commented 2 years ago

Thanks for your quick reply.

In my setting, ConnectionQueueSize was the default value (256), so I tried setting it to 512 and I got ErrConnectionPoolEmpty again.

In the first place, my Aerospike cluster size is 3, and Client.BatchGetObjects () only gets 5 items at one time. So, I think my program should not use so many connections. It's strange.

I will investigate.

khaf commented 2 years ago

You can set the log level to debug to potentially get more insight into what is going wrong. Another knob is to check your timeout values. Too short or too long, and network disruptions would wreak havok on connection pools due to churn. I could help you if you shared a code sample or gist. Feel free to reopen the ticket if you need further help.