LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [PATCH 2.4] backported and enhanced per real serverthresholdlimitati

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH 2.4] backported and enhanced per real serverthresholdlimitation against 2.4-git
From: Roberto Nibali <ratz@xxxxxx>
Date: Tue, 01 Nov 2005 11:26:59 +0100
ADDENDUM:

> o I wonder if the following code is really intended that way:
> 
> +       if (dest->l_threshold != 0) {
> +               if (ip_vs_dest_totalconns(cp, dest) < dest->l_threshold) {
> +                       dest->flags &= ~IP_VS_DEST_F_OVERLOAD;
> +               }
> +       } else if (dest->u_threshold != 0) {
> +               // I'm not so sure if this is a good idea. --ratz
> +               if (ip_vs_dest_totalconns(cp, dest) * 4 <
> dest->u_threshold * 3)
>  {
> +                       dest->flags &= ~IP_VS_DEST_F_OVERLOAD;
> +               }
> +       } else {
> +               if (dest->flags & IP_VS_DEST_F_OVERLOAD) {
> +                       dest->flags &= ~IP_VS_DEST_F_OVERLOAD;
> +               }
> +       }
> +

I'll probably drop the 3/4 cutoff in the next patch drop.

> +/*
> + *     Server overloaded? 
> + */
> +static inline int ip_vs_is_overloaded(struct ip_vs_dest *dest) {
> +     return dest->flags & IP_VS_DEST_F_OVERLOAD;
> +}
> +

Consider this for 2.6.x.

> +static inline int ip_vs_dest_totalconns(struct ip_vs_conn *cp, struct 
> ip_vs_dest *dest)
> +{
> +     IP_VS_DBG(3, "ip_vs_dest_totalconns: %d(act+inact) %d(dest->refcnt) 
> %d(cp->refcnt)\n",
> +             atomic_read(&dest->activeconns)+atomic_read(&dest->inactconns),
> +             atomic_read(&dest->refcnt),
> +             atomic_read(&cp->refcnt));
> +     return 1 + atomic_read(&dest->activeconns)
> +             + atomic_read(&dest->inactconns);
> +}

Off-by-one because of sloppy code below:

>  /*
>   *  Bind a connection entry with a virtual service destination
> @@ -1096,7 +1107,7 @@
>       cp->flags |= atomic_read(&dest->conn_flags);
>       cp->dest = dest;
>  
> -     IP_VS_DBG(9, "Bind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d "
> +     IP_VS_DBG(3, "Bind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d "
>                 "d:%u.%u.%u.%u:%d fwd:%c s:%s flg:%X cnt:%d destcnt:%d\n",
>                 ip_vs_proto_name(cp->protocol),
>                 NIPQUAD(cp->caddr), ntohs(cp->cport),
> @@ -1105,6 +1116,14 @@
>                 ip_vs_fwd_tag(cp), ip_vs_state_name(cp->state),
>                 cp->flags, atomic_read(&cp->refcnt),
>                 atomic_read(&dest->refcnt));
> +     IP_VS_DBG(3, "ip_vs_bind_dest: Checking overload: u:%d t:%d\n",
> +             dest->u_threshold, ip_vs_dest_totalconns(cp, dest));
> +     if (dest->u_threshold != 0 &&
> +         ip_vs_dest_totalconns(cp, dest) >= dest->u_threshold) {
> +             IP_VS_DBG(3, "ip_vs_bind_dest: Overload (d:%u.%u.%u.%u:%d)\n",
> +                     NIPQUAD(cp->daddr), ntohs(cp->dport));
> +             dest->flags |= IP_VS_DEST_F_OVERLOAD;
> +     }
>  }

It should read "ip_vs_dest_totalconns(cp, dest) > dest->u_threshold)"
then the off-by-one is not needed. Will be fixed in the next drop.

> diff -Nur linux-2.4.32-orig/net/ipv4/ipvs/ip_vs_wlc.c 
> linux-2.4.32-pab2/net/ipv4/ipvs/ip_vs_wlc.c
> --- linux-2.4.32-orig/net/ipv4/ipvs/ip_vs_wlc.c       2004-04-14 15:05:41 
> +0200
> +++ linux-2.4.32-pab2/net/ipv4/ipvs/ip_vs_wlc.c       2005-10-27 17:01:37 
> +0200
> @@ -91,6 +91,8 @@
>       l = &svc->destinations;
>       for (e=l->next; e!=l; e=e->next) {
>               least = list_entry(e, struct ip_vs_dest, n_list);
> +             if (ip_vs_is_overloaded(least))
> +                     continue;
>               if (atomic_read(&least->weight) > 0) {
>                       loh = ip_vs_wlc_dest_overhead(least);
>                       goto nextstage;

I wonder if we should go over the code and convert all this stuff to
list_for_each_entry or similar.

Updated patch will follow,
Roberto Nibali, ratz
-- 
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
terreActive AG                       Wir sichern Ihren Erfolg
-------------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 2.4] backported and enhanced per real serverthresholdlimitation against 2.4-git, Roberto Nibali <=