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

Optimizing Performance in Message Broadcasting for sessionWS #1142

Open
huangzz opened this issue Nov 15, 2023 · 0 comments
Open

Optimizing Performance in Message Broadcasting for sessionWS #1142

huangzz opened this issue Nov 15, 2023 · 0 comments

Comments

@huangzz
Copy link

huangzz commented Nov 15, 2023

In sessionWS, the sending of messages is synchronized using sync.Mutex. This has a significant performance impact when there is a need for broadcasting in the game.

SendBytes and processOutgoing currently use channels for communication, and in fact, locks are not necessary. The only places where locks may be needed are in the WriteMessage function in processOutgoing and SendBytes.

It is recommended to remove unnecessary locks in these functions. This would lead to significant performance improvements in projects such as MMOs that require a large amount of broadcasting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant