public class CachedProtoResourcesSerializer extends Object implements ProtoResourcesSerializer
ProtoResourcesSerializer. It uses Guava Cache with weak values to store the serialized
messages. The weak values are used so it's possible to share the same proto instance between snapshots that are kept
in the memory. The improvement especially visible when the same message is send to multiple Envoys.
The message is then only serialized once as long as it's referenced anywhere else.
The same instance is used not only between snapshots for different groups but also between subsequent snapshots
for the same group, because the last serialized proto instance of DiscoveryResponse is set in
DiscoveryRequestStreamObserver#latestResponse.ProtoResourcesSerializer.ProtoSerializerException| Constructor and Description |
|---|
CachedProtoResourcesSerializer() |
| Modifier and Type | Method and Description |
|---|---|
com.google.protobuf.Any |
serialize(com.google.protobuf.Message resource)
Serialize message to proto buffers.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitserializepublic com.google.protobuf.Any serialize(com.google.protobuf.Message resource)
serialize in interface ProtoResourcesSerializerresource - the resource to serializeCopyright © 2018–2019 The Envoy Project. All rights reserved.