-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not use JSON for internal routing #870
Do not use JSON for internal routing #870
Conversation
JSON encoding/decoding is very CPU intensive. Use character separated string for internal routing representation.
Canceling Rust GH actions because that changes are missing. |
5c81f48
to
6358399
Compare
@@ -197,4 +200,16 @@ namespace Channel | |||
|
|||
this->channel->Send(jsonResponse); | |||
} | |||
|
|||
const std::string& ChannelRequest::GetNextInternalRoutingId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps "Pop" instead of "Get"? A method called "GetXxxx()" should not modify internal state and should be idempotent. "Pop" instead means remove and give me the last item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not doing pop
. We maintain an internal nextRoutingLevel
member that we increase everytime this function is called.
Yes, "GetXxx" should generally not modify the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initially we commented about keeping the routing IDs within a std::queue
, and pop()
as we get the next id. But after implementation it seemed more convoluted than re-using the original std::vector
returned from splitting the message, plus this way we can avoid creating a string instance for every call to the function.
What you think about replacing json by protobuf? This way we can save CPU/RAM and generate types for typescript/c++/rust. |
We are completely removing any data structure for Data structures for |
- Replaces PR #870. ### TODO - There are two TODO comments in CPP files regarding PPID parsing/conversion. We should catch those errors and throw with `MS_THROW_TYPE_ERROR()` instead, otherwise the process will crash since we just expect `MediaSoupErrors`. - Rust layer.
Closing in favor of #893 |
JSON encoding/decoding is very CPU intensive.
Use character separated string for
internal
routing representation.data
info from node to worker forChannel
remains being JSON.data
info from node to worker forPayloadChannel
is a now string to be decoded by the target:data
, and we are NOT sending it as JSON but as plain string.