When tuning the last server that we built I followed the following Wiki page as to where to make adjustments https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server then tested the tweaks using pgbench tools from https://github.com/gregs1104/pgbench-tools. Of course not every machine is built the same and not every PostgreSQL server is used the same, to tune according to the machine and the usage of the server.