0

I have batch update operations being sent to the PostgreSQL server to be executed. Each operation (batch) will be updating rows in the same table but it is assured that they will be updating different rows.

Given this, is it safe to assume that the a 2 fold increase in throughput can be countered by doubling the number of CPU cores?

1 Answer 1

3

The additional CPUs can only be used if you use more sessions/connections.

If you increase the number of sessions, then a higher number of CPUs should show an increase in throughput. However, the throughput is not only limited by CPU, but also by the capacity of your I/O system. If the current workload is I/O bound (i.e. limited by the performance of the disks) then adding more sessions (and more CPUs) is not going to increase the throughput (it's probably making it worse).

If your disks are not saturated with the current workload, then adding CPUs and using more sessions is likely to improve the throughput. But this is typically not linear, i.e. doubling the number of CPUs and sessions might only give you an x1.5 increase in throughput. Typically this curve flattens. If you increase concurrency from 5 to 10 sessions, this will probably double your throughput (again: assuming you are not limited by I/O). But going from 100 to 200, is probably not going to double the throughput.

2
  • "If the current workload is I/O bound (i.e. limited by the performance of the disks) then adding more sessions (and more CPUs) is not going to increase the throughput (it's probably making it worse)" - What do you mean by performance of the disks here? The number of writes then can handle before wear and tear starts?
    – Ashwin
    Commented Sep 23, 2020 at 9:32
  • 2
    @Ashwin: I mean the number of I/O operations (reads and writes) and the throughput the disks can handle. If your disks can sustain 1GB/Second writes and e.g. 50.000 IOPS, and your current workload sends 1GB/Seconds with 50.000 IOPS, then adding more work to it won't help. But if your current workload is only 100MB/Second and 5.000 IOPS then increasing concurrency will increase throughput
    – user1822
    Commented Sep 23, 2020 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.