Aias00 opened a new issue, #7838:
URL: https://github.com/apache/shenyu/issues/7838

   ## Goal
   
   Evaluate a compatibility-safe structured payload representation for two 
envelopes that currently embed an already serialized JSON message as a string. 
Avoid another escaping/unescaping layer for large configuration data.
   
   ## Current representation
   
   1. 
[WebsocketSyncFrame.payload:35](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-common/src/main/java/org/apache/shenyu/common/dto/WebsocketSyncFrame.java#L20-L46)
 is String. 
[WebsocketCollector:391–397](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java#L391-L397)
 serializes a frame containing the complete configuration message string during 
opt-in initial sync.
   2. 
[ClusterDataChangedEventPayload.source:40–43](https://github.com/apache/shenyu/blob/04f7c2e8b7d282f14510157a9ab0bfaab538ecac/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ClusterDataChangedEventPayload.java#L30-L48)
 is String. ClusterDataChangedEventForwarder serializes event.getSource() 
before RestTemplate serializes the envelope.
   
   JSON syntax and existing escaped handle/config strings therefore pass 
through an additional string-escaping layer. This is a 
representation/performance task, not a claim that these valid JSON envelopes 
are currently malformed.
   
   ## Scope and acceptance
   
   - [ ] Measure raw/compressed bytes and encode/decode allocation/CPU for 
current versus structured envelopes with realistic nested handle/props content. 
Do not assume a universal reduction ratio.
   - [ ] Define a version/capability-compatible structured payload 
representation appropriate to each transport's serializer. Do not assume Gson 
and Jackson tree types are interchangeable without explicit adapters/tests.
   - [ ] Keep INITIAL_SYNC_V1 and mixed-version Admin/gateway/cluster 
compatibility or provide an explicit negotiated replacement and tested legacy 
fallback. Do not silently change a String field into an object for existing 
consumers.
   - [ ] Preserve requestId, sequence validation, connection ownership, ordered 
delivery and retry/failure handling. Initial-sync payload=null is a completion 
marker and must remain distinct from an empty configuration snapshot.
   - [ ] Preserve group, event and namespace context, cluster authentication 
and after-commit dispatch. No change to the internal DataChangedEvent source is 
required by this task.
   - [ ] Implement only after compatibility and benchmark results justify it; 
keep existing envelopes conceptually rather than introducing another generic 
event bus. Test WebSocket framing and Admin forwarding independently.
   
   ## Related work
   
   #7716 concerns inconsistent encoding of instance-info reports; these are 
configuration/committed-event envelopes, not that reporting field. #7832 
reduces gateway payload fields; this task removes redundant enclosing string 
encoding. Keep their benchmarks and rollout decisions separate.
   
   ## Baseline and validation boundary
   
   Reviewed Apache ShenYu `2.7.2-SNAPSHOT`, master 
`04f7c2e8b7d282f14510157a9ab0bfaab538ecac`. Source inspection confirms the 
processing described here; no before/after load benchmark has been run and no 
fixed performance gain is claimed. Use #7650's reproducible benchmark contract: 
warm JVM, identical configuration/resources, controlled payload shapes, 
repeated runs, CPU/allocation/GC, synchronization convergence and 
business-request p99 during sync. No new production dependency is required for 
this proposal.
   


-- 
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]

Reply via email to