On Dec 13, 2005, at 12:59 PM, Albert Vila wrote:
I thought the persistent connection was only one for all childs.
What happens then if I have 1000 childs each one with 1 db
connection? This means 1000 database connections. How do you setup
apache + mod_perl in this environment?
Albert
you want to set it up exactly like that - with 1000 db connections.
if you have 1 db connection that everyone shares, then your
connection ties up and each child has to wait for all the others to
finish. not good.
if you have 1000 children, i'd be amazed at your setup. maybe i'm
just too green at this, but i've never had enough resources to go
above 300 , even using a stripped down setup and preloading just
about everything into shared space.
anways:
mysql and postgres, by default, support ~250 concurrent connections
out of the config file just fine. you can tweak stuff in the
settings to get more. there's a maxclient setting (or something like
that).
if you wanted to do something with 1000 children and 100 db handles,
you could probably do some sort of pooling scheme with a singleton or
something where a child 'checks out' a db connection for a request,
then checks it back in after its done. i thought about that once.
it gave me a headache. i brought it up here and with friends and
everyone said "why?" - because you should be fine just adding more
sql clients.
if you're looking at 1000 children though, you would almost
definitely want to look into a clustered db setup - probably
something with reads from 2+ machines that are replicated from a
master that handles writes.
thats my .02ยข