Re: [squid-users] A very low level question regarding performance of helpers.

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 13 Feb 2014 02:06:33 +1300

On 12/02/2014 8:12 p.m., Alan wrote:
> Hi Eliezer,
>
> I know you have been testing fake helpers in a variety of languages.
> How about this one in C?
> Save it to helper-trivial.c and then compile it like this:
> gcc -O3 trivial.c -o trivial
> strip trivial
>
> #include <unistd.h>
> int main(int argc, char *argv[]) {
> char in[256];
> char out[3] = "OK\n";
> while (1) {
> read(0, in, 256);
> write(1, out, 3);
> fsync(1);
> }
> }

This one will eventually hang and not exit after Squid disconnects. You
need the loop to be:
 do {
   ...
 } while (!feof(1));

NP: and helpers have to receive input lines of anywhere between 1KB and
32KB.

Amos
Received on Wed Feb 12 2014 - 13:06:42 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 12 2014 - 12:00:04 MST