Re: async-calls squid3/src comm.cc,1.81.4.16,1.81.4.17

From: Alex Rousskov <rousskov@dont-contact.us>
Date: Mon, 07 Jan 2008 20:56:40 -0700

On Tue, 2008-01-08 at 10:43 +0900, Adrian Chadd wrote:

> Can you explain the SMP and the profiling advantages a bit better please?
>
> I hate having a nested mess of callbacks, but it at least lets me
> profile the callback chains a lot easier by grouping profiling info by
> specific call stacks (which profilers do natively.)
>
> The problem right now is that there's so many little functions in Squid which
> get profiled seperately and trying to extract any meaningful profiling info
> as to what is taking the time requires quite a bit of post-processing.
> I'd love to find some tools which made this easier under FreeBSD/Linux.

I think code clarity, robustness, and ease of debugging beats the ease
of profiling, but I will try to present the profiling advantages anyway.

With async calls, you can probably profile based on the kind of the call
(e.g., a comm I/O handler) and the kind of the job (e.g., client-side
state), all without adding profiling wrappers to each handler method.

Since the call interface is common among all callers and callees, I
suspect one can do nifty things to group or isolate logical code pieces
without much coding. It is like having profiling wrappers for every
handler without inserting profiling macros in every handler.

I do not know exactly how these things can be done with modern profiling
tools, but I would be surprised to learn it is not possible to take
advantage of a common calling interface.

> Finally, I can't see how async callbacks will make SMP much easier to implement.
> Could someone give me some insight into this?

The AsyncCall API can be used to call threads or processes without
changing the caller or the callee code. Selected AsyncJob kids could
become threads or even processes after their dependence on global
variables is reduced.

When design problems like reentrant comm calls are being exposed and
fixed now, we are making future SMP support easier. And those problems
are easier to fix now, when we do not have to worry about real threads
and processes.

HTH,

Alex.
Received on Mon Jan 07 2008 - 20:57:04 MST

This archive was generated by hypermail pre-2.1.9 : Wed Jan 30 2008 - 12:00:09 MST