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

Atomic incr/decr operations do not support multiple concurrent requests #413

Open
ghost opened this issue Dec 4, 2022 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Dec 4, 2022

What happened:
Open Saves supports the update of record properties with the use of "atomic" messages to increment, decrement, add, subtract, and swap the property value.

What you expected to happen:
When multiple clients are incrementing a record property field simultaneously, I would expect the property value to be incremented by the number of clients that made the request.

How to reproduce it (as minimally and precisely as possible):
Using the Open Saves AtomicInc gRPC message, use 10 clients to increment a property field in the record at the same time. Some clients are going to be able to perform the operations, some others are going to fail with errors: concurrent transaction, signature mismatch, contention on entities.

Anything else we need to know?:
Since best practices suggest limiting the update on Datastore entities to 1 rps to avoid database contention, we might need to look into alternatives to implement this feature (Datastore won't cut it).

The Golang library Redsync provides a distributed lock that we could use to help implement a solution to ensure that:

  • All atomic operations on the same keys are completed regardless of the number of clients making simultaneous requests
  • We perform only one write per second on the target entity in Datastore

Environment:

  • Open Saves version: latest
  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
  • Install method (yaml/helm):
  • Troubleshooting guide log(s):
  • Others:
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

0 participants