-
Notifications
You must be signed in to change notification settings - Fork 334
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
Encoding the byte array in JSON with base64 #2542
Comments
I think the performance of ddl procedure is not a major concern right now, and this serialization can't be the major bottleneck of it. I prefer the JSON format personally, it is more readable and friendly for debugging and management. |
In this case, we only encode protobuf-encoded byte array with base64. By default, JSON format will treat the u8 array as the u32 array, which results in an expansion ratio of up to 4:1. let pb = PbAlterTableTask {
alter_table: Some(self.alter_table.clone()),
};
let buf = pb.encode_to_vec();
serializer.serialize_bytes(&buf) |
By the way, it seems that we haven't gained any benefits from using the JSON format in our current code processing. Formatting JSON from protobuf bytes doesn't enhance readability or user-friendliness. |
Got the point. If you want to make this change, please do it ASAP before v0.4.0 is released. |
What type of enhancement is this?
Performance
What does the enhancement do?
Encoding byte arrays in JSON is inefficient. One acceptable solution is encoding the byte array with base64.
greptimedb/src/common/meta/src/rpc/ddl.rs
Lines 276 to 292 in 17b385a
greptimedb/src/common/meta/src/rpc/ddl.rs
Lines 347 to 358 in 17b385a
Implementation challenges
No response
The text was updated successfully, but these errors were encountered: