What are the difficulties of lucky draw? Highlights

  1. Business requirements

Through the form of activities, attract users to draw credit for Jingdong finance, bring the number of users for car owner service, increase the number of car binding, and transform Jingdong financial users into car owner users.
Through the lottery, we can use some incentives and incentives to encourage users to use our app and improve user stickiness.
Lottery notes:

  1. There are two ways to get the key, one is to log in for the first time every day to get two keys, the other is to complete the task to get one key.
  2. When the user has the key, click the unlock picture button to automatically use one key to unlock the fragments. It takes four fragments to unlock a whole picture. Only when the whole picture is unlocked can the lottery really be triggered.
  3. The lottery will draw coupons, cash and red envelopes for users.


  1. The asynchrony between the awarding and the drawing
  2. Distributed lock

3. Multi thread consumption on the consumer side. After all the consumption sets are processed, submit (countdownlatch) and turn off MQ automatic consumption. There may be repeated consumption, which can be solved by ensuring idempotency or de duplication table.

  1. Give up trying again
    The more the number of retries, the greater the impact on system performance.
    In the process of lucky draw, we will not try again if any link is abnormal or fails in the whole process from the verification of lucky draw information to the inventory deduction and the entry of winning information. It is determined by the business scenario of the lucky draw, that is, the lucky draw itself is random and does not need to guarantee 100% winning. If the business requires 100% winning, you can add a “compensation prize link” at the end of the process, that is, before returning the failure information, you can send a prize to the user without modifying the previous whole process.