Article delegate-en/1711 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]

Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: Load balancing among multiple servers (Re: ldap virtual server)
26 Jun 2002 10:08:20 GMT "Mark Coleman" <pvudabdyi-t7hpmu7cwfxr.ml@ml.delegate.org>


Thanks for the prompt response.

I'll apply the patch and give it a try.

Cheers,
Mark


"Yutaka Sato" <feedback@delegate.org> wrote in message
news:<_A1710@delegate-en.ML_>...
> On 06/25/02(19:34) you "Mark Coleman" <pvudabdyi-t7hpmu7cwfxr.ml@ml.delegate.org> wrote
> in <_A1709@delegate-en.ML_>
>  |I am in the process of evaluating delegate for use in a number of
>  |situations. I have successfully configured it as a simple proxy that
relays
>  |non-SSL ldap client requests to/from an SSL-ldap server. That all went
very
>  |well once the relevant certificates were in place.
>  |
>  |I am now looking at the problem:
>  |
>  |Is it possible to configure delegate in such a way as to present a
single
>  |virtual ldap server to a number of real ldap servers? If this is
possible,
>  |how are ldap requests distributed amongst the real servers (round-robin
>  |etc)?
>
> Does those LDAP servers serve the same contents?  Do you intend to
> distribute load on those machines?  If so, you can use round-robin
> for hostname/ip-addresses resolution by HOSTS="*/*/RR".  The pseudo
> hostname which represents the set of LDAP servers, of address
> 11.11.11.11, 22.22.22.22, ... for example, can be defined locally
> within DeleGate by HOSTS parameter as follows, as well as given by
> DNS.
>
>   SERVER=ldap://ldapservers
>   HOSTS="ldapservers/{11.11.11.11,22.22.22.22,...}"
>   HOSTS="*/*/RR"
>
> I noticed that this round-robin mechanism has been applicable only
> to specific protocols like HTTP where multiple requests are
> processed in a single process.  The enclosed patch will fix it so
> that arbitrary protocol including LDAP can use this feature.
>
> (I know this implementation is so naive, but at least it will work...)
>
> Cheers,
> Yutaka
> --
>   @ @ Yutaka Sato <y.sato@delegate.org> http://www.delegate.org/y.sato/
>  ( - ) National Institute of Advanced Industrial Science and Technology
(AIST)
> _<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
>
> *** ../delegate7.9.8/src/inets.c	Wed Apr 24 16:37:05 2002
> --- inets.c	Wed Jun 26 04:11:24 2002
> ***************
> *** 33,38 ****
> --- 33,39 ----
>   	int	hc_freq;
>   	int	hc_predef;
>   	int	hc_mtime;
> + 	int	hc_shuffled; /* initial shuffling done */
>    struct hostent	hc_hostent;
>   } Hostent;
>
> ***************
> *** 64,69 ****
> --- 65,71 ----
>   	double	ie_resStart;
>   	int	ie_REUSE;
>   	int	ie_REUSEPORT;
> + 	int	ie_DO_SHUFFLE; /* round-robin in the current implementation */
>   } InetsEnv;
>   static InetsEnv *inetsEnv;
>   #define IE	inetsEnv[0]
> ***************
> *** 88,93 ****
> --- 90,96 ----
>   #define resStart	IE.ie_resStart
>   #define REUSE		IE.ie_REUSE
>   #define REUSEPORT	IE.ie_REUSEPORT
> + #define DO_SHUFFLE	IE.ie_DO_SHUFFLE
>
>   minit_inets(){
>   	if( inetsEnv == 0 ){
> ***************
> *** 403,408 ****
> --- 406,426 ----
>   		hp->h_addr_list[hi] = haddr0;
>   	}
>   }
> + extern int CHILD_SERNO;
> + static shift_addrlist(hp)
> + 	struct hostent *hp;
> + {	int na,sn,si;
> +
> + 	for( na = 0; hp->h_addr_list[na]; na++ )
> + 		;
> + 	if( na < 2 )
> + 		return;
> + 	sn = CHILD_SERNO % na;
> + 	if( sn == 0 )
> + 		return;
> + 	for( si = 0; si < sn; si++ )
> + 		shuffle_addrlist(hp);
> + }
>
>   static findName1(hp,name)
>   	struct hostent *hp;
> ***************
> *** 866,872 ****
> --- 884,901 ----
>   			hp = &Hp->hc_hostent;
>   			if( hp->h_name[0] == 0 || hp->h_addr_list[0] == 0 )
>   				return 0;
> + /*
>   			else	return hp;
> + */
> + 			else{
> + 				if( DO_SHUFFLE )
> + 				if( ADDRLIST_RR && Hp->hc_shuffled == 0 )
> + 				{
> + 					shift_addrlist(hp);
> + 					Hp->hc_shuffled = 1;
> + 				}
> + 				return hp;
> + 			}
>   		}
>   	}
>   	if( cache_only || CACHE_ONLY )
> ***************
> *** 1543,1549 ****
> --- 1572,1584 ----
>   		return sockopen1(sock,sap,what,portname,hostname);
>   	}
>
> + /*
>   	if( hp = gethostbyNameAddr(0,hostname) ){
> + */
> + 	DO_SHUFFLE = 1;
> + 	hp = gethostbyNameAddr(0,hostname);
> + 	DO_SHUFFLE = 0;
> + 	if( hp ){
>   		int nsock;
>   		struct hostent *nhp;
>


  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V