Re: Linux max on shared buffers?

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Jan Wieck <JanWieck(at)Yahoo(dot)com>, GB Clark <postgres(at)vsservices(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, <glenebob(at)nwlink(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Linux max on shared buffers?
Date: 2002-07-28 09:51:14
Message-ID: Pine.NEB.4.44.0207281832200.527-100000@angelic.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 24 Jul 2002, Tom Lane wrote:

> Curt Sampson <cjs(at)cynic(dot)net> writes:
> > But this would only cost us more syscalls, which are relatively
> > inexpensive (compared to things like memory copies) anyway.
>
> Run that by me again?
>
> I'd take memcpy over a kernel call any day. If you want to assert
> that the latter is cheaper, you'd better supply some evidence.

So on my Athlon system:

ironic $ /usr/pkg/bin/lmbench/mhz
1533 MHz, 0.65 nanosec clock

ironic $ /usr/pkg/bin/lmbench/lat_syscall null
Simple syscall: 0.2026 microseconds

ironic $ /usr/pkg/bin/lmbench/bw_mem 32m bcopy
33.55 352.69

352.69 MB/sec works out to about 370 bytes per microsecond. Thus,
copying an 8K page should take a bit over 22 microseconds, enough
time for the overhead of 110 syscalls.

ironic $ /usr/pkg/bin/lmbench/bw_mem 64k bcopy
0.065536 2038.58

Even entirely in L1 cache, I still get only about 2138 bytes per
microsecond, thus taking almost 4 microseconds to copy a page, the same
as the overhead for 8 syscalls.

On older systems, such as a P5-133, a syscall was about 4 microseconds,
and bcopy was 42 MB/sec, or 44 bytes per microsecond. Thus a page copy
was 186 microseconds, enough time for the overhead of only 46 syscalls.
I expect that the long, long trend of CPU speed growing faster than
memory speed will continue, and memory copies will become ever more
expensive than more CPU-boun activity such as syscalls.

All this aside, remember that when you copy a block under the
current system, you're doing it with read() or write(), and thus
paying the syscall overhead anyway.

cjs
--
Curt Sampson <cjs(at)cynic(dot)net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcin 2002-07-28 12:17:34 Postgres and J2EE
Previous Message Bruce Momjian 2002-07-28 01:14:18 Re: O'Reilly Interview on PostgreSQL