Browse code

- 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 authored on 23/09/2002 16:39:02
Showing 7 changed files
... ...
@@ -101,10 +101,10 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
101 101
 	 -DPKG_MALLOC \
102 102
 	 -DSHM_MEM  -DSHM_MMAP \
103 103
 	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
104
+	 -DDNS_IP_HACK \
104 105
 	 -DUSE_IPV6 \
105 106
 	 -DF_MALLOC \
106 107
 	 -DNO_DEBUG \
107
-	 #-DEXTRA_DEBUG \
108 108
 	 #-DDBG_QM_MALLOC \
109 109
 	 #-DVQ_MALLOC  
110 110
 	 #-DCONTACT_BUG
... ...
@@ -276,7 +276,7 @@ static int mod_init(void)
276 276
 	DBG( "TM - initializing...\n");
277 277
 	/* checking if we have sufficient bitmap capacity for given
278 278
 	   maximum number of  branches */
279
-	if (1<<(MAX_BRANCHES+1)>UINT_MAX) {
279
+	if (MAX_BRANCHES+1>31) {
280 280
 		LOG(L_CRIT, "Too many max UACs for UAC branch_bm_t bitmap: %d\n",
281 281
 			MAX_BRANCHES );
282 282
 		return -1;
... ...
@@ -85,7 +85,9 @@ static int hostent_cpy(struct hostent *dst, struct hostent* src)
85 85
 	}
86 86
 
87 87
 	/* copy h_aliases */
88
-	for (len=0;src->h_aliases[len];len++);
88
+	len=0;
89
+	if (src->h_aliases)
90
+		for (;src->h_aliases[len];len++);
89 91
 	dst->h_aliases=(char**)malloc(sizeof(char*)*(len+1));
90 92
 	if (dst->h_aliases==0){
91 93
 		ser_error=ret=E_OUT_OF_MEM;
... ...
@@ -106,7 +108,9 @@ static int hostent_cpy(struct hostent *dst, struct hostent* src)
106 106
 		strncpy(dst->h_aliases[i], src->h_aliases[i], len2);
107 107
 	}
108 108
 	/* copy h_addr_list */
109
-	for (len=0;src->h_addr_list[len];len++);
109
+	len=0;
110
+	if (src->h_addr_list)
111
+		for (;src->h_addr_list[len];len++);
110 112
 	dst->h_addr_list=(char**)malloc(sizeof(char*)*(len+1));
111 113
 	if (dst->h_addr_list==0){
112 114
 		ser_error=ret=E_OUT_OF_MEM;
... ...
@@ -242,6 +242,7 @@ static inline struct hostent* resolvehost(const char* name)
242 242
 	static struct hostent* he=0;
243 243
 #ifdef __sun
244 244
 	int err;
245
+	static struct hostent* he2=0;
245 246
 #endif
246 247
 #ifdef DNS_IP_HACK
247 248
 	struct ip_addr* ip;
... ...
@@ -249,28 +250,27 @@ static inline struct hostent* resolvehost(const char* name)
249 249
 	
250 250
 	len=strlen(name);
251 251
 	/* check if it's an ip address */
252
-	if ( ((ip=str2ip(name, len))!=0)
252
+	if ( ((ip=str2ip((unsigned char*)name, len))!=0)
253 253
 #ifdef	USE_IPV6
254
-		  || ((ip=str2ip6(name, len))!=0)
254
+		  || ((ip=str2ip6((unsigned char*)name, len))!=0)
255 255
 #endif
256 256
 		){
257 257
 		/* we are lucky, this is an ip address */
258
-		return ip_addr2he(name, len, ip);
258
+		return ip_addr2he((unsigned char*)name, len, ip);
259 259
 	}
260 260
 	
261 261
 #endif
262 262
 	/* ipv4 */
263
-#ifdef __sun
264
-	if (he) freehostent(he);
265
-	he=getipnodebyname(name, AF_INET, 0, &err);
266
-#else
267 263
 	he=gethostbyname(name);
268
-#endif
269 264
 #ifdef USE_IPV6
270 265
 	if(he==0){
271 266
 		/*try ipv6*/
272 267
 	#ifdef __sun
273
-		he=getipnodebyname(name, AF_INET6, 0, &err);
268
+		/* on solaris 8 getipnodebyname has a memory leak,
269
+		 * after some time calls to it will fail with err=3
270
+		 * solution: patch your solaris 8 installation */
271
+		if (he2) freehostent(he2);
272
+		he=he2=getipnodebyname(name, AF_INET6, 0, &err);
274 273
 	#else
275 274
 		he=gethostbyname2(name, AF_INET6);
276 275
 	#endif
... ...
@@ -32,3 +32,73 @@ ser  gcc-3.2      20             2456  2448     3158  3147       3137  3179
32 32
 
33 33
 (*) - retransmissions ( 500ms)
34 34
 (+) - retransmissions (2000ms)
35
+------------------------------------------------------------------------------
36
+
37
+
38
+
39
+date: 23.09.2002
40
+
41
+hardware: alioth UltraSparc-IIi (ser) <=fasteth=> mobile34 2*PIII 900 (stress)
42
+
43
+version: ser 0.8.7-15-tests (sparc64/SunOS)
44
+flags: STATS:Off, USE_IPV6, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC,
45
+FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
46
+MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 3040 
47
+
48
+ser command: ./ser -f test/test-throughput.cfg -l 192.168.57.33 -n 1 -D -m 256
49
+ser command: ./ser -f test/th-uri-fast.cfg     -l 192.168.57.33 -n 1 -D -m 256
50
+
51
+test calls: 10000 
52
+
53
+
54
+stateless:
55
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
56
+ser gcc 3.0        20             666   665      672   673
57
+                  100             666*  658*     675*  656*
58
+                  200             671   660*
59
+
60
+ser gcc 3.0        20             805   807
61
+-DDNS_IP_HACK     100             802*  804*
62
+                  200             783*  775*
63
+
64
+tm:
65
+ser gcc 3.0        20             542   551
66
+-DDND_IP_HACK     100             550   553*
67
+                  200             523*  530*
68
+
69
+-------------------------------------------------------------------------------
70
+
71
+
72
+
73
+date: 23.09.2002
74
+
75
+hardware: balrog 4*UltraSparc-II 296 Mhz (ser) <=fasteth=> mobile34 2*PIII 900 
76
+(stress)
77
+
78
+version: ser 0.8.7-15-tests (sparc64/SunOS)
79
+flags: STATS:Off, USE_IPV6, NO_DEBUG, DNS_IP_HACK, SHM_MEM, SHM_MMAP,
80
+PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT ADAPTIVE_WAIT_LOOPS=1024,
81
+MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 3040
82
+
83
+ser command: ./ser -f test/test-throughput.cfg -l 192.168.46.35 -D -n 1 -m 256
84
+ser command: /ser -f test/th-uri-fast.cfg      -l 192.168.46.35    -n 4 -m 256 
85
+
86
+test calls: 10000 
87
+
88
+
89
+stateless:
90
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
91
+ser gcc3.2         20             924   923      1591  1602      1624  1670
92
+(DNS_IP_HACK)     100             932*  906*     1486* 1420*     1517  1495
93
+                  200             939*  917*     1300* 1386*     1157* 1275*
94
+
95
+tm:
96
+                  throttle      1 proc (cps)   2 procs (cps)   4 procs (cps) 
97
+ser gcc3.2         20             704  725       1137  1202      1460  1575
98
+(DNS_IP_HACK)     100             703* 683*      1150*           1398* 1451*
99
+                  200             723* 723*      1207* 1277*     1176* 1369*
100
+
101
+stress:
102
+test calls: 1000000
103
+                   20          100 procs (cps)
104
+
... ...
@@ -1,10 +1,11 @@
1
-debug=0			# for speed
1
+debug=9			# for speed
2 2
 check_via=0
3 3
 dns=off
4 4
 rev_dns=off
5 5
 #fork=yes
6 6
 log_stderror=yes
7 7
 #children=8
8
+fifo=""
8 9
 
9 10
 route{
10 11
 
... ...
@@ -23,7 +23,7 @@ rev_dns=no      # (cmd. line: -R)
23 23
 
24 24
 #modules
25 25
 #loadmodule "modules/print/print.so"
26
-#loadmodule "modules/tm/tm.so"
26
+loadmodule "modules/tm/tm.so"
27 27
 #loadmodule "modules/rr/rr.so"
28 28
 #loadmodule "modules/maxfwd/maxfwd.so"
29 29