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 ?

1 Answers1

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.

serqol
  • 16
  • 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 – CPlus Oct 16 '23 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. – Community Oct 16 '23 at 17:52