Load balance Three Postgresql database (Primary, Secondery1 and Secondery2) Servers

Posted on 2014-07-24
Last Modified: 2014-07-27
Hi Experts,

I have somewhat large Postgresql database to manage and it's about 10GB after I made a dump and I believe it will take about 100GB space after it's populated on a hard disk. Currently I have implemented this on a Standby hot replication cluster. Two basic modules are running in this application and some reporting modules are directly connecting to the Secondary node(read only) and still there some SELECT queries coming in to Primary node(read/write) too.

Pgbouncer has implemented on both of these two database servers and currently operates on Transaction mode.  

I get too high I/O rate and Processing rates ( %I/O wait is around 15 ~ 20, Load leverage is around 8 ~ 10) in the peak times. (these two databases are running on SSD with 8 cores of 2.5 Ghz, two Blades, Ubuntu 12.04 server 64bit )

So I'm planning to add third read only server and implement a mechanism to balance the load across these three DB servers. Example, filter all the read requests on secondery1, secondery2  and write requests on the Primary.

Did any one tried this with pgpool-II, or what is your valuable recommendation on such a situation ?

Thanks a lot for your time !
Question by:Shakthi777
  • 2
  • 2
LVL 40

Assisted Solution

lcohan earned 166 total points
ID: 40218059
"Two basic modules are running in this application and some reporting modules are directly connecting to the Secondary node(read only) and still there some SELECT queries coming in to Primary node(read/write) too. "

In my opinion it would be better to direct the traffic from the application to the desired instance and not from the backend database servers. In other words the app should have 2/3 connection strings (and app pools) to direct the queries against the desired "node" for the desired purpose.
LVL 32

Accepted Solution

Daniel Wilson earned 334 total points
ID: 40218399
Another option is pl/Proxy.

That is the solution Hannu Krosing developed to scale Postgres for Skype.

I haven't yet implemented a cluster in PostgreSQL, but PL/Proxy is the tool I expect to use ... later this year.

Author Comment

ID: 40219552
I really wanted to thank for all your prompt responses,

This applications has implemented with a single connections string, any good approach on separating those ?

#Daniel Wilson
Partitioning is another option it's seems ?
LVL 32

Assisted Solution

by:Daniel Wilson
Daniel Wilson earned 334 total points
ID: 40220328
PL/Proxy involves a partitioning / sharding scheme.  The application knows nothing of the sharding.  It simply talks to the proxy.  The proxy knows which shard to contact .

Author Closing Comment

ID: 40223501
Thanks for the valuable comments !

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parallel rsync issues with Ubuntu 1 41
Unix Help with:  mailx -s 17 59
UM7 Stop Sending packets with GPS Sensor 1 21
IMAP copying tool 14 49
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question