protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Make UnsafeByteOperations in java protobuf stable

Open frankyn opened this issue 1 year ago • 1 comments

What language does this apply to? Java protobuf

Describe the problem you are trying to solve. java-storage found significant byte[] allocations, which caused significant memory bloat, coming from protobuf response marshalling when downloading data from gRPC API. A separate effort ~3 years ago, by the gRPC team, introduced a performance improvement with a zero-copy response marshaling solution. We found that the same zero-copy response marshaling helped address memory bloat in java-storage (can share context over email).

java-storage client needs to use UnsafeByteOperations to support zero-copy response marshaler implementation. The issue is that java-storage gRPC support can't be marked GA until this class is no longer Experimental.

Describe the solution you'd like Make UnsafeByteOperations stable / remove experimental annotation.

Describe alternatives you've considered None, but open to them.

Additional context

  1. java-storage prototype we are using: https://github.com/googleapis/java-storage/pull/2420/files#diff-8d6230c7cebeacb950a63216b0068065a15d4c2943ac7f18405906a38b3d5f66R1893

frankyn avatar Feb 20 '24 20:02 frankyn

@googleberg, is UnsafeByteOperations ready to be marked as non-experimental?

honglooker avatar Feb 20 '24 23:02 honglooker

Documenting update with context talking with @googleberg offline;

I suspect the UnsafeByteOperations API is stable at this point and we can do this. Feel free to send a CL.

I'll follow-up. Thank you team

frankyn avatar Feb 23 '24 17:02 frankyn

Submitted change internally and they're now updated on Github. Pending release of protobuf-java version 4.27.

https://github.com/protocolbuffers/protobuf/commit/0070ac118863d7bfd12fa3eeab09e78178e41c65

Thank you @googleberg!

frankyn avatar Feb 27 '24 23:02 frankyn