perf: trim useless metadata fields in ALS to improve performance (#7191)
These fields in `stateMap` metadata are not used by `metadata-service-mapping.yaml` now and there is low possibility that they may be used in real case, but, they cost a lot to deserialize, so we remove them to improve performance From what I've tested, the analyzer can process 250k ALS logs before trimming the fields and can process 420k ALS logs after trimming the fields
This commit is contained in:
parent
d63f3ffcc1
commit
de1d0461cc
|
|
@ -44,6 +44,7 @@ Release Notes.
|
|||
* Support endpoint name grouping by OpenAPI definitions.
|
||||
* Fix CounterWindow increase computing issue.
|
||||
* Performance: optimize Envoy ALS analyzer performance in high traffic load scenario (reduce ~1cpu in ~10k RPS).
|
||||
* Performance: trim useless metadata fields in Envoy ALS metadata to improve performance.
|
||||
|
||||
#### UI
|
||||
* Fix the date component for log conditions.
|
||||
|
|
|
|||
|
|
@ -18,20 +18,17 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.receiver.envoy.als.mx;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import Wasm.Common.FlatNode;
|
||||
import Wasm.Common.KeyVal;
|
||||
import com.google.protobuf.Any;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.BytesValue;
|
||||
import com.google.protobuf.Struct;
|
||||
import com.google.protobuf.Value;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo;
|
||||
import Wasm.Common.FlatNode;
|
||||
import Wasm.Common.KeyVal;
|
||||
|
||||
import static com.google.common.base.Strings.nullToEmpty;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
|
@ -88,10 +85,6 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo {
|
|||
|
||||
builder.putFields("NAME", Value.newBuilder().setStringValue(nullToEmpty(node.name())).build());
|
||||
builder.putFields("NAMESPACE", Value.newBuilder().setStringValue(nullToEmpty(node.namespace())).build());
|
||||
builder.putFields("OWNER", Value.newBuilder().setStringValue(nullToEmpty(node.owner())).build());
|
||||
builder.putFields("WORKLOAD_NAME", Value.newBuilder().setStringValue(nullToEmpty(node.workloadName())).build());
|
||||
builder.putFields("ISTIO_VERSION", Value.newBuilder().setStringValue(nullToEmpty(node.istioVersion())).build());
|
||||
builder.putFields("MESH_ID", Value.newBuilder().setStringValue(nullToEmpty(node.meshId())).build());
|
||||
builder.putFields("CLUSTER_ID", Value.newBuilder().setStringValue(nullToEmpty(node.clusterId())).build());
|
||||
|
||||
final Struct.Builder labels = Struct.newBuilder();
|
||||
|
|
@ -101,19 +94,6 @@ public class ServiceMetaInfoAdapter extends ServiceMetaInfo {
|
|||
}
|
||||
builder.putFields("LABELS", Value.newBuilder().setStructValue(labels).build());
|
||||
|
||||
final Struct.Builder platformMetadata = Struct.newBuilder();
|
||||
for (int i = 0; i < node.platformMetadataLength(); i++) {
|
||||
final KeyVal platformMd = node.platformMetadata(i);
|
||||
platformMetadata.putFields(nullToEmpty(platformMd.key()), Value.newBuilder().setStringValue(nullToEmpty(platformMd.value())).build());
|
||||
}
|
||||
builder.putFields("PLATFORM_METADATA", Value.newBuilder().setStructValue(platformMetadata).build());
|
||||
|
||||
final List<String> appContainers = new ArrayList<>();
|
||||
for (int i = 0; i < node.appContainersLength(); i++) {
|
||||
appContainers.add(node.appContainers(i));
|
||||
}
|
||||
builder.putFields("APP_CONTAINERS", Value.newBuilder().setStringValue(Joiner.on(",").join(appContainers)).build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue