High concurrency, how to record the number of clicks, there will be no repetition?

In the

high concurrency environment, I want to record the number of clicks per click. The database self-increasing field is id , but there is already a lot of data in it. You can"t use id to identify the clicks. If there is any way of thinking, there will be no duplicate records. What I think of is locking the table.

Mar.09,2021

if the experience of locking the table is not good, the front end will wait too long.
message queuing is recommended.

  1. N individual click, directly into the queue, this is in sequence. And no lock, high performance
  2. background opens A consumer process reads from the message queue, which is in the order you want
< H1 > queue-first in, first out (FIFO,first in first out) < / H1 >
Menu