RE: An attempt at optimising the poll code

From: Chemolli Francesco (USI) <ChemolliF@dont-contact.us>
Date: Mon, 7 Aug 2000 09:25:38 +0200

> On Fri, Aug 04, 2000, Henrik Nordstrom wrote:
> > I think evenly dividing the filedescriptor sets won't do
> you much good.
> > Instead a suitable priority mechanism should be found
> telling how often
> > an given FD is polled.
>
> That would be the optimal poll() solution but I'm not there yet. THe
> idea is based upon some poll ideas people including andreas and
> dancer have proposed over the last 12 months. The idea is that
> by splitting the fd sets up, you are not going to get as many
> non-ready filedescriptors, and so whilst you are handling requests
> the OS can populate other buffers.
>
> I will try profiling this code against the current squid code with
> a best-effort algorithm to get some hard figures. I've been
> watching CPU
> load on my machine and I've noticed a speedup, but no graphs to prove
> it.
>
> > With current code, I think something like this would do good:
>
> [snip]
>
> > Or maybe to have a simple design based on three priorities:
>
> [snip]
>
> Its a nice idea, but I'm going to be concentrating some more on
> other areas - I am hoping someone here can improve on the
> existing ideas with some code and / or give some benchmarks.
>
> This idea just has been bugging me for a while, so I thought I should
> get it over and done with. :)

Sure.
In the meanwhile, more on design :-)
Maybe some nice heuristics can be adapted from the "standard" Un*x
priority process-scheduler, while being careful not to do too much
fileset-shuffling :-)

I'm making this up as I write, but it could work - maybe: Let's have two
user-defined priorities, "Normal" and "Unimportant". These map unto three
system-known priorities "High", "Mid", "Low".
A Normal-prioritized FD can be either High or Mid priority. An Unimportant
fd can be either Mid or Low priority.
An FD changes priority if in the previous X (where X can be poll-run,
millisecond or something else) it had some data written to or read from.

High priority FDs should be checked often, mid-pri every N select cycles,
low priority FDs every once in a while or if there is pressure to free
FDs.

Ideas? Comments?

        /kinkie
Received on Mon Aug 07 2000 - 01:19:25 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:34 MST