2
0
Эх сурвалжийг харах

- re-added -DDNS_IP_HACK
- use gethostbyname on sun ipv4 instead of getipnodebyname (which has memroy
leaks on unpatched solaris 8 instalations)
- removed UNT_MAX comparison in tm.c
- updated perf. results

Andrei Pelinescu-Onciul 23 жил өмнө
parent
commit
ba506d037f

+ 1 - 1
Makefile.defs

@@ -101,10 +101,10 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DPKG_MALLOC \
 	 -DSHM_MEM  -DSHM_MMAP \
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
+	 -DDNS_IP_HACK \
 	 -DUSE_IPV6 \
 	 -DF_MALLOC \
 	 -DNO_DEBUG \
-	 #-DEXTRA_DEBUG \
 	 #-DDBG_QM_MALLOC \
 	 #-DVQ_MALLOC  
 	 #-DCONTACT_BUG

+ 1 - 1
modules/tm/tm.c

@@ -276,7 +276,7 @@ static int mod_init(void)
 	DBG( "TM - initializing...\n");
 	/* checking if we have sufficient bitmap capacity for given
 	   maximum number of  branches */
-	if (1<<(MAX_BRANCHES+1)>UINT_MAX) {
+	if (MAX_BRANCHES+1>31) {
 		LOG(L_CRIT, "Too many max UACs for UAC branch_bm_t bitmap: %d\n",
 			MAX_BRANCHES );
 		return -1;

+ 6 - 2
proxy.c

@@ -85,7 +85,9 @@ static int hostent_cpy(struct hostent *dst, struct hostent* src)
 	}
 
 	/* copy h_aliases */
-	for (len=0;src->h_aliases[len];len++);
+	len=0;
+	if (src->h_aliases)
+		for (;src->h_aliases[len];len++);
 	dst->h_aliases=(char**)malloc(sizeof(char*)*(len+1));
 	if (dst->h_aliases==0){
 		ser_error=ret=E_OUT_OF_MEM;
@@ -106,7 +108,9 @@ static int hostent_cpy(struct hostent *dst, struct hostent* src)
 		strncpy(dst->h_aliases[i], src->h_aliases[i], len2);
 	}
 	/* copy h_addr_list */
-	for (len=0;src->h_addr_list[len];len++);
+	len=0;
+	if (src->h_addr_list)
+		for (;src->h_addr_list[len];len++);
 	dst->h_addr_list=(char**)malloc(sizeof(char*)*(len+1));
 	if (dst->h_addr_list==0){
 		ser_error=ret=E_OUT_OF_MEM;

+ 9 - 9
resolve.h

@@ -242,6 +242,7 @@ static inline struct hostent* resolvehost(const char* name)
 	static struct hostent* he=0;
 #ifdef __sun
 	int err;
+	static struct hostent* he2=0;
 #endif
 #ifdef DNS_IP_HACK
 	struct ip_addr* ip;
@@ -249,28 +250,27 @@ static inline struct hostent* resolvehost(const char* name)
 	
 	len=strlen(name);
 	/* check if it's an ip address */
-	if ( ((ip=str2ip(name, len))!=0)
+	if ( ((ip=str2ip((unsigned char*)name, len))!=0)
 #ifdef	USE_IPV6
-		  || ((ip=str2ip6(name, len))!=0)
+		  || ((ip=str2ip6((unsigned char*)name, len))!=0)
 #endif
 		){
 		/* we are lucky, this is an ip address */
-		return ip_addr2he(name, len, ip);
+		return ip_addr2he((unsigned char*)name, len, ip);
 	}
 	
 #endif
 	/* ipv4 */
-#ifdef __sun
-	if (he) freehostent(he);
-	he=getipnodebyname(name, AF_INET, 0, &err);
-#else
 	he=gethostbyname(name);
-#endif
 #ifdef USE_IPV6
 	if(he==0){
 		/*try ipv6*/
 	#ifdef __sun
-		he=getipnodebyname(name, AF_INET6, 0, &err);
+		/* on solaris 8 getipnodebyname has a memory leak,
+		 * after some time calls to it will fail with err=3
+		 * solution: patch your solaris 8 installation */
+		if (he2) freehostent(he2);
+		he=he2=getipnodebyname(name, AF_INET6, 0, &err);
 	#else
 		he=gethostbyname2(name, AF_INET6);
 	#endif

+ 70 - 0
test/perf.txt

@@ -32,3 +32,73 @@ ser  gcc-3.2      20             2456  2448     3158  3147       3137  3179
 
 (*) - retransmissions ( 500ms)
 (+) - retransmissions (2000ms)
+------------------------------------------------------------------------------
+
+
+
+date: 23.09.2002
+
+hardware: alioth UltraSparc-IIi (ser) <=fasteth=> mobile34 2*PIII 900 (stress)
+
+version: ser 0.8.7-15-tests (sparc64/SunOS)
+flags: STATS:Off, USE_IPV6, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC,
+FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
+MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 3040 
+
+ser command: ./ser -f test/test-throughput.cfg -l 192.168.57.33 -n 1 -D -m 256
+ser command: ./ser -f test/th-uri-fast.cfg     -l 192.168.57.33 -n 1 -D -m 256
+
+test calls: 10000 
+
+
+stateless:
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
+ser gcc 3.0        20             666   665      672   673
+                  100             666*  658*     675*  656*
+                  200             671   660*
+
+ser gcc 3.0        20             805   807
+-DDNS_IP_HACK     100             802*  804*
+                  200             783*  775*
+
+tm:
+ser gcc 3.0        20             542   551
+-DDND_IP_HACK     100             550   553*
+                  200             523*  530*
+
+-------------------------------------------------------------------------------
+
+
+
+date: 23.09.2002
+
+hardware: balrog 4*UltraSparc-II 296 Mhz (ser) <=fasteth=> mobile34 2*PIII 900 
+(stress)
+
+version: ser 0.8.7-15-tests (sparc64/SunOS)
+flags: STATS:Off, USE_IPV6, NO_DEBUG, DNS_IP_HACK, SHM_MEM, SHM_MMAP,
+PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024,
+MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 3040
+
+ser command: ./ser -f test/test-throughput.cfg -l 192.168.46.35 -D -n 1 -m 256
+ser command: /ser -f test/th-uri-fast.cfg      -l 192.168.46.35    -n 4 -m 256 
+
+test calls: 10000 
+
+
+stateless:
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
+ser gcc3.2         20             924   923      1591  1602      1624  1670
+(DNS_IP_HACK)     100             932*  906*     1486* 1420*     1517  1495
+                  200             939*  917*     1300* 1386*     1157* 1275*
+
+tm:
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
+ser gcc3.2         20             704  725       1137  1202      1460  1575
+(DNS_IP_HACK)     100             703* 683*      1150*           1398* 1451*
+                  200             723* 723*      1207* 1277*     1176* 1369*
+
+stress:
+test calls: 1000000
+                   20          100 procs (cps)
+

+ 2 - 1
test/test-throughput.cfg

@@ -1,10 +1,11 @@
-debug=0			# for speed
+debug=9			# for speed
 check_via=0
 dns=off
 rev_dns=off
 #fork=yes
 log_stderror=yes
 #children=8
+fifo=""
 
 route{
 

+ 1 - 1
test/th-uri-fast.cfg

@@ -23,7 +23,7 @@ rev_dns=no      # (cmd. line: -R)
 
 #modules
 #loadmodule "modules/print/print.so"
-#loadmodule "modules/tm/tm.so"
+loadmodule "modules/tm/tm.so"
 #loadmodule "modules/rr/rr.so"
 #loadmodule "modules/maxfwd/maxfwd.so"