[pgpool-hackers: 3905] Re: Proposal: If replication delay exceeds delay_threshold, elect a new load balance node with less delay

KAWAMOTO Masaya kawamoto at sraoss.co.jp
Tue May 25 12:07:37 JST 2021


Hi Peng.

I modified my patch.

The select_lower_delay_load_balance_node.patch_r3 includes documentation update.

The test.sh is the regression test script.
Please create directory src/test/regression/tests/033.prefer_lower_delay_standby and
save it in that directory.


On Tue, 11 May 2021 13:43:09 +0900
KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp> wrote:

> Hi,
> 
> Thank you for the feedback. 
> 
> >1. 2. 3.
> 
> Ok, I'll fix.
> 
> > 4. I want to confirm the feature.
> >    According the follwoing code, it seems that if the replication_delay exceeds delay_threshold, 
> >    you are electing the new load balancing node which has less delay than pool_config->delay_threshold.
> >    The new load balancing load should be the backend with the least delay, isn't it?
> 
> I think that there is no problem because users allow the delay which set to delay_threshold.
> But your idea seems to be better. I'll change to check all backends delay and select
> the one with the least delay.
> 
> 
> 
> On Tue, 27 Apr 2021 00:16:41 +0900
> Bo Peng <pengbo ¡÷ sraoss.co.jp> wrote:
> 
> > Hi,
> > 
> > Thank you for your patch.
> > I have reviewed your patch and below is the feedback.
> > 
> > 1. Pgpool-II follows the PostgreSQL coding conventions. 
> > For example, the following code
> > 
> >   -                       pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
> >   +                       if (prefer_lower_delay_standby){
> >   +                           session_context->load_balance_node_id = select_load_balancing_node();
> >   +                           pool_set_node_to_be_sent(query_context, session_context->load_balance_node_id);
> >   +                       } else {
> >   +                           pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
> >   +                       }
> > 
> > should be in the following style:
> > 
> >   if (prefer_lower_delay_standby)
> >   {
> >       session_context->load_balance_node_id = select_load_balancing_node();
> >       pool_set_node_to_be_sent(query_context, session_context->load_balance_node_id);
> >   } 
> >   else 
> >   {
> >       pool_set_node_to_be_sent(query_context, PRIMARY_NODE_ID);
> >   }
> > 
> > 2. The patch should include a regression test which is used to test the new feature.
> > 
> > 3. The patch should include documentation update.
> > 
> > 4. I want to confirm the feature.
> >    According the follwoing code, it seems that if the replication_delay exceeds delay_threshold, 
> >    you are electing the new load balancing node which has less delay than pool_config->delay_threshold.
> >    The new load balancing load should be the backend with the least delay, isn't it?
> >  
> >   +				if ( VALID_BACKEND(i) &&
> >   +					 !IS_PRIMARY_NODE_ID(i) &&
> >   +				 	(bkinfo->standby_delay < pool_config->delay_threshold) &&
> >   +				 	bkinfo->backend_weight > 0 )
> >   +				{
> >   +					selected_slot = i;
> >   +					break;
> >   +				}
> > 
> > 
> > On Tue, 20 Apr 2021 17:24:35 +0900
> > KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp> wrote:
> > 
> > > Hi hackers.
> > > 
> > > On streaming replication mode, pgpool check the streaming delay on selected load
> > > balance node if delay_threshold paraeter is larger than 0. When the delay exceeds
> > > delay_theshold, pgpool send the query to primary regardless other standbies not
> > > delayed. I want the user to be able to choose whether pgpool always send to primary
> > > when there are other standbys with less delay by adding a boolean parameter
> > > "prefer_lower_delay_standby" to pgpool.conf.
> > > 
> > > I improve select_load_balancing_node() function.
> > > If "prefer_lower_delay" is true, pgpool selects another standby node that is lower delayed
> > > than the suggested node even if the suggested node name matches
> > > database_redirect_preference_list or app_redirect_preference_list.
> > > 
> > > Best Regards.
> > > 
> > > -- 
> > > KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp>
> > > SRA OSS, Inc. Japan
> > 
> > 
> > -- 
> > Bo Peng <pengbo ¡÷ sraoss.co.jp>
> > SRA OSS, Inc. Japan
> 
> 
> -- 
> KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp>
> SRA OSS, Inc. Japan
> _______________________________________________
> pgpool-hackers mailing list
> pgpool-hackers ¡÷ pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-hackers


-- 
KAWAMOTO Masaya <kawamoto ¡÷ sraoss.co.jp>
SRA OSS, Inc. Japan
-------------- next part --------------
¥Æ¥­¥¹¥È·Á¼°°Ê³°¤ÎźÉÕ¥Õ¥¡¥¤¥ë¤òÊݴɤ·¤Þ¤·¤¿...
¥Õ¥¡¥¤¥ë̾: select_lower_delay_load_balance_node.patch_r3
·¿:         application/octet-stream
¥µ¥¤¥º:     15002 ¥Ð¥¤¥È
ÀâÌÀ:       ̵¤·
URL:        <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20210525/4551ce13/attachment-0001.obj>
-------------- next part --------------
¥Æ¥­¥¹¥È·Á¼°°Ê³°¤ÎźÉÕ¥Õ¥¡¥¤¥ë¤òÊݴɤ·¤Þ¤·¤¿...
¥Õ¥¡¥¤¥ë̾: test.sh
·¿:         text/x-sh
¥µ¥¤¥º:     2305 ¥Ð¥¤¥È
ÀâÌÀ:       ̵¤·
URL:        <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20210525/4551ce13/attachment-0001.bin>


More information about the pgpool-hackers mailing list