Skip to content

Comments

Bump bucket4j to 8.16#3652

Draft
Rizziepit wants to merge 3 commits intomasterfrom
riz/bump-bucket4j
Draft

Bump bucket4j to 8.16#3652
Rizziepit wants to merge 3 commits intomasterfrom
riz/bump-bucket4j

Conversation

@Rizziepit
Copy link
Collaborator

Description

Testing Strategy

Checklist

  • I have reviewed this PR with relevant experts and/or impacted teams.
  • I have added tests to have confidence my changes work as expected.
  • I have a rollout plan that minimizes risks and includes monitoring for potential issues.

Thank you for contributing to Misk! 🎉

ClientSideConfig.getDefault().withClientClock(ClockTimeMeter(clock))
ClientSideConfig.getDefault()
.withClientClock(ClockTimeMeter(clock))
.withMaxRetries(5)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is why we want to bump the bucket4j version. Previous versions of bucket4j have infinite retries. We suspect the infinite retries create, or contribute to, a thundering herd. This has overwhelmed our Redis cluster on multiple occasions

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should allow the user to pass in a maxRetries but with a sensible default, instead of hardcode to 5. Also RetryStrategy seems to be good to have too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like @tgregory-block added maxRetries in his PR. Let's continue to convo there #3653

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Rizziepit
Copy link
Collaborator Author

The build is failing because misk-rate-limiting-bucket4j-dynamodb-v1 is incompatible with the new bucket4j_jdk17-core version. But we can't upgrade com.bucket4j:bucket4j-dynamodb-sdk-v1 - there are no newer versions. Presumably support ended when support for AWS SDK 1 ended. I guess we have to maintain our own fork?

bucket4jDynamoDbV1 = { module = "com.bucket4j:bucket4j-dynamodb-sdk-v1", version = "8.6.0" }
bucket4jMySQL = { module = "com.bucket4j:bucket4j-mysql", version.ref = "bucket4j" }
bucket4jRedis = { module = "com.bucket4j:bucket4j-redis", version.ref = "bucket4j" }
bucket4jMySQL = { module = "com.bucket4j:bucket4j_jdk17-mysql", version.ref = "bucket4j" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

As an aside, I have noticed a few libraries we depend on that are compiled against JDK 17, but misk itself is JDK 11. Is this possible only because our container runtime is ultimately Java 21?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I didn't know Misk is jdk 11. I went with jdk 17 only because the relocation notices here point to the jdk17 packages. I don't know what the implications are of compiling against different JDK versions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@adrw any thoughts here? I know it wouldn't be the first library in misk to do this, and I think the retry feature we want is only available in 8.16.x which seems to be Java 17 only

@tgregory-block
Copy link
Collaborator

We can't upgrade com.bucket4j:bucket4j-dynamodb-sdk-v1 - there are no newer versions. Presumably support ended when support for AWS SDK 1 ended. I guess we have to maintain our own fork?

I think we have two options:

  1. Move everyone to the v2 version. There are a handful of dynamo v1 bucket4j users
  2. Make an internal fork - it's fairly simple, it'd be nearly identical to the v2 implementation (which we maintain in misk, in addition to the module wrapper code), which is maybe 200 LoC?

The background here is that the bucket4j maintainer dropped Dynamo support entirely because he resides in Russia and lost the ability to download the sources/containers he needed to test the dynamo module

@Rizziepit
Copy link
Collaborator Author

I think we have two options:

  1. Move everyone to the v2 version. There are a handful of dynamo v1 bucket4j users
  2. Make an internal fork - it's fairly simple, it'd be nearly identical to the v2 implementation (which we maintain in misk, in addition to the module wrapper code), which is maybe 200 LoC?

Is a 3rd option possible where we use 2 bucket4j-core versions in Misk? It might be better than no. 1 where services will end up with both the Dynamo AWS SDK v1 and v2 APIs available in their project (I think?). That might be pretty common already though.

@tgregory-block
Copy link
Collaborator

Is a 3rd option possible where we use 2 bucket4j-core versions in Misk? It might be better than no. 1 where services will end up with both the Dynamo AWS SDK v1 and v2 APIs available in their project (I think?). That might be pretty common already though.

We could do that if we like shaded the earlier version, though I'd prefer to just implement the dynamo v1 bucket proxy ourselves given that it's just copy pasta from the v2 implementation we have +- some minor API differences.

On option 1, I figured a mix would be okay given that v1 is already EoL and folks should be moving anyway

* Implement support for new retry parameters

* Add config mutator functions to bucket4j modules
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.

3 participants