yangjj-iso opened a new pull request, #7842: URL: https://github.com/apache/shenyu/pull/7842
Fixes #7840. Enabled WebSocket reconciliation currently joins every serialized row into a second whole-snapshot string for MD5 and reparses changed rows before serializing the outgoing message. Reuse the sorted row JSON for incremental MD5 updates and write those same rows directly into the existing full-snapshot envelope. The digest remains byte-compatible with MD5 of the UTF-8, LF-delimited sorted rows, including the empty snapshot. Namespace/master gating, authoritative database polling, full-snapshot metadata, empty replacement and cursor advancement after successful publication are preserved. Load, row serialization, message-writing and publication failures leave the previous cursor available for retry. No production dependency is added. Validation: - Added wire/digest compatibility, field-change/addition/deletion, authoritative polling, empty snapshot, serialization failure and publication failure regressions. - Ran the admin and gateway WebSocket regression tests on the current upstream base, including master redirects and authoritative namespace cache replacement. - Checkstyle and Apache RAT passed for the admin and WebSocket sync modules. - Added an opt-in benchmark outside normal test execution, with two fresh JVM runs covering 1k/10k PLUGIN/SELECTOR/RULE rows and 256/4096-character configuration values. Changed-cycle median wall time decreased by 57.0–68.2% and allocation by 41.0–63.9%; unchanged allocation decreased by 14.9–16.5%, while unchanged latency remained variable. [Benchmark methodology, environment, raw CSV samples and limitations](https://github.com/yangjj-iso/shenyu/blob/feat/7840-websocket-snapshot-reuse/docs/websocket-reconciliation-benchmark.md). These measurements isolate reconciliation processing with in-memory service loads; database SQL counts, WebSocket transport, end-to-end convergence latency and business-request p99 remain deployment measurements, not claims from this benchmark. Commands: ```sh ./mvnw -pl shenyu-admin,shenyu-sync-data-center/shenyu-sync-data-websocket -am test \ '-Dtest=WebsocketDataReconcilerTest,WebsocketCollectorTest,ShenyuWebsocketClientTest,WebsocketDataHandlerTest,WebsocketMasterRedirectTest' \ '-Dsurefire.failIfNoSpecifiedTests=false' '-Djacoco.skip=true' ./mvnw -pl shenyu-admin,shenyu-sync-data-center/shenyu-sync-data-websocket checkstyle:check apache-rat:check ``` Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. The full-repository clean install was not run; targeted reactor tests and the module quality checks above were used. -- 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]
