Mysql trigger/events vs Cronjob

后端 未结 4 1180
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 14:37

I have an auction website which let my users place an unlimited amount of autobiddings.

To monitor these autobiddings something has to check the database every seco

4条回答
  •  温柔的废话
    2021-01-05 15:21

    I would probably model the solution to your auto-bidding problem a bit differently:

    How about an event-based approach? You store the auto-bid requests of your users and if someone actually bids on an object you process the previously queued auto-bids.

    This has the following benefits:

    • load on the database is distributed organically
    • you only do lookups that are actually needed at the time.
    • it is real-time and not tick-based
    • it is easier to reason about the business/application logic because it is local instead of global

提交回复
热议问题