John Doe escreveu:
Nice John, thanks very much for that !! Got it compiled and
running, no problem. Anyway, i found interesting that squid is
reporting a high average service time for this do-almost-nothing
external ACL (from cachemgr.cgi, external acl stats):
any hint on that ???

Did you compare with the perl version...?

First, try it from the shell...
Tested without the while loop and it looks fast (on my workstation):
  real    0m0.001s
  user    0m0.000s
  sys     0m0.001s
With one fgets, I get in the worst case:
  real    0m0.002s
  user    0m0.000s
  sys     0m0.002s

If it is also fast, maybe it is the fflush that is slow...


   Hi John,

I think there's no problem with perl and C version. The problem seems that i was trying to analyze average service timers with too few requests and very low TTL (i was using 10 seconds). By the nature of this external ACL, i simply cannot have very high TTLs, as i would have in other cases. Anyway, after raising TTL to 30 seconds and having a lot more requests, average time is getting low each time:

External ACL Statistics: verifica-ano
Cache size: 9
program: /etc/squid/verifica-ano.pl
number running: 3 of 3
requests sent: 1672
replies received: 1672
queue length: 0
avg service time: 95.48 msec


   (several minutes later)

External ACL Statistics: verifica-ano
Cache size: 9
program: /etc/squid/verifica-ano.pl
number running: 3 of 3
requests sent: 2761
replies received: 2761
queue length: 0
avg service time: 82.11 msec


and those numbers are with the perl version !!! I'm pretty sure the C and Perl versions wont have a very different response time. Both are do-almost-nothing codes and i'm pretty sure both are extremely fast.

Anyway, i'll use the C version because it has a lower memory footprint. Each instance of microperl runs with 3.2% of memory (3.2% of 29860= 955Kb). Each instance of C version runs with 0.8% of memory (0.8% of 29860=239Kb). All 3 instances of C version didnt use the memory of a single microperl instance.

These memory usage numbers, measured in Kbs, can be stupid when analyzed for plenty-of-RAM machines .... but as i'm talking of a 32Mb RAM device, they make the whole difference :)

--


        Atenciosamente / Sincerily,
        Leonardo Rodrigues
        Solutti Tecnologia
        http://www.solutti.com.br

        Minha armadilha de SPAM, NÃO mandem email
        [EMAIL PROTECTED]
        My SPAMTRAP, do not email it




Reply via email to