Papadopoulos,
Papadopoulos Georgios wrote:
Hi Christian,
Our DB already has more than 100 connections from various other systems.
Each connection takes about 5MB of memory. Since only 5 children are
taking the heavy load, the rest 23 connections are mostly idle. And
since we plan to have a second machine running Openser as a failover,
there will be another 28 iddle connections.
that's one disadvantage of using a heavy-weight DB like Oracle ;-)
A single connection pool that would serve all children would be able to
create connections on demand. At peak traffic it would be possible that
the pool has as many connections as the number of children. But that
would be rare (at least in our case). Basically, the amount of traffic
would determine the amount of connections.
DB connections on demand create quite a big query overhead, often a new
connection not only includes TCP handshake but also authentication. This
could be implemented without a shared connection pool though. Setting a
connection timeout on the DB server should disconnect idle DB
connections. And at least with MySQL, openser reconnects after a server
disconnect.
What if each module opened the connection to the DB in mod_init()
instead of child_init()? What implications could that have?
Implementing a shared DB connection pool would involve issues like
concurrent access, blocking, and a scheduler keeping track of idle and
busy connections. It's surely a lot easier to let the DB server figure
out concurrent access situations.
Christian
Best regards
George
Papadopoulos Georgios wrote:
...
Another issue that came up is the number of
connections
from Openser to
the database. In our case, listening to five
interfaces, with tcp
disabled and children=5, we get 28 connections to DB which
is a great
waste of resources. From those five interfaces,
one is
receiving the
bulk of traffic and the rest receive minimal
traffic. Since
each child
has its own connection, then what is the purpose
of
connection pooling?
How difficult would it be to have a common
connection pool
for all children?
I don't think that having 28 DB connections is a waste of
resources, in
fact I think you will get better DB query performance using one DB
connection per openser worker process than using a DB
connection pool.
Most databases including Oracle DB are optimized for
concurrent access
using either a process or a thread pool, so why not take advantage of
that. And most DBs can easily handle at least 100 concurrent
DB connections.
Christian
Disclaimer
The information in this e-mail and any attachments is confidential. It is intended solely
for the attention and use of the named addressee(s). If you are not the intended
recipient, or person responsible for delivering this information to the intended
recipient, please notify the sender immediately. Unless you are the intended recipient or
his/her representative you are not authorized to, and must not, read, copy, distribute,
use or retain this message or any part of it. E-mail transmission cannot be guaranteed to
be secure or error-free as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.