Postgresql – Determining Whether Query Load is Too High for PostgreSQL Server

dockerpostgresqlpostgresql-11postgresql-performanceUbuntu

I just started experiencing some write-heavy load on a PostgreSQL 11.2 system running inside a Docker container on an Ubuntu 18.04 server. PostgreSQL is receiving about 1-4k INSERT queries/second.

How can one determine whether this amount of load is too high for the system? Are there some metrics to monitor, like one that shows the number of queries being queued up at any one time?


System Specs

  • Intel® Atomâ„¢ C2750 (8-Core, 2.4GHz)
  • 8GB DDR3
  • 240 GB SSD

Output of htop

2 node.js app concurrently sending queries to PostgreSQL. Both app and database are running on the same server.

enter image description here

Output of iotop

enter image description here

Output of iostat -c 5 999

enter image description here

Output of vmstat 1

enter image description here

pgAdmin

enter image description here

Best Answer

Unless you have insert triggers that do complex stuff, an INSERT is probably bottlenecked by either CPU or I/O.

Use vmstat 1 to determine what is the case: High CPU utilization is obvious, high I/O load manifests as iowait% at 10 or higher. This assumes that you have not set CPU or I/O limits on the container.

If both values look fine, you are probably not maxed out.