开发者

MySQL online vs. batch processing - options for preventing MySQL cron jobs from blocking online queries?

开发者 https://www.devze.com 2023-02-04 10:43 出处:网络
Is there another way to prevent nightly cron jobs that do batch processing against mysql from impacting online webserver->mysql queries other than setting query priority? I\'m thinking there may be a

Is there another way to prevent nightly cron jobs that do batch processing against mysql from impacting online webserver->mysql queries other than setting query priority? I'm thinking there may be a way to segment these, but I'm开发者_StackOverflow中文版 not sure if this is possible?


Try and break the queries down, perhaps rather than processing lots of data in one go try and process smaller batches but more often. This way you will lock tables for less time and allow gaps for queries from the frontend to be executed.

Another solution would be to process more often but even during the day. My last project used an event system, so that a user would comment something and this event would go into a queue. A background process (executed from The Fat Controller) would then take this event and insert data so that all the user's friends news feeds were updated about the comment. That way feeds are updated by simple insert statements and not rebuilt from scratch every x hours.

0

精彩评论

暂无评论...
验证码 换一张
取 消