]> err.no Git - varnish/log
varnish
18 years agoPiggy-back kevent changes on kevent wait call
phk [Mon, 11 Sep 2006 10:14:45 +0000 (10:14 +0000)]
Piggy-back kevent changes on kevent wait call

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@960 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAvoid a startup-race
phk [Mon, 11 Sep 2006 10:14:29 +0000 (10:14 +0000)]
Avoid a startup-race

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@959 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoCleaned up User-Agent and Referer. Both should now work correct. As far as I can...
andersb [Mon, 11 Sep 2006 09:35:43 +0000 (09:35 +0000)]
Cleaned up User-Agent and Referer. Both should now work correct. As far as I can see, I only have the timestamp left for a sane loggline.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@958 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoCheck for sendfile().
des [Mon, 11 Sep 2006 09:16:59 +0000 (09:16 +0000)]
Check for sendfile().

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@957 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoReduce syscall footprint of expiry and hangman
phk [Mon, 11 Sep 2006 09:14:29 +0000 (09:14 +0000)]
Reduce syscall footprint of expiry and hangman

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@956 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAvoid a clock_gettime() call
phk [Mon, 11 Sep 2006 09:05:39 +0000 (09:05 +0000)]
Avoid a clock_gettime() call

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@955 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agobraino in last commit.
phk [Mon, 11 Sep 2006 09:00:44 +0000 (09:00 +0000)]
braino in last commit.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@954 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSave more time() calls
phk [Mon, 11 Sep 2006 08:58:42 +0000 (08:58 +0000)]
Save more time() calls

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@953 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoA avoid a time(NULL) call
phk [Mon, 11 Sep 2006 08:53:53 +0000 (08:53 +0000)]
A avoid a time(NULL) call

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@952 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoDo stats on sendfile/write split.
phk [Mon, 11 Sep 2006 08:42:35 +0000 (08:42 +0000)]
Do stats on sendfile/write split.

Add param for minimum size of object before we will sendfile it.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@951 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoStarted to fix output of User-Agent. It was all over the place. Found what I was...
andersb [Sun, 10 Sep 2006 22:23:59 +0000 (22:23 +0000)]
Started to fix output of User-Agent. It was all over the place. Found what I was doing wrong and fixed it.

Should work with correct User-Agent now.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@950 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMake the fetchers chunksize a parameter, but keep the default at 128k
phk [Fri, 8 Sep 2006 06:47:55 +0000 (06:47 +0000)]
Make the fetchers chunksize a parameter, but keep the default at 128k

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@949 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd an extra bucket and make it clear how the number was chosen.
phk [Fri, 8 Sep 2006 05:58:33 +0000 (05:58 +0000)]
Add an extra bucket and make it clear how the number was chosen.

Remove extra sanitychecking.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@948 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMissing commit message from previous commit:
phk [Thu, 7 Sep 2006 10:14:43 +0000 (10:14 +0000)]
Missing commit message from previous commit:

Fix a logic bug which allowed storage objects to be trampled on:
the last bucket may contain object smaller than we want.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@947 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoHandle zero length storage objects correctly: Don't let them exist.
phk [Thu, 7 Sep 2006 10:12:54 +0000 (10:12 +0000)]
Handle zero length storage objects correctly:  Don't let them exist.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@946 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoInsert a bunch of asserts to try to catch anything going wrong
phk [Thu, 7 Sep 2006 08:25:05 +0000 (08:25 +0000)]
Insert a bunch of asserts to try to catch anything going wrong

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@945 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoPick up uint32_t from <stdint.h> instead of <sys/types.h>
phk [Thu, 7 Sep 2006 08:01:14 +0000 (08:01 +0000)]
Pick up uint32_t from <stdint.h> instead of <sys/types.h>

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@944 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoLogging for status & response was swapped for generated errors.
phk [Thu, 7 Sep 2006 07:50:48 +0000 (07:50 +0000)]
Logging for status & response was swapped for generated errors.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@943 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRemove debugging messages.
phk [Thu, 7 Sep 2006 07:33:23 +0000 (07:33 +0000)]
Remove debugging messages.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@942 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd stats counters for large and small free fragments.
phk [Thu, 7 Sep 2006 07:27:21 +0000 (07:27 +0000)]
Add stats counters for large and small free fragments.

Remove debugging

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@941 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoremove "age", it was effectively unused. Revisit the idea later.
phk [Thu, 7 Sep 2006 07:17:31 +0000 (07:17 +0000)]
remove "age", it was effectively unused.  Revisit the idea later.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@940 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoDon't clear alloc, it will be done in due time.
phk [Thu, 7 Sep 2006 07:12:18 +0000 (07:12 +0000)]
Don't clear alloc, it will be done in due time.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@939 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSplit the freelist by size.
phk [Thu, 7 Sep 2006 07:09:37 +0000 (07:09 +0000)]
Split the freelist by size.

Use 32 buckets for now, with a 4k pagesize that takes us to 128k
which matches the fetchers default chunksize.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@938 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRemove debug entry
phk [Thu, 7 Sep 2006 05:41:13 +0000 (05:41 +0000)]
Remove debug entry

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@937 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRead more than one session pointer at a time from the pipe and
phk [Thu, 7 Sep 2006 05:40:09 +0000 (05:40 +0000)]
Read more than one session pointer at a time from the pipe and
handle them all with one kevent call.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@936 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoDon't use binary address anyway, we only want the IP number part
phk [Wed, 6 Sep 2006 22:09:32 +0000 (22:09 +0000)]
Don't use binary address anyway, we only want the IP number part
and splitting that out of the binary part is not worth the
trouble.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@935 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAccount for header bytes in error and 304 responses.
phk [Wed, 6 Sep 2006 22:02:07 +0000 (22:02 +0000)]
Account for header bytes in error and 304 responses.

Remove unhelpful debug entry.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@934 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMove some setup code to first state now that we have it.
phk [Wed, 6 Sep 2006 21:52:50 +0000 (21:52 +0000)]
Move some setup code to first state now that we have it.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@933 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMove a bunch of work from the acceptor thread to the worker thread
phk [Wed, 6 Sep 2006 21:41:13 +0000 (21:41 +0000)]
Move a bunch of work from the acceptor thread to the worker thread
for better scaling.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@932 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMove CRC32 into libvarnish
phk [Wed, 6 Sep 2006 21:15:26 +0000 (21:15 +0000)]
Move CRC32 into libvarnish

Use it for hashing srcaddr as well.  Hash the sockaddr instead
of the ascii representation.

Add a primitive mutex tracking facility which writes debug
records to the shmlog if enabled.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@931 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGive the stats summation its own mutex
phk [Wed, 6 Sep 2006 20:45:49 +0000 (20:45 +0000)]
Give the stats summation its own mutex

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@930 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoReduce traffic on the wrk_mtx, saving some syscalls along the way:
phk [Wed, 6 Sep 2006 19:35:33 +0000 (19:35 +0000)]
Reduce traffic on the wrk_mtx, saving some syscalls along the way:

Make a thread-reaper-thread which examines the tail end of the queue
and kicks threads which are too old so the wake up and die.

This allows us to assume that a thread on the free queue is always
waiting on its condvar, so we don't need to hold the mutex when we
signal the condvar.

As a result, the woken thread stands a chance to grab the mutex
and a little song and dance between the two threads is avoided.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@929 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGrab the r_recv timestamp at the right time.
phk [Wed, 6 Sep 2006 19:08:06 +0000 (19:08 +0000)]
Grab the r_recv timestamp at the right time.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@928 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoDon't bother with SO_NOSIGPIPE, it doesn't always work and we
phk [Wed, 6 Sep 2006 18:47:06 +0000 (18:47 +0000)]
Don't bother with SO_NOSIGPIPE, it doesn't always work and we
have ignored the signal anyway.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@927 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRemove unused timestamp "t0" and save a syscall per request.
phk [Wed, 6 Sep 2006 18:46:26 +0000 (18:46 +0000)]
Remove unused timestamp "t0" and save a syscall per request.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@926 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSave a systemcall by using the same timestamp twice.
phk [Wed, 6 Sep 2006 18:37:17 +0000 (18:37 +0000)]
Save a systemcall by using the same timestamp twice.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@925 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGive pool threads 120 second timeout, 10 was close to silly.
phk [Wed, 6 Sep 2006 18:32:05 +0000 (18:32 +0000)]
Give pool threads 120 second timeout, 10 was close to silly.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@924 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFix the poll acceptor, we need to cache the fd as sp->fd might
phk [Wed, 6 Sep 2006 18:23:24 +0000 (18:23 +0000)]
Fix the poll acceptor, we need to cache the fd as sp->fd might
change to -1 under us.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@923 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFix buglet in -i/-x name matching
phk [Wed, 6 Sep 2006 11:21:40 +0000 (11:21 +0000)]
Fix buglet in -i/-x name matching

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@922 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAllow '-' in identifiers.
phk [Wed, 6 Sep 2006 10:45:55 +0000 (10:45 +0000)]
Allow '-' in identifiers.

For further study: should we accept RFC2616's definition of "token" ?

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@921 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMark responses with Set-Cookie as "pass"
phk [Wed, 6 Sep 2006 09:58:24 +0000 (09:58 +0000)]
Mark responses with Set-Cookie as "pass"

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@920 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd support for inspecting response headers.
phk [Wed, 6 Sep 2006 09:54:49 +0000 (09:54 +0000)]
Add support for inspecting response headers.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@919 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFix the same issue as in the kqueue acceptor: By the time we get
phk [Wed, 6 Sep 2006 09:18:06 +0000 (09:18 +0000)]
Fix the same issue as in the kqueue acceptor:  By the time we get
here the filedescriptor may already be closed, so accept EBADF.

Reported by: Xing Li <xing@litespeedtech.com>

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@918 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFix a bug in chunked fetching:
phk [Wed, 6 Sep 2006 07:37:34 +0000 (07:37 +0000)]
Fix a bug in chunked fetching:

With very short chunks, in this case 3 characters, our buffer may
contain not only the chunk length and the chunk data, but also the
next chunk length.

If the short chunk is the last chunk before the zero length chunk
at the end, unconditionally trying to fill the buffer before parsing
the length may hang because we already have everything there is to
have in the buffer.

The fix is to always try to parse the buffer before adding to it.

While here, tighten up and improve error checks of the code.

Reported by: Xing Li <xing@litespeedtech.com>

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@917 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoescape control characters in SLT_Debug as %XX
phk [Wed, 6 Sep 2006 06:39:52 +0000 (06:39 +0000)]
escape control characters in SLT_Debug as %XX

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@916 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdded more outputdata, fixed memory leaks (I think).
andersb [Tue, 5 Sep 2006 22:11:05 +0000 (22:11 +0000)]
Added more outputdata, fixed memory leaks (I think).

Code still not Alpha ready, but I think most concepts work now.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@915 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGo through all asserts and mark those which indicate missing code with
phk [Thu, 24 Aug 2006 07:57:07 +0000 (07:57 +0000)]
Go through all asserts and mark those which indicate missing code with
xxx or XXX.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@914 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoIntroduce LOCK() and UNLOCK() macros which does the right thing
phk [Thu, 24 Aug 2006 07:17:35 +0000 (07:17 +0000)]
Introduce LOCK() and UNLOCK() macros which does the right thing
with pthread_mutex_{lock,unlock}()

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@913 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGive xxxasserts their own backend with a different message.
phk [Thu, 24 Aug 2006 07:10:35 +0000 (07:10 +0000)]
Give xxxasserts their own backend with a different message.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@912 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSplit assert into "static check" and "missing code" variants.
phk [Thu, 24 Aug 2006 06:58:37 +0000 (06:58 +0000)]
Split assert into "static check" and "missing code" variants.

The "missing code" variants have xxx prefix

Introduce AN() (assert non-null) variant as well.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@911 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoThis is a workaround for what is probably a race in FreeBSD RELENG_6
phk [Thu, 24 Aug 2006 06:15:13 +0000 (06:15 +0000)]
This is a workaround for what is probably a race in FreeBSD RELENG_6
socket dismantling.

There is no way that close(2) should ever be able to return EINVAL,
but we've seen it.

Specifically assert on EBADF which is the check we're really after.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@910 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoHandle backend failure in pass mode
phk [Wed, 23 Aug 2006 14:30:06 +0000 (14:30 +0000)]
Handle backend failure in pass mode

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@909 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoThese are not used.
phk [Wed, 23 Aug 2006 13:11:14 +0000 (13:11 +0000)]
These are not used.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@908 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agodon't service cached objects the last second of their lifetime.
phk [Wed, 23 Aug 2006 12:10:11 +0000 (12:10 +0000)]
don't service cached objects the last second of their lifetime.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@907 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSet response timestamp when we emit an error.
phk [Wed, 23 Aug 2006 11:42:16 +0000 (11:42 +0000)]
Set response timestamp when we emit an error.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@906 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoImplement error in miss also
phk [Wed, 23 Aug 2006 11:27:54 +0000 (11:27 +0000)]
Implement error in miss also

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@905 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agounused variable.
phk [Wed, 23 Aug 2006 07:32:19 +0000 (07:32 +0000)]
unused variable.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@904 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoHandle backend connection error in pass mode with a 503
phk [Wed, 23 Aug 2006 07:30:42 +0000 (07:30 +0000)]
Handle backend connection error in pass mode with a 503

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@903 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFill shmem log with the reply
phk [Wed, 23 Aug 2006 07:29:28 +0000 (07:29 +0000)]
Fill shmem log with the reply

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@902 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agogrammar police.
phk [Wed, 23 Aug 2006 07:22:28 +0000 (07:22 +0000)]
grammar police.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@901 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoTeach RES_Error() about the canonical response code texts from
phk [Wed, 23 Aug 2006 07:16:03 +0000 (07:16 +0000)]
Teach RES_Error() about the canonical response code texts from
RFC2616.

Add the XID as "guru meditation" in the error HTML.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@900 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMove defaults from varnishd.c to mgt_param.c and use regular functions
phk [Wed, 23 Aug 2006 06:55:18 +0000 (06:55 +0000)]
Move defaults from varnishd.c to mgt_param.c and use regular functions
for setting them.

Collapse all the 'timeout' functions.

Add pipe_timeout parameter.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@899 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoIf CLI is NULL, use stdout.
phk [Wed, 23 Aug 2006 06:53:28 +0000 (06:53 +0000)]
If CLI is NULL, use stdout.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@898 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoImplement "error" in vcl_hit()
phk [Tue, 22 Aug 2006 19:14:01 +0000 (19:14 +0000)]
Implement "error" in vcl_hit()

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@897 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRedraw must be checked when we update, we cannot trust
phk [Tue, 22 Aug 2006 10:56:06 +0000 (10:56 +0000)]
Redraw must be checked when we update, we cannot trust
that we will actually have a timeout.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@896 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoOptimize shmlog writing:
phk [Tue, 22 Aug 2006 10:46:16 +0000 (10:46 +0000)]
Optimize shmlog writing:

If we know the record length, only hold the mutex while we reserve
the space.  Until we change the first byte, nothing bad can happen.

XXX: a memory barrier is strictly speaking necessary before we assign
the first byte.

If there are no '%' in the format string, treat as fixed length for
speed.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@895 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoConsistent naming of mutex
phk [Tue, 22 Aug 2006 10:40:55 +0000 (10:40 +0000)]
Consistent naming of mutex

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@894 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAllow the delay between screen updates to be specified with -w.
des [Tue, 22 Aug 2006 10:14:39 +0000 (10:14 +0000)]
Allow the delay between screen updates to be specified with -w.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@893 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoCorrect the error check for write().
des [Tue, 22 Aug 2006 09:37:58 +0000 (09:37 +0000)]
Correct the error check for write().

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@892 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSlight optimization: use strlcpy() to avoid calloc().
des [Tue, 22 Aug 2006 09:31:34 +0000 (09:31 +0000)]
Slight optimization: use strlcpy() to avoid calloc().

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@891 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSwap the '|' and '#' symbols so '#' means "miss", that's much more
phk [Tue, 22 Aug 2006 09:30:23 +0000 (09:30 +0000)]
Swap the '|' and '#' symbols so '#' means "miss", that's much more
graphically useful.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@890 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoUse different marks for hit & miss
phk [Tue, 22 Aug 2006 09:16:33 +0000 (09:16 +0000)]
Use different marks for hit & miss

Autoscale vertical axis.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@889 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoEliminate the MD5 optional code. There is no sufficiently strong
phk [Tue, 22 Aug 2006 08:55:15 +0000 (08:55 +0000)]
Eliminate the MD5 optional code.  There is no sufficiently strong
statistical basis for using MD5 that will outweigh the performance
penalty or "IT USES THE BR0K3N MD5 ALGORITM" cries on slashdot.

The only known artifact in CRC32 is that hashing it with a power
of two is slightly inefficient (a few percent in bucket length
standard deviation) if you have URLs with fixed width fields of
a limited charset (such as numeric) fields in them.

Avoid this by checking the hash width specified for power of two,
and reduce it by one telling the user why.

Using a hash width that is a prime number does provable advantage
over just not using power-of-two width.  I have heard a mathematician
say that this is inherent in the design of the polynomia chosen
for CRC algorithms error (optimized for bit error detection) but
the actual math is way beyond me.

Increase default hash width to 16383, which is probably still
smaller than it should be.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@888 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoExpand keywords.
des [Tue, 22 Aug 2006 08:18:15 +0000 (08:18 +0000)]
Expand keywords.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@887 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAllow an empty address if a port is specified; thus ":80" is a valid
des [Tue, 22 Aug 2006 08:17:54 +0000 (08:17 +0000)]
Allow an empty address if a port is specified; thus ":80" is a valid
listening address ("port 80 on all interfaces")

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@886 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdditional marginal improvement:
phk [Tue, 22 Aug 2006 08:06:46 +0000 (08:06 +0000)]
Additional marginal improvement:

Sort on length of key, then on digest.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@885 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRework the classic hasher to reduce lock contention and CPU usage.
phk [Tue, 22 Aug 2006 07:52:33 +0000 (07:52 +0000)]
Rework the classic hasher to reduce lock contention and CPU usage.

Make nbuckets=nhash mandatory.

Order hash lists by the length of key instead of the key contents,
comparing the length is much faster.

Also compare disgest before we take the expensive content compare.

Use memcmp() for content compare instead of strcmp().

Use a two-pass algorithm for inserts to lower mutex contention.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@884 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd cache_acceptor.h to noinst_HEADERS.
des [Tue, 22 Aug 2006 07:24:07 +0000 (07:24 +0000)]
Add cache_acceptor.h to noinst_HEADERS.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@883 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd strndup() to libcompat.
des [Tue, 22 Aug 2006 07:11:59 +0000 (07:11 +0000)]
Add strndup() to libcompat.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@882 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFlexelint inpired cleanups
phk [Mon, 21 Aug 2006 20:42:47 +0000 (20:42 +0000)]
Flexelint inpired cleanups

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@881 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoGive VBE_ClosedFd() an argument to tell if the fd has already
phk [Mon, 21 Aug 2006 20:30:29 +0000 (20:30 +0000)]
Give VBE_ClosedFd() an argument to tell if the fd has already
been closed.

Pipe does this and would panic otherwise.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@880 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoFix these two up to current standard.
phk [Mon, 21 Aug 2006 20:25:28 +0000 (20:25 +0000)]
Fix these two up to current standard.

Poll is tested, epoll isn't.

While the three implementations share a lot of identical code
right now, I will wait a bit before unifying more of them, at
least until performance proves that this is the right way for
kqueue.

XXX: they're really not acceptors any more, they're herders.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@879 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoMake it easier to experiement with acceptors by having a single
phk [Mon, 21 Aug 2006 20:23:47 +0000 (20:23 +0000)]
Make it easier to experiement with acceptors by having a single
pointer to the one in use.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@878 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRemove unused #includes
phk [Mon, 21 Aug 2006 20:23:14 +0000 (20:23 +0000)]
Remove unused #includes

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@877 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd asserts.
phk [Mon, 21 Aug 2006 19:05:57 +0000 (19:05 +0000)]
Add asserts.

Return if we pass on directly.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@876 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoOverhaul kqueue acceptor in light of todays learnings.
phk [Mon, 21 Aug 2006 18:55:24 +0000 (18:55 +0000)]
Overhaul kqueue acceptor in light of todays learnings.

Use the pipe trick to inject sessions into the system, as far as I
can tell it is cheaper because of the low rate it happens and the
high rate of mutex operations avoided.

Ignore the timer event, but purge the list every time we wake up
to reduce lumpyness of timeout'ing.

Centralize the polling of a session so we don't have the same two
messages spread out all over the place.

Centralize the acceptor thread and send things directly to the worker
thread, leaving only the session-herder in the split out files.

poll & epoll not yet updated accordingly.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@875 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoBandaid until Dag Erling does what's necessary
phk [Mon, 21 Aug 2006 17:49:39 +0000 (17:49 +0000)]
Bandaid until Dag Erling does what's necessary

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@874 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRetire sessions if the workspace size changes, properly cache the
phk [Mon, 21 Aug 2006 17:32:41 +0000 (17:32 +0000)]
Retire sessions if the workspace size changes, properly cache the
workspace size so we do not get caught unaware when it changes.

Implement flip-flop free queue where SES_New() can read from
one of them without a lock, which frees happen to the other one
under lock.  If the lock-less queue is empty, SES_New() flips
the two queues under lock and tries again.  If that queue is
also empty call malloc(3).

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@873 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoRename open_tcp() to TCP_open() and modify it to open only one socket of
des [Mon, 21 Aug 2006 17:26:11 +0000 (17:26 +0000)]
Rename open_tcp() to TCP_open() and modify it to open only one socket of
the appropriate type for the address that was passed in.

Introduce TCP_parse(), which extracts an address and port from a string of
the form "hostname:port", "i.p.v.4:port" or "[i:p:v:6]:port" (where "port"
can be either a decimal number or a service name).

Use TCP_parse() to parse the argument to -a (listen address), -b (backend
address) and -T (telnet address).  Eliminate -p (listen port).

While there, rename a bunch of "fooflag" variables which aren't flags to
"foo_arg".

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@872 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd n_sess_mem
phk [Mon, 21 Aug 2006 13:15:40 +0000 (13:15 +0000)]
Add n_sess_mem

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@871 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoIncrease client hash to 1k
phk [Mon, 21 Aug 2006 13:15:02 +0000 (13:15 +0000)]
Increase client hash to 1k

Cache used sessmem chunks on a private list and recycle from there,
no point in bothering malloc all the time.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@870 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoWhen writing to a file, open it with O_APPEND rather than O_TRUNC.
des [Mon, 21 Aug 2006 12:57:32 +0000 (12:57 +0000)]
When writing to a file, open it with O_APPEND rather than O_TRUNC.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@869 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSet properties.
des [Mon, 21 Aug 2006 12:55:56 +0000 (12:55 +0000)]
Set properties.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@868 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSet properties.
des [Mon, 21 Aug 2006 12:54:53 +0000 (12:54 +0000)]
Set properties.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@867 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoCreate the possiblity for the the acceptor to send the session directly
phk [Mon, 21 Aug 2006 12:12:16 +0000 (12:12 +0000)]
Create the possiblity for the the acceptor to send the session directly
to the workerpool instead of taking the detour around the session-herder.

This saves a context switch and is presumabley a good idea because the
majority of sessions will have requst already in the pipeline.

For accept filters it makes even more sense because we know this to
be the case.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@866 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoSplit the accepting and session-herding functionality into two threads,
phk [Mon, 21 Aug 2006 11:18:26 +0000 (11:18 +0000)]
Split the accepting and session-herding functionality into two threads,
this is totally free from a locking point of view, but will cost
in context switches.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@865 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdd file
phk [Mon, 21 Aug 2006 11:11:02 +0000 (11:11 +0000)]
Add file

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@864 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agovarious cleanups.
phk [Mon, 21 Aug 2006 11:05:08 +0000 (11:05 +0000)]
various cleanups.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@863 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoBreak the acceptors out into their own files.
phk [Mon, 21 Aug 2006 10:59:00 +0000 (10:59 +0000)]
Break the acceptors out into their own files.

The intent here is to compile in all acceptors supported on the
operating system and allow the user to select one at startup time.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@862 d4fa192b-c00b-0410-8231-f00ffab90ce4

18 years agoAdjusments to scale.
phk [Mon, 21 Aug 2006 09:51:23 +0000 (09:51 +0000)]
Adjusments to scale.

Refresh 1/sec max

Put more in the rolling buffer.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@861 d4fa192b-c00b-0410-8231-f00ffab90ce4