leizhiyuan opened a new pull request, #1462: URL: https://github.com/apache/rocketmq-clients/pull/1462
### Which Issue(s) This PR Fixes Fixes #1459 ### Brief Description Every RPC signed its metadata with `OffsetDateTime::now_local()`. In a multi-threaded process (a Tokio client always is), `time` 0.3 reads and parses `/proc/self/stat` on every call to count the threads and then refuses to compute the offset, so the client paid ~14 µs per request only to fall back to `now_utc()`. - `sign_without_timeout` uses `OffsetDateTime::now_utc()` directly. The value of `x-mq-date-time` and the `authorization` signature are unchanged (they were already UTC in every multi-threaded process). - The `local-offset` feature of `time` is no longer used and is removed from `Cargo.toml`, which also drops the `num_threads` dependency. Reference Java: `Signature#DATE_TIME_FORMAT = "yyyyMMdd'T'HHmmss'Z'"` (UTC). #### Notes for reviewers - Behavior: only a single-threaded process could have produced a local time before; the Rust client never runs single-threaded (Tokio + background tasks). The proxy reads this header only for the HMAC, which is computed over the same string. - Merges cleanly with #1452–#1457. ### How Did You Test This Change? **Unit test**: `sign_sets_utc_date_time` signs a request on a session with an access key and checks that `x-mq-date-time` is RFC 3339 UTC (`...Z`, today's UTC date) and that `authorization` is the HMAC-SHA1 of exactly that value. **Benchmarks** (test environment in #1459 and #1445: release build, 3 runs, median): | | `master` | this PR | |---|---|---| | date-time header per call (micro-benchmark, process with 5 threads) | 13.9–14.1 µs | **0.34 µs** | | `Producer::send` normal, 32 senders: msg/s | 27,120 | **29,464** (+8.6%) | | same: latency p50 / p99 | 1,136 / 2,151 µs | **1,041 / 2,028 µs** | | `Producer::send` lite, 32 senders: msg/s | 27,427 | **29,737** (+8.4%) | ``` $ cargo test # lib: 151 passed, 0 failed (master: 150) $ cargo clippy --all-features -- -D warnings # clean $ cargo fmt --check # clean $ RUSTDOCFLAGS='--cfg docsrs' cargo doc --no-deps --all-features # ok $ cargo build --examples --all-features # ok $ cargo +1.74.0 check --all-features --tests --examples # ok (MSRV) ``` --- Part of #1445 (Rust performance tracking). -- 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]
