[nSLUG] httpd busy on idle machine?

Mike Spencer mspencer at tallships.ca
Sun Jul 5 03:37:45 ADT 2015


chris thompson <ct8ball at gmail.com> wrote:

> I wouldn't mind having a poke at it as I'm interested :p

Okay.  Great.  (background appended infra for context.)

> I do believe any of the information should be available through
> sar. for specific app monitoring I think that should already be
> installed there.

Hmm.  Okay, yes.  sar(1) is another new one for me.  I see that the -x
and -X options (which gave info on designated processes) have been
dropped between sysstat 7 and the sysstat 9 that's on the machine in
question.  It's not clear what sar can tell me.  Er, well, that I can
understand, that is. :-)

> How many of these gettimeofday requests are you talking about?
> have you parsed the info to figure that out?

As far as I can tell, about 30/sec (from doing strace in htop, pausing
and scrolling back, counting calls with the same seconds arg manually.
I can't see how to redirect the htop 's' display to a file.)

> is it deb or redhat?

Slackware 14.1.

>  did you attempt to lower the threads?

I barely understand what theads are so anything I say about them may be
risibly wrong.

htop shows about 75 processes, each with a different PID, associated
with the command "/usr/sbin/httpd -k start".  Threads are supposed to
share one PID, are they not? 

In any case, I have no idea how to limit number of threads.  I don't
see anything along that line in httpd.conf.  (Just as a benchmark,
I've written a fair amount of C code for CP/M and DOS but none beyond
the trivial level in the Linux environment.)

> is it on a 64 bit machine?

You know what?  I don't know for sure. I've assumed that it's a 64 bit
CPU.  The OS is 32 bit Linux.  lshw reports some devices as "width 32"
bits, some as 64, e.g.

roadgrime
    description: Notebook
    product: Aspire E5-721 (Aspire E5-721_088C_1_04)
    vendor: Acer
    version: 1
    serial: NXMNDAA0034270E34D7600
    width: 32 bits

    [snip]

     *-cpu
          description: CPU
          product: AMD A4-6210 APU with AMD Radeon R3 Graphics
          vendor: Hynix Semiconductor (Hyundai Electronics)
          physical id: 4
          bus info: cpu at 0
          version: 15.0.1
          serial: NotSupport
          slot: Socket FT3b
          size: 1GHz
          capacity: 1800MHz
          width: 64 bits
          clock: 100MHz


>  where was the package from?

httpd-2.4.6-i486-1 (Apache) binary as distributed with Slackware 14.1

> did you compile it yourself or was it from a repo?

>From a repository?  No, neither.

> I'm certainly curious if you couldn't tell.

I don't understand the question.  Couldn't tell what?

In a previous post you wrote:

> I might have missed it, but did you check the apache error log files
> as well as syslog to see if there is any activity there? Perhaps
> even the access log files but my guess is you prob wont see anything
> there.

Nothing in error log but startup and shutdown.  Nothing in access log
except legit access from local host or across my LAN.

Thanks for your interest.  I don't really know if it's a problem or
not.  I just don't understand why httpd should appear to be busy in a
mostly idle machine that isn't connected to the net.

I understand why htop should show X, xterm, acpid and perl as
busy. After all, htop itself is running in an xterm and a perl script
is reporting battery status in another xterm.  But why does it appear
that httpd and udevd are *doing* something all the time?  Huh.


- Mike

--- Context ---

> Date: Sun, 28 Jun 2015 16:36:44 -0300
> From: D G Teed <donald.teed at gmail.com>
> To: Nova Scotia Linux User Group <nslug at nslug.ns.ca>
> Subject: Re: [nSLUG] httpd busy on idle machine?
> Message-ID:
>         <
> CAMNR8_N6YrFBFW5i22WB96MbNPFmcZTfkrcPc7GjLM8ZPYar6Q at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Thu, Jun 25, 2015 at 9:15 AM, Hatem Nassrat <hnassrat at gmail.com> wrote:
>>
>>> On Jun 25, 2015 3:49 AM, "Mike Spencer" <mspencer at tallships.ca> wrote:
>>>>
>>>> htop? Another new one for me.  It appears to show something like 90
>>>> httpd processes, one belonging to root, the others to user apache.
>>>> Using the htop(1) 's' option (for strace) on the instance belonging to
>>>> root shows a steady stream of this:
>>>>
>>>>    select(0, NULL, NULL, NULL, {1, 0})    = 0 (Timeout)
>>>>    waitpid(-1, 0xfbb9934, WNOHANG|WSTOPPED) = 0
>>>>
>>>> about 1 per second.
>>>>
>>>> Trace of some instances that belong to apache seem to be doing nothing
>>>> but some are furiously busy:
>>>>
>>>>     gettimeofday({1435211835, 144305}, NULL) = 0
>>>>     gettimeofday({1435211835, nnnnnn}, NULL) = 0
>>>>     gettimeofday({1435211835, nnnnnn}, NULL) = 0
>>>>     epoll_wait(7, {}, 25, 100)
>>>>
>>>> repeated very rapidly; where nnnnnn is a 6 digit number, different in
>>>> each line.  (htop seems to disable the X copy/paste function in an
>>>> xterm so I have to type data from htop.)
>>>
>>> I believe these two entries are your answer.
>>>
>>> The first seems to indicate a busy wait on a socket with a 1 sec
>>> timeout.
>>>
>>> The second indicates that apache is asking for the time of day perhaps
>>>  for
>>> use in a log file would be my guess?
>>>
>>> I might have missed it, but did you check the apache error log files as
>>> well as syslog to see if there is any activity there? Perhaps even the
>>> access log files but my guess is you prob wont see anything there.
>
> I have not tried it yet, but at the end of the work day I was looking at
> an article about using sysdig.
>
> http://www.sysdig.org/
>
> It looks very good, just a lot of verbose syntax, which seems to be the
> way things are going with systemd, ldap, ipv6, etc.

--- More Context ---

Date: 24 Jun 2015 02:27:39 -0300
From: mspencer at tallships.ca (Mike Spencer)
To: nslug at nslug.ns.ca
Subject:  [nSLUG] httpd busy on idle machine?
Reply-to: mspencer at tallships.ca


Running a 3.10.17 kernel on my rather new laptop.

When the machine is essentially idle -- X on, some iconified xterms
and emacsen and xclock, cable-connected to LAN but not to internet, no
traffic in or out, top(1) running in an xterm.

I see that one or more instances of httpd and kworker/n:m spend a lot
of time near the top of the display.  AIUI, kworker is/are generic
handlers for system calls.  So in my ignorance, this appears to me as
if httpd is busy *doing* something when nothing should be asking it to
do anything.

rcu_sched and udevd pop up to the top of the display frequently, too.

On my desktop, running an older (2.4) kernel, httpd never shows up
near the top of top(1) unless I send a browser to http://localhost.

Is something weird or undesirable happening with the laptop?  Or is
it normal for newer kernel and software to doing some kind of busywork
on a mostly idle machine?

(I only thought to look at this because I had an anomalous boot
followed by sluggish response of a fast machine.  Killing and
restarting httpd seemed to fix the sluggishness.  Subsequent boot was
normal but the behavior of httpd in top(1) was the same. But I don't
really know what I'm looking at here, don't understand all th einfo
that top(1) can show me.)


- Mike

-- 
Michael Spencer                  Nova Scotia, Canada       .~. 
                                                           /V\ 
mspencer at tallships.ca                                     /( )\
http://home.tallships.ca/mspencer/                        ^^-^^


More information about the nSLUG mailing list