Where's the CPU being used up in squid-3 ?

From: Adrian Chadd <adrian@dont-contact.us>
Date: Wed, 27 Sep 2006 23:04:21 +0800

Hiya,

I'm profiling squid-3 and I'm trying to quell the heavy CPU users.

Specifically, I'm trying to find why comm_close() is profiling as taking
~19% of the CPU.

Bout 3% is due to close(); which is annoying but understandable.
The other 16%? Good question.

I ended up here.

void
ConnStateData::freeAllContexts()
{
    ClientSocketContext::Pointer context;

    while ((context = getCurrentContext()).getRaw() != NULL) {
        assert(getCurrentContext() !=
               getCurrentContext()->next);
        PROF_start(Temp2);
        context->connIsFinished();
        PROF_stop(Temp2);
        assert (context != currentobject);
    }
}

If Temp2 is around the while() loop then it matches the runtime for the
comm close handlers within half a percent - ie, 13.13%.

Where it is there, it only accounts for 2.18% of the CPU.

Stepping through the code here shows that the refcounted allocator is involved.
I then get lost in the bowels of the client stream and storage manager code.
How much work can possibly be involved in this? All I'm doing in this test case
is using apachebench to hammer on an internally-generated .gif (one of the
static icons.)

Could someone please take a look at where all the CPU is going? Another one
I've tried tracking is what happens after httpStart() (37% of the CPU); again,
I get lost in the bowels of the clientstream code.

Adrian

Adrian
Received on Wed Sep 27 2006 - 09:03:37 MDT

This archive was generated by hypermail pre-2.1.9 : Sun Oct 01 2006 - 12:00:06 MDT