grafana / k6

A modern load testing tool, using Go and JavaScript - https://k6.io
GNU Affero General Public License v3.0
26.2k stars 1.27k forks source link

grpc: Remove the strict JSON dependency #2497

Open codebien opened 2 years ago

codebien commented 2 years ago

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.

olegbespalov commented 2 years ago

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

DanielPerfana commented 1 year ago

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.

olegbespalov commented 8 months ago

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.

lzakharov commented 5 months ago

Hi, @olegbespalov!

Any updates about the discardResponseBodies equivalent? Has the team decided to decline this option or not?