We have currently a Postgres database with a 100 of tables 20 of them with more than 5 000 000 rows, the master DB server runs on Debian 32MB RAM 8 Processors.
Additionaly to the master DB we have a Slave DB replicated using Slony.
Our application uses Java and Hibernate framework for SQL query, c3p0 as connection pool.
Our problem is that we expect currently high loads during peak times around 30 and around 4 during low traffic times. Currently we are not using Load balancing between master and slave for select statements.
Configuration of Postgres master DB is as follows:
shared_buffers = 6144MB
temp_buffers = 16MB
max_prepared_transactions = 20
work_mem = 128MB
max_fsm_pages = 409800
autovacuum is on.
c3p0 Hibernate connection pool configuration is:
<property name="c3p0.min_size">3</property>
<property name="c3p0.max_size">200</property>
<property name="c3p0.timeout">300</property>
<property name="c3p0.max_statements">1000</property>
<property name="c3p0.idle_test_period">300</property>
One major problem we face is that select query are very complex, lots of join and even unions.
What would be a solution to tune, scale our actual system adn avoid high load ?
Upgrade hardware ? Load balancing between master and Slave ? Bad Configuration ?
Any suggest on better load balancing replication system than slony ?
Optimize SQL statements is not possible because we are not developing the software.