On 2006-09-05 08:08:54 -0600, Darin McBride wrote: > On Monday 04 September 2006 22:28, Jack Faley ( The Tao of Jack ) wrote: > > Thank you for your reply. If their was any way to mitigate the small exits > > I would do it but I'm modifying an app that was never meant to be > > extensible. So, you are correct, Im moving the load to a daemon in the > > middle with a persistant connection rather than directly talking to DB2 :-) > > . I havent benchmarked it. Im no dba but I have a feeling this will > > actually be slower overall. > > I don't see it being a DBA question - it's a machine resource question. If > you have n apps connecting to DB2, you need n sockets. But if you have n > apps connecting to a proxy which itself connects to DB2, you have n+1 > sockets. >
If I understood the OP correctly, his DBA isn't concerned about
simultaneously open DB connections, but about many short-lived
connections. If you have a program (for example a CGI script), which
makes only a single query and then exits, for 1000 invokations of the
program you have
1000 x opening a DB connection, including authentication, creating initial
transaction, etc.
1000 x select
1000 x closing the DB connection.
If there is a middleware server which maintains a pool of DB
connections, that changes to:
n x opening a connection, including authentication, creating initial
transaction, etc.
1000 x opening a connection to the middleware server
1000 x select
1000 x closing the connection to the middleware server
n x closing the connection.
where n is the number of connections that need to be opened, which tends
toward 0 as the connection pool reaches a steady state.
Whether this actually reduces the load depends on the relative cost of
DB connection overhead, the query and the middleware server overhead.
For example, on one of our Oracle servers, a connect takes 27ms, a
"select sysdate from dual" 1.5ms, and a disconnect 0.8ms. I don't know
how much of these 27.8ms for connect/disconnect is actually time spent
by the server, but it is an upper bound on what we can save: So the
question is: Is saving *at most* 27.8ms per invocation of the the
program worth the complication? If your program is invoked a million
times per day, probably yes (even if its only 14ms and the middleware
server adds 5 ms of overhead, you still have saved 9000 seconds per day).
If it is invoked only 1000 times a day, probably not.
> Note also that in this scenario, all exits must use the same
> authentication - if you're trying to get some stuff done as sysadm, and other
> stuff done as someone unprivileged, you'll need a different proxy for each
> user.
The authentication to the proxy or middleware server can be a lot
simpler. For example, you can use a unix socket and set the permissions
so that only authorized users can open it.
hp
--
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | [EMAIL PROTECTED] | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users
pgpXh4vDqa1XK.pgp
Description: PGP signature
