1

I’m trying to test concurrently request (brute force test), with 1000 request/sec (same request id). I’m using Rest API.

The service running on distributed system, I’m using 3 pods.

The problem is I got duplication when inserting data, because we use distributed 3 pods consume concurrently (the request).

Then I tried some method to handle duplication:

  1. Using sync.Mutex still got duplicate because each pods has process different var sync.Mutex . So it’s not lock each pods.
  2. Using singleflight it’s work on 1 pods, but when run on distributed pods, it still duplicate, because different var singleflight also.
  3. Using Redis Lock DLM (Distributed Lock Management). It’s work on 1 pods, but when distributed, it’s still duplicate also.

The one that I’ve not yet implemented is using Message Queue .

Before I try that, is there any simple method to handle duplication from distributed system ?

asked Nov 7, 2022 at 6:24
1
  • 1
    What are you inserting the data to? The usual answer to distributed locks is redesign not to need them. Commented Nov 7, 2022 at 20:04

1 Answer 1

0

I know i'm late to the party, but to anyone interested, there is a distributed redis lock https://github.com/go-redsync/redsync . It doesn't follow Lock interface strictly, but it should be easy to implement.

answered Oct 16, 2023 at 13:54
2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented Oct 16, 2023 at 17:52
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Oct 16, 2023 at 17:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.