hotfix: fix the the threshold check logic of WriteBinaryNocopy #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Kitex v0.11.0 has added a dependency on github.com/cloudwego/gopkg, and the thrift encoding logic has also been migrated to github.com/cloudwego/gopkg. However, the migrated code introduces a bug in the modification of WriteBinaryNocopy, resulting in all string/[]byte encodings executing WriteDirect after the total package exceeds 4k, leading to performance degradation. #20 has been fixed.
Trigger scenario: Data package>4k, with many encoding logics for small strings
Impact point: CPU increases and has a significant impact on latency
zh(optional):
kitex v0.11.0 新增 github.com/cloudwego/gopkg 依赖,同时 thrift 编码逻辑也迁移至 github.com/cloudwego/gopkg,但迁移后的代码对 WriteBinaryNocopy 的修改引入了 bug,导致数据总包超过 4k 后,所有字符串/[]byte编码都会执行 WriteDirect,进而导致性能劣化。#20 已经修复。
触发场景:数据总包 > 4k,有很多小字符串的编码逻辑
影响点:CPU 上升且对延迟有显著影响
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: