Re: Process balancing on smp db server/apache web server

From: Gregory Seidman <gss+pg(at)cs(dot)brown(dot)edu>
To: Pgsql-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Process balancing on smp db server/apache web server
Date: 2002-05-23 14:58:55
Message-ID: 20020523105855.A10614@jamaica.cs.brown.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Darley sez:
} Friends,
} I have been thinking about my smp db server and how it interacts
} with my web server. I'm using mod_perl on Apache, which uses Apache::DBI
} to connect to the db server via a private network segment. It occurs to
} me that since the web server is connecting early (on startup), when there
} is probably no load on the db server, the cpu that each backend is
} assigned to will be largely random, or, if there is a large syslogd
} operation or something right at that time, it might even put the majority
} of backends on the same processor.
} When someone hits the web site it seems to me that there would be a
} greater than 50% chance that any two large queries from the web server
} would end up being run on the same processor. Similarly, if I start a
} large processing script that uses the db, since the web associated
} backends are already assigned to a processor, there's a good (~50%?)
} chance that any big queries that come in through the web will be on the
} loaded cpu.
} Does this make sense to anyone? If this is true, are there any
} suggestions about how I can keep my persistent connections from Apache,
} while getting the db server to balance the load more efficiently?

In general, user processes don't have the option of locking themselves to
one CPU or another. Just because a process was started on one CPU does not
mean it will always be executed on it. Certain parts of the OS may demand
that they are only executed on a particular CPU for synchronization
purposes, but user-level processes use synchronization methods which
interact through memory with the CPU-locked OS code.

The short answer is that the OS does load balancing dynamically, and this
has nothing to do with on which CPU a process was spawned.

} Thanks,
} Peter Darley
--Greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message postgres 2002-05-23 15:01:04 Re: Process balancing on smp db server/apache web server
Previous Message Tom Lane 2002-05-23 14:58:23 Re: problems with pg_dump... with postmaster really