Re: Re: Re: How dose pipe work in aufs ?

2004-02-18 Thread Henrik Nordstrom
On Wed, 18 Feb 2004, Xia Hongtao wrote:

 Dear Henrik Nordstrom:
 
 I had get the final result of comparing three version.In my new test 
 environment, the response time:  
 orig 14.227ms  no_pipe 13.550ms  pipe_patch 13.905ms

What test did you run?

And have you verified the results are consistent if the test is run again?

 I read the code, and found that in disk.c, function diskHandleWrite()  
 and diskHandleRead() had call commSetSelect() to poll the file
 descriptors.  Then if poll/select can not check the readiness of local
 files, the purpose to call commSetSelect() is just divide write or read
 operation into pieces , so that other request can be processed. This can
 increase the throughput.Am I right?

The use of commSetSelect() here is mostly as a convenient way of making
the callback triggered by the select loop rater than immediately. Due to
the limitations of UNIX/POSIX the filedescriptor will immediately indicate
readiness for I/O on the next select loop even if this I/O will block the
Squid process.

The use of select here is not related to performance, just the design of 
Squid with callbacks. These functions are prepared to be asyncronous and 
in Squid-2.2 this was actually where async-io operated.

Regards
Henrik



auth_user_hash_pointer leak? (2.5 Bug #910)

2004-02-18 Thread Henrik Nordstrom
Robert, what is the purpose of the auth_user_hash_pointer in the ntlm
scheme, and do you have any idea as to why the use of this would be
growing a lot?

Regards
Henrik



refresh_pattern in fractions patch

2004-02-18 Thread Muthukumar
Hello All,

 To use the refresh_pattern in fractions,I have attatched a patch as 
refresh_fraction.patch
 The calculation changes are needed in the cache_cf.c for the float.

 I have tested for the refresh time as
 refresh_pattern .   0   20% 4320.12
  as well as 
 refresh_pattern .   0   20% 1.12
 
 Debug information on the cache.log is as
 2004/02/18 19:26:57| Refresh Values: min=0 max=259207 (max=4320.12)
 2004/02/18 19:21:28| Refresh Values: min=0 max=67 (max=1.12)

To test the calculation use this,
#include sys/types.h
main()
{
 float i=4320.12,min=60.11,max=0.0; /*  4320.12 for the fration time */
 max = (int)(time_t)(i*60);
 printf(Max Refresh Time:%f\n,max);
 printf(Max Refresh Time:%d\n,(int)max);
}

refresh_patter.patch

--- cache_cf_old.c  2004-02-18 19:34:53.0 +0530
+++ cache_cf.c  2004-02-18 19:38:12.0 +0530
@@ -218,6 +218,23 @@
 return i;
 }

+/*
+* Used to get the fractional or normal refresh pattern values
+*/
+
+float
+Getfloat(void)
+{
+char *token = strtok(NULL, w_space);
+float i;
+if (token == NULL)
+self_destruct();
+if (sscanf(token, %f, i) != 1)
+self_destruct();
+return i;
+}
+
+
 static void
 update_maxobjsize(void)
 {
@@ -1816,6 +1833,7 @@
 int ignore_reload = 0;
 #endif
 int i;
+float j;
 refresh_t *t;
 regex_t comp;
 int errcode;
@@ -1832,12 +1850,12 @@
 if (token == NULL)
self_destruct();
 pattern = xstrdup(token);
-i = GetInteger();  /* token: min */
-min = (time_t) (i * 60);   /* convert minutes to seconds */
+  j = Getfloat(); /* token: min */
+min = (int)(time_t) (j * 60);  /* convert minutes to seconds */
 i = GetInteger();  /* token: pct */
 pct = (double) i / 100.0;
-i = GetInteger();  /* token: max */
-max = (time_t) (i * 60);   /* convert minutes to seconds */
+ j = Getfloat();  /* token: max */
+max = (int)(time_t) (j * 60);  /* convert minutes to seconds */
 /* Options */
 while ((token = strtok(NULL, w_space)) != NULL) {
 #if HTTP_VIOLATIONS
@@ -1875,6 +1893,7 @@
 t-min = min;
 t-pct = pct;
 t-max = max;
+   debug(22, 1) (Refresh Values: min=%d max=%d\n,(int)min,(int)max);
 if (flags  REG_ICASE)
t-flags.icase = 1;
 #if HTTP_VIOLATIONS



Review is needed.

Regards,
Muthukumar.


Refresh pattern time definitions

2004-02-18 Thread Taneli Leppä
Hello,

Here's my patch enabling different time definitions for
refresh_patterns for both 2.5-STABLE4 and yesterday's CVS
HEAD of 3.0. I noticed now there's a patch to define the
refresh_patterns in fractions, however I think I prefer
my patch more :)
I'm not sure if these are coded according to Squid's standards,
but here they are anyway. Supported time syntaxes are s,
m, h and d (eg. 30s, 5m, 1h, 7d). If no qualifier
is specified, it defaults to minutes.
The patches include a patch for refreshIsCacheable, that drops
the lower limit for cacheability to 1 second. This is something
that may not be good - I'm not sure. Maybe a safer way would
be to set the lower limit to the lowest defined refresh_pattern
min age.
--
  Taneli Leppä | Crasman Co Ltd
  [EMAIL PROTECTED]  | http://www.crasman.fi/
--- squid-2.5.STABLE4/src/refresh.c 2002-07-18 12:22:17.0 +0300
+++ squid-2.5.STABLE4-refresh/src/refresh.c 2004-02-18 11:54:21.0 +0200
@@ -331,7 +331,7 @@
  * 60 seconds delta, to avoid objects which expire almost
  * immediately, and which can't be refreshed.
  */
-int reason = refreshCheck(entry, NULL, 60);
+int reason = refreshCheck(entry, NULL, 1);
 refreshCounts[rcStore].total++;
 refreshCounts[rcStore].status[reason]++;
 if (reason  200)
--- squid-2.5.STABLE4/src/cache_cf.c2003-07-01 23:42:41.0 +0300
+++ squid-2.5.STABLE4-refresh/src/cache_cf.c2004-02-18 12:54:10.0 +0200
@@ -218,6 +218,36 @@
 return i;
 }
 
+int
+GetTimeAsSeconds(void)
+{
+char *token = strtok(NULL, w_space);
+char tdef[2] = { 0 };
+int i;
+
+if (token == NULL)
+   self_destruct();
+if (sscanf(token, %d%1s, i, tdef)  1)
+   self_destruct();
+
+/* Check if a time format definition was given.
+   Supported types:
+   s = seconds 
+   m = minutes
+   h = hours
+   d = days
+*/
+if (strcmp(tdef, ) == 0 || strcmp(tdef, m) == 0) {
+  i = i * 60; 
+} else if (strcmp(tdef, h) == 0) {
+  i = i * 3600;
+} else if (strcmp(tdef, d) == 0) {
+  i = i * 86400;
+}
+return i;
+}
+
+
 static void
 update_maxobjsize(void)
 {
@@ -1779,13 +1809,13 @@
 dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
 {
 while (head != NULL) {
-   storeAppendPrintf(entry, %s%s %s %d %d%% %d\n,
+   storeAppendPrintf(entry, %s%s %s %ds %d%% %ds\n,
name,
head-flags.icase ?  -i : null_string,
head-pattern,
-   (int) head-min / 60,
+   (int) head-min,
(int) (100.0 * head-pct + 0.5),
-   (int) head-max / 60);
+   (int) head-max);
 #if HTTP_VIOLATIONS
if (head-flags.override_expire)
storeAppendPrintf(entry,  override-expire);
@@ -1832,12 +1862,11 @@
 if (token == NULL)
self_destruct();
 pattern = xstrdup(token);
-i = GetInteger();  /* token: min */
-min = (time_t) (i * 60);   /* convert minutes to seconds */
-i = GetInteger();  /* token: pct */
+min = (time_t) GetTimeAsSeconds(); /* token: min */
+i = GetInteger(); /* token: pct */
 pct = (double) i / 100.0;
-i = GetInteger();  /* token: max */
-max = (time_t) (i * 60);   /* convert minutes to seconds */
+max = (time_t) GetTimeAsSeconds(); /* token: max */
+
 /* Options */
 while ((token = strtok(NULL, w_space)) != NULL) {
 #if HTTP_VIOLATIONS
--- squid-3.0-PRE3-20040218/src/refresh.cc  2003-08-10 14:00:44.0 +0300
+++ squid-3.0-PRE3-20040218-refresh/src/refresh.cc  2004-02-18 13:01:31.0 
+0200
@@ -398,7 +398,7 @@
  * refreshed, but the expiry may be low to enforce regular
  * checks
  */
-int reason = refreshCheck(entry, NULL, ESI ? 0 : 60);
+int reason = refreshCheck(entry, NULL, ESI ? 0 : 1);
 refreshCounts[rcStore].total++;
 refreshCounts[rcStore].status[reason]++;
 
--- squid-3.0-PRE3-20040218/src/cache_cf.cc 2003-11-06 18:55:24.0 +0200
+++ squid-3.0-PRE3-20040218-refresh/src/cache_cf.cc 2004-02-18 13:08:32.0 
+0200
@@ -256,6 +256,36 @@
 return i;
 }
 
+int
+GetTimeAsSeconds(void)
+{
+char *token = strtok(NULL, w_space);
+char tdef[2] = { 0 };
+int i;
+
+if (token == NULL)
+   self_destruct();
+if (sscanf(token, %d%1s, i, (char *)tdef)  1)
+   self_destruct();
+
+/* Check if a time format definition was given.
+   Supported types:
+   s = seconds 
+   m = minutes
+   h = hours
+   d = days
+*/
+if (strcmp(tdef, ) == 0 || strcmp(tdef, m) == 0) {
+  i = i * 60; 
+} else if (strcmp(tdef, h) == 0) {
+  i = i * 3600;
+} else if (strcmp(tdef, d) == 0) {
+  i = i * 86400;
+}
+return i;
+}
+
+
 static void
 update_maxobjsize(void)
 {
@@ -2024,13 +2054,13 @@
 dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
 {
 while (head != NULL