k6 icon indicating copy to clipboard operation
k6 copied to clipboard

grpc: Remove the strict JSON dependency

Open codebien opened this issue 3 years ago • 4 comments

It could be useful to remove the tightly coupled dependency that the gRPC module has from protojson. https://github.com/grafana/k6/blob/57e994242f10122bccfbda229c4b29499a42457b/js/modules/k6/grpc/client.go#L232-L241

The protojson dependency is a requirement for the js/k6/grpc module for creating requests when the JavaScript objects are used for passing data.

However, in the case of extensions, this requirement could be removed where the generated Go structs could be directly used without the requirement for marshaling/unmarshaling from JSON.

We could add a field into the new grpcext.Request for providing the required marshaler/unmarshaler.

codebien avatar Apr 14 '22 13:04 codebien

Maybe it also can be taken into account: https://community.k6.io/t/grpc-response-is-camelcase-instead-of-snake-case/3266

olegbespalov avatar Apr 21 '22 12:04 olegbespalov

Hi, any progress on this? We are running into issues with an system under test that returns 5Mb json responses, resulting in high cpu and memory usage of k6 and a response times overhead of approximately 100ms. It would be nice to have an option equivalent to discardResponseBodies for grpc.

DanielPerfana avatar Oct 27 '23 13:10 DanielPerfana

Hey @DanielPerfana .

I'm sorry for not getting back to you sooner. Unfortunately, there are no updates on this.

However, your request for an equivalent to the HTTP module discardResponseBodies sounds interesting. I'll bring it to the upcoming team sync and reply. Maybe we could extract this into separate minor issues and implement it sooner than removing the strict JSON dependency.

olegbespalov avatar Mar 26 '24 14:03 olegbespalov