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

feat: Working, tested, but unused pubsub system #1205

Merged
merged 24 commits into from
Jun 21, 2024
Merged

feat: Working, tested, but unused pubsub system #1205

merged 24 commits into from
Jun 21, 2024

Conversation

kentquirk
Copy link
Contributor

@kentquirk kentquirk commented Jun 15, 2024

Which problem is this PR solving?

  • In order to implement a gossip protocol, we need a functional pubsub system. I tried the go-redis library instead of redigo and it was pretty simple to use.

Short description of the changes

  • Create a standardized pubsub interface
  • Implement go-redis version of it
  • Implement local version of it
  • Write tests
  • Write benchmarks
  • Implement startstop
  • Set up based on our redis peer config (I have not used all of the pool size parameters, since they don't seem to matter anymore)

On my local machine (without going through an external network), it runs at about 20K messages per second, with average latency of about 200uS and max latency of about 5mS. On CI, the first test had avg latency of 6mS.

I also tried implementing a version using the reuidis library; see comments in the code. Basically, for pubsub it was no faster and the implementation was a bit ugly so I did not include it.

@kentquirk kentquirk requested a review from a team as a code owner June 15, 2024 18:24
@kentquirk kentquirk marked this pull request as draft June 15, 2024 18:24
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_local.go Outdated Show resolved Hide resolved
@kentquirk kentquirk changed the base branch from main to kent.generics June 18, 2024 01:43
Base automatically changed from kent.generics to main June 18, 2024 13:05
@kentquirk kentquirk marked this pull request as ready for review June 19, 2024 01:37
@kentquirk kentquirk changed the title feat: WIP: working, tested, but unused pubsub system feat: Working, tested, but unused pubsub system Jun 20, 2024
@kentquirk kentquirk requested a review from VinozzZ June 21, 2024 18:25
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_local.go Outdated Show resolved Hide resolved
pubsub/pubsub_goredis.go Show resolved Hide resolved
pubsub/pubsub_goredis.go Outdated Show resolved Hide resolved
pubsub/pubsub_test.go Show resolved Hide resolved
pubsub/pubsub_test.go Show resolved Hide resolved
pubsub/pubsub_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@VinozzZ VinozzZ left a comment

Choose a reason for hiding this comment

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

💯

@kentquirk kentquirk merged commit 6536ea8 into main Jun 21, 2024
3 checks passed
@kentquirk kentquirk deleted the kent.pubsub branch June 21, 2024 20:33
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