Hello, I’m setting up HAProxy in front of a gRPC service and am using consistent hashing based on a value extracted from the protobuf (this is a stateful service). The field is a string (32 bytes long), and it is the first field in the protobuf message. This works most of the time, but during load tests I see (based on the logs) that for some of the requests the converter doesn’t seem to be able to extract the protobuf field, which leads to the request being hashed to the wrong backend server.
Here’s the relevant config:
frontend:
acl _is_new_session path_reg .*/NewSession.*
http-request wait-for-body time 30s at-least 300 unless _is_new_session
http-request set-header session-id %[req.body,ungrpc(1)] unless _is_new_session
http-request capture req.hdr(session-id) len 100
backend:
mode http
balance hdr(session-id)
hash-type consistent
Here’s a sample log of when the problem occurs:
499/0/0/7396/7895 200 633 - - ---- 42/42/3/2/0 0/0 {} "POST https://my-service-name/ApiCall HTTP/2.0"
versus the log from a successful request:
0/0/0/12/12 200 463 - - ---- 47/47/0/0/0 0/0 {FBA07ACADCBFB9AF72F52E80841DB18C} "POST https://my-service-name/ApiCall HTTP/2.0
Is there a way to debug the converter to try and identify what may be causing this behavior? Any other suggestions on how to troubleshoot the problem?
Thanks!
Antonio.