Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support custom protobuf serializer for logGroup to improve send performance #1845

Merged
merged 12 commits into from
Nov 4, 2024

Conversation

henryzhx8
Copy link
Collaborator

@henryzhx8 henryzhx8 commented Oct 31, 2024

  • 背景:在序列化event group时,需要首先转成logGroup的pb,然后再将pb序列化成string,这里至少经历了两次字符串复制,还不考虑中间夹杂的内存重新分配,整体效率很差。对于极简单行场景,有60%的时间都在执行序列化的操作,影响发送效率。
  • 方案:根据根据protobuf的协议 ,直接手写序列化函数,即直接将event group直接变成string即直接将eventgroup直接变成string,这样只需要一次字符串拷贝即可,进一步的,可事先计算序列化后的字符串大小,提前分配内存,避免中间额外的内存分配。

@henryzhx8 henryzhx8 added enhancement Feature enhancement core Core feature labels Oct 31, 2024
@henryzhx8 henryzhx8 added this to the v2.2 milestone Oct 31, 2024
@yyuuttaaoo yyuuttaaoo changed the title support custom protobuf serializer for logGroup to improve performance improve sls send performance Oct 31, 2024
@henryzhx8 henryzhx8 changed the title improve sls send performance support custom protobuf serializer for logGroup to improve send performance Nov 1, 2024
@henryzhx8 henryzhx8 merged commit 3d26daf into main Nov 4, 2024
17 checks passed
@henryzhx8 henryzhx8 deleted the feat/pb branch November 4, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core feature enhancement Feature enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants