<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: HelveticaNeue;" class="">RDS is only a managed database hosting. Basically server and database running on it packaged into “RDS instance” and managed for you.</span><div class="" style="font-family: HelveticaNeue;">When you create RDS instance or Master-Slave, you still connect to plain Postgres. There’s no balancer middleware provided by Amazon.&nbsp;</div><div class="" style="font-family: HelveticaNeue;">&nbsp;They have Elastic Load Balancer but that is more like low-level packet router, nothing to do with databases.</div><div class="" style="font-family: HelveticaNeue;"><br class=""></div><div><blockquote type="cite" class=""><div class="">On 1 Apr 2016, at 8:49 PM, Dennis Gearon &lt;<a href="mailto:gearond@gmail.com" class="">gearond@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><p dir="ltr" class="">I thought Amazon RDS handles all that for you automatically? Specifically load balancing to the second machine</p>
<div class="gmail_quote">On Apr 1, 2016 2:49 AM, "Roman D" &lt;<a href="mailto:dostick@gmail.com" class="">dostick@gmail.com</a>&gt; wrote:<br type="attribution" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br class="">
<br class="">
Amazon RDS Master and Read replica.<br class="">
The goal is to have Read queries balanced to Read Replica using pgpool, while Replication is provided by RDS.<br class="">
I thought that my case is pretty common, but there’s no mention anywhere on the net or in this list of someone ever done this.<br class="">
<br class="">
But surprisingly this configuration works!<br class="">
Using combination of these parameters:<br class="">
replication_mode = off<br class="">
load_balance_mode = on<br class="">
master_slave_mode = on<br class="">
master_slave_sub_mode = ‘stream'<br class="">
<br class="">
pgpool 3.3.4<br class="">
Master configured in pgpool.paswd as 0 and replica as 1<br class="">
<br class="">
Here’s the conf:<br class="">
<br class="">
backend_hostname0 = ‘master’<br class="">
backend_port0 = 5432<br class="">
backend_weight0 = 1<br class="">
backend_flag0 = ‘DISALLOW_TO_FAILOVER’<br class="">
<br class="">
backend_hostname1 = ’slave’<br class="">
backend_port1 = 5432<br class="">
backend_weight1 = 1<br class="">
backend_flag1 = ‘DISALLOW_TO_FAILOVER'<br class="">
<br class="">
enable_pool_hba = on<br class="">
pool_passwd = ‘pool_passwd'<br class="">
ssl = off<br class="">
<br class="">
num_init_children = 200<br class="">
max_pool = 4<br class="">
child_life_time = 300<br class="">
child_max_connections = 2000<br class="">
connection_life_time = 300<br class="">
client_idle_limit = 0<br class="">
listen_backlog_multiplier = 5<br class="">
<br class="">
connection_cache = on<br class="">
reset_query_list = ‘ABORT; DISCARD ALL'<br class="">
<br class="">
replication_mode = off<br class="">
load_balance_mode = on<br class="">
master_slave_mode = on<br class="">
master_slave_sub_mode = 'stream'<br class="">
sr_check_period = 0<br class="">
<br class="">
parallel_mode = off<br class="">
health_check_period = 0<br class="">
use_watchdog = off<br class="">
memory_cache_enabled = off<br class="">
<br class="">
<br class="">
The problem is that pgpool is up to 4 times slower then direct connection to database.<br class="">
Without pgpool database roundtrip is 10 msec. With pgpool it’s 30-40 msec.<br class="">
<br class="">
pgpool is hosted on separate machine form the application and database. PGPool machine CPU is at 5% ( net.core.somaxconn set to 5000)<br class="">
application CPU/memory is at 50% and database CPU&amp;memory is at 50% load<br class="">
so basically pgpool is being the bottleneck, doing something that slows down the database access.<br class="">
<br class="">
I tried changing every possible parameter, changing num_init_children, max_pool - that does not improve anything.<br class="">
<br class="">
I am about to give up. Please help! Is there anything else I can look into ?It would be amazing if this worked without adding such significant time overhead.<br class="">
<br class="">
Thank you!<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
pgpool-general mailing list<br class="">
<a href="mailto:pgpool-general@pgpool.net" class="">pgpool-general@pgpool.net</a><br class="">
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank" class="">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>