Skip to content

Conversation

@jmillan
Copy link
Member

@jmillan jmillan commented Dec 12, 2023

It uses a list hash rather than a single list to store stream contexts.

By distributing the stream contexts in multiple lists (32) we enhance the list traversal time for the stream we are looking, by 32 times in the best case.

I made a PR in the project but it didn't succeed cisco/libsrtp#659

They'll work on a different solution. In the meantime we can use this approach. It saves 2% CPU for a Router with 1 AV Producer and 40 A/V Consumers. The gains are bigger as the number of Consumers increase.

It uses a list hash rather than a single list to store stream contexts.

By distributing the stream contexts in multiple lists (32) we enhance
the list traversal time for the stream we are looking, by 32 times in
the best case.
Copy link
Collaborator

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is list traversal that expensive, what kind of difference are we talking about here?

@jmillan
Copy link
Member Author

jmillan commented Dec 12, 2023

Is list traversal that expensive, what kind of difference are we talking about here?

Data added in the PR description. As the number of streams per context increase, the difference is bigger. Here an extreme case where the list traversal takes more than encrypting:

Screenshot 2023-11-17 at 18 00 49 (1)

@jmillan jmillan merged commit 042b7f5 into v3 Dec 12, 2023
@jmillan jmillan deleted the libsrtp_fork branch December 12, 2023 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants