I need to synchronize two systems, so the producers list new entities to be created on the consumer app. It has no realtime need (mostly for datamining, so being a few hours behind isn't an issue), but it's important that this task doesn't run when the server is already busy serving real users.
I have tried to run the sync service with a lower priority (nice -n19) but for what I saw, it can still hurt performances, as if this sync service runs a big database query, it's still going to increase the load on the database process and on the complete machine
is there a way to test the load and simply exit if it's too high (say above 2)?
Ideally, having some kind of alert if the cron isn't processing for too long because the load never goes below 2.
Is this a good approach or am I creating more problems that I'm solving?