Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INSERT/UPDATE database via background job while minimizing read impact

I'm running a large number of background tasks on a PostgreSQL server, using Sidekiq to update records from an external source. But whenever I start writing from the background process, my SELECTs suffer and the web app becomes slow.

What's the best strategy to avoid blocking reads?

like image 790
Avishai Avatar asked Mar 21 '26 03:03

Avishai


1 Answers

You could use the terminal command "renice"

renice -p 1337 -n 5

This changes the priority of process with id 1337 to have a new priority of 5. The process scale works from -20 to 20 where -20 is the highest priority and 20 is the lowest priority.

http://manpages.ubuntu.com/manpages/precise/en/man1/renice.1posix.html

like image 130
sheldonk Avatar answered Mar 23 '26 17:03

sheldonk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!