Re: [squid-users] Processing of squid?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 7 Nov 2003 19:39:53 +0100 (CET)

On Sat, 8 Nov 2003, Kusuma Samorthong wrote:

> I want to know that is it really processing of squid according?

It is one way of describing the basic operations of Squid, but there are
many different aspects depending on what you are looking at.

The processing of Squid is best described as a large set of state
machines, all driven forward by the central select loop monitoring
filedescriptor activity or timer events.

At some points in the code new state machines are being born in response
to different events. httpAccept() is one such place, DNS lookups another.

It is almost impossible to correcly draw one diagram showing all these and
their interactions, but it is possible to describe the general flow of
a single request. The following is based on the Squid-2.5 code base:

  * httpAccept() accepts a new client connection
  * clientReadRequests() reads and parses a request
  * clientAccessCheck() verifies the http_access rules
  * redirectStart() calls the redirector helper (if any)
  * clientCheckNoCache() verifies the no_cache rules
  * clientProcessRequest() starts processing the request

from here it depends on if the request was a cache miss/hit/expired
object. I'll focus on the miss case.

  * clientProcessMiss() starts retreiving of the cache miss and also
starts reading of the reply (done within the clientCreateStoreEntry()
call)
  * fwdStart() prepares for selection of forwarding path
  * peerSelect() selects the possible paths where to forward the request
  * fwdConnectStart() connects via the selected path
  * fwdDispatch() initiates forwarding of the request via the server
connection

and from here it depends on the type of path selected and protocol
requested.

the rest can be found relatively easily in the code, and the programmers
guide also gives valuable information.

Regards
Henrik
Received on Fri Nov 07 2003 - 11:39:58 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:21:11 MST