Re: %cpu in system - squid performance in FreeBSD 5.3

From: Robert Watson (rwatson_at_freebsd.org)
Date: 12/26/04

  • Next message: Andrew Seguin: "RE: FW: Curiosity in IPFW/Freebsd bridge. [more] 802.1q VLAN at fault?"
    Date: Sun, 26 Dec 2004 07:10:59 +0000 (GMT)
    To: João Carlos Mendes Luís <jonny@jonny.eng.br>
    
    

    On Sun, 26 Dec 2004, João Carlos Mendes Luís wrote:

    > It must not be this. Squid is mostly a single process system, with
    > scheduling based on descriptors and select/poll. Recent versions added
    > some parallelism in other processes, but just for file reading/writing
    > (diskd) and regular expression processing for ACLs. Even DNS, which
    > previously ran on blocking I/O in secondary processes now run internally
    > in the select/poll scheduler.

    Thanks for this information.

    > > I might start by turning on kernel profiling and doing a profile dump
    > > under load. Be aware that turning on profiling uses up a lot of CPU
    > > itself, so will reduce the capacity of the system. There's probably
    > > documentation elsewhere, but the process I use to set up profiling is
    > > here:
    >
    > I did not make any tests on this, but I would expect profiling to
    > fail, since every step of the scheduler is very small, and deals with
    > the smallest I/O available at that time.

    This is kernel profiling, not application profiling, and would hopefully
    give us information on where the kernel was spending most of its time,
    since in the environment in question system time appears to be dominant.
    If SMP in theory makes little difference to Squid performance, then
    switching to a UP kernel may well make kernel profiling more reliable and
    hence more useful in tracking systemn time.

    > Indeed, based on the original report I would search for some
    > optimization on descriptor searching in poll or select, whichever squid
    > has chosen to use on FreeBSD (probably select, looking at the top
    > output). This is one of the crucial points on squid performance. The
    > other one is disk access, for sure, but the experimente describe would
    > not change disk access patterns, would it?

    The reporter described a very high percentage of system time -- time spent
    blocked on disk I/O isn't billed to system time; if spending lots of time
    waiting on disk I/O for a single process, you'd see idle time rather than
    system time predominating, I believe.

    > > As a final question: other than CPU consumption, do you have a reliable
    > > way to measure how efficiently the system is operating -- in particular,
    > > how fast it is able to serve data? Having some sort of metric for
    > > performance can be quite useful in optimizing, as it can tell us whether
    >
    > One thing I fail to measure in FreeBSD is the reason for delays in
    > disk access times. How can I prove that the delay is on disk, and
    > determine how to optimize it? systat -v is very useful, but does not
    > give me all answers.

    I'm not sure there are useful summary tools at a system-wide level for
    this, but it is possible to use KTR(9) to trace the associated scheduler
    and disk events. In particular, I recently added high level tracing of
    g_down and g_up GEOM events to KTR. Jeff Roberson is about to commit a
    scheduler visualization tool that interprets KTR events relating to the
    scheduler that may also be useful. It would certainly be extremely useful
    to have a tool for normal system operation that could be pointed at a
    process to say "show me the percent of time spent on various wait channels
    for pid 50". ktrace(1) has the ability to track context switches but
    appears not to provide enough information to figure out why the context
    switch took place currently. I'll investigate this in the next couple of
    days -- the trick is to gather this sort of statistic without too much
    additional overhead. If that's not easily possible, then simply
    post-processing KTR may be the right approach.

    Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
    robert@fledge.watson.org Principal Research Scientist, McAfee Research

    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Andrew Seguin: "RE: FW: Curiosity in IPFW/Freebsd bridge. [more] 802.1q VLAN at fault?"

    Relevant Pages

    • Re: %cpu in system - squid performance in FreeBSD 5.3
      ... > in the select/poll scheduler. ... Be aware that turning on profiling uses up a lot of CPU ... > other one is disk access, for sure, but the experimente describe would ... The reporter described a very high percentage of system time -- time spent ...
      (freebsd-performance)
    • Re: Pluggable Disk Scheduler Project
      ... is anybody working on the `Pluggable Disk Scheduler Project' from ... I would put it into geom. ... hardware) outstanding request and to pass new requests to its ... experimenting with various solutions on the scheduler placement. ...
      (freebsd-hackers)
    • Re: Pluggable Disk Scheduler Project
      ... is anybody working on the `Pluggable Disk Scheduler Project' from ... hardware) outstanding request and to pass new requests to its ... You'll want to queue at least two requests at once. ...
      (freebsd-hackers)
    • Re: AVR Tx Rx direkt koppeln
      ... Es werden von 2 Tasks jeweils viele Dateioperationen an den Scheduler des ... Eigenschaftend er Platte nicht ignoriert werden. ... die aktuellen disk scheduler sind ziemlich clever. ... Unabhaengige Dateien koennen unabhaengig bearbeitet werden und in ...
      (de.sci.electronics)
    • Re: AVR Tx Rx direkt koppeln
      ... Eigenschaftend er Platte nicht ignoriert werden. ... die aktuellen disk scheduler sind ziemlich clever. ... Die Syscalls kehren erst zurueck, ...
      (de.sci.electronics)