[pgpool-hackers: 3899] 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 11 13:43:09 JST 2021


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


More information about the pgpool-hackers mailing list