Subject: Re: PostgreSQL
To: None <segv@netctl.net>
From: Neil Conway <neilc@samurai.com>
List: tech-perform
Date: 02/01/2006 20:55:12
On Thu, 2006-02-02 at 01:19 +0000, segv@netctl.net wrote:
> Threads can be created MUCH faster, they take up a lot less memory and they run
> in the same address space, which means access to shared data is easy and fast.

Threads start faster, but connection startup time should not be in the
critical path for most well-designed applications: use connection
pooling or persistent connections.

Threads use less memory, but with COW the difference isn't *that*
significant when dealing with hundreds of connections. By comparison,
Apache boxes with a few hundred httpd processes are commonplace...

Threads share the same address space, but this can actually be a
significant downside: if a thread dies, it can corrupt the entire
address space of the process. Explicit shared memory (e.g. SysV IPC)
means that a process can only corrupt the state of another process when
it is modifying shared data, which is significantly more rare. This
translates into a non-trivial improvement in reliability.

-Neil