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

fixing issues with benchmark Tests #71

Merged
merged 2 commits into from
Jan 14, 2023

Conversation

kiran-bjn
Copy link
Contributor

@kiran-bjn kiran-bjn commented Jan 3, 2023

I noticed 3 issues in the benchmark example code.

  • When running the benchmark on a centrifuge-server running remotely, Clients reconnecting due to network issues causes the program to crash due to improper waitGroup actions
  • When Clients reconnect, they can lose messages and can end up waiting for the messages to be received, indefinitely
  • Converting the generated byte array for the payload to string before marshalling, converts the empty 0 bytes into the string representation, which is actually 6 times larger than the actual intended msg size. eg: ( [0] becomes "\u0000" )
    ref : https://goplay.tools/snippet/tdq61T0axc_E

The fixes respectively are

  • Call Done() on the waitGroup only on Client connects and not on reconnects by maintaining a connected flag
  • Accept a deadline time as an argument and timeout the test if it is active beyond the deadline time and print the accumulated benchmark report
  • Don't stringify the byte array before marshalling

@FZambia FZambia merged commit e7353a4 into centrifugal:master Jan 14, 2023
@FZambia
Copy link
Member

FZambia commented Jan 14, 2023

Many thanks for these awesome improvements @kiran-bjn

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

Successfully merging this pull request may close these issues.

2 participants