Aias00 opened a new issue, #7831: URL: https://github.com/apache/shenyu/issues/7831
### Description `GrpcPlugin.doExecute()` deserializes the same `MetaData.rpcExt` JSON into `GrpcExtInfo` for each request, even when the endpoint metadata has not changed. This repeats configuration parsing and allocation on the request path. Confirmed in Apache ShenYu 2.7.2-SNAPSHOT and upstream `master@7cc1818ace246f60a608e44b5fe985dff46908e7`. The inspected upstream file is identical to the current working copy. ### Code evidence and trigger [`GrpcPlugin.java:107-115`](https://github.com/apache/shenyu/blob/7cc1818ace246f60a608e44b5fe985dff46908e7/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/GrpcPlugin.java#L107-L115): ```java GrpcExtInfo extInfo = StringUtils.isBlank(metaData.getRpcExt()) ? new GrpcExtInfo() : Optional.ofNullable(GsonUtils.getGson().fromJson(metaData.getRpcExt(), GrpcExtInfo.class)) .orElseGet(GrpcExtInfo::new); CallOptions callOptions = CallOptions.DEFAULT.withDeadlineAfter(extInfo.timeout, TimeUnit.MILLISECONDS); ``` For every valid request to a gRPC endpoint with nonblank `rpcExt`, the same unchanged JSON is parsed again. The parsed values describe endpoint configuration (`timeout` and `methodType`), rather than request-specific arguments. ### Expected behavior / suggested direction Reuse an immutable parsed representation while the corresponding metadata remains unchanged, or parse it during metadata update handling. Keep cache ownership/invalidation tied to metadata changes and removal, and bound any retained cache entries. Only the parsed metadata should be reused: `CallOptions.withDeadlineAfter(...)` must still create a fresh request-relative deadline for each call. Preserve blank/null/JSON-null defaults and the existing handling of invalid metadata. ### Task List - [ ] Avoid repeated JSON deserialization for unchanged gRPC endpoint metadata. - [ ] Handle metadata updates/removal without stale timeout or method type values or unbounded retention. - [ ] Preserve null/blank defaults and fresh per-request deadlines. - [ ] Verify reuse across repeated calls and refreshed values after metadata changes. - [ ] Benchmark before claiming a latency or throughput gain. ### Related work / validation limits #6650 addressed null/blank `rpcExt` handling; this task preserves those semantics and concerns repeated configuration parsing instead. The repeated parse is confirmed by source inspection. No benchmark was run, and this report does not claim a high-severity correctness failure. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
