Home  >  Q&A  >  body text

java - How to solve the pressure on scheduled task polling database

There are many scheduled tasks, and they are distributed on different servers. To poll the database for data that meets the conditions (status) and then process it. In this way, hundreds or thousands of scheduled tasks poll the database, which directly leads to a sharp increase in database pressure.

How to deal with this situation? How to reduce database pressure.

PHPzPHPz2712 days ago1186

reply all(3)I'll reply

  • 黄舟

    黄舟2017-05-17 10:06:44

    1. Combine similar or similar polling tasks to reduce the number of polling tasks

    2. Reduce the execution frequency of polling tasks

    3. Optimize the SQL statements inside the polling task to reduce database query pressure

    4. Split the execution time of polling tasks equally, don’t concentrate them all in a certain time period

    5. Do not use polling tasks

    6. Upgrade database

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-17 10:06:44

    Try to store the data ID to be polled separately, task poll the ID table, and then perform a single query based on the ID

    reply
    0
  • PHPz

    PHPz2017-05-17 10:06:44

    In addition, the database can also be set up with multiple slave libraries, and scheduled tasks can poll data from different slave libraries, so the pressure on the database is much smaller

    reply
    0
  • Cancelreply