Hi all,

I’m just experimenting with WebKit and database connection pooling, and some questions/suggestions came up which I hope can be answered here:

As far as I understand I have to use either MiscUtils/DBPool.py which
is pretty simple, or (as I noticed just now by searching the archives)
a much more complex and sophisticated DbConnectionPool.py that has been
put into the sandbox by Warren A. Smith.

I haven’t checked out DbConnectionPool yet. Which status has it?
Warren, are you still working on it? Are you/somebody else interested
in improving/testing this module and getting it into Webware, e.g. MiscUtils? If yes, I’d like to contribute if I can.

For the time being I have only tested DBPool.py. Here are my questions/suggestions:

* The module docstring talks about “DB API”. I think this should
  be specified to “DB API 2”, since DB API version 1 has no
  threadsafety attribute and thus will not work with DBPool.

* There is an irritating comment that says:

  # These functions are used with DB modules
  # that have connection level threadsafety, like PostgreSQL:
  def _unthreadsafe_addConnection(self, con):
  ...

  - Shouldn’t it rather say “... that *DO NOT* have connection level
    threadsafety...”? (threadsafety 0 = not threadsafe,
      1 = module level, 2 = connection level, 3 = cursor level)
  - PostgreSQL is not a DB module, but a DBMS, so shouldn’t it say
    “like PyGreSQL” or something (another PostGreSQL interface,
    psycopg, has threadsafety=2)?

* Wouldn’t it be good to have minConnections and startConnections
  in addition to maxConnections? This would be analogous to the
  parameters in AppServer.config.

* If a database connection crashes or gets disconnected, it will
  never be restarted. Wouldn’t it be good to let the getConnection
  method check whether the connection is still usable and reopen
  or restart it in case it is not?

* My last important question: Maybe I understand something wrong,
  but if I use DBPool for WebKit servlets, i.e. with the
  ThreadedAppServer, wouldn’t it be much more reasonable to
  automatically bind the connections 1:1 to the servlet threads
  created by the AppServer, instead of making an independent
  database connection pool? So each thread would have it’s own
  private database connection, servlets could never block each
  other, there would be no threadsafety issues at all,
  and you wouldn’t need to configure any pool size,
  but there would be always just as many connections as stated
  in the AppServer.config. As far as I see it, this would have
  only advantages. Do I overlook anything?
  Could this be implemented with Webware/WebKit out of the box?
  If not, shouldn’t such a feature be added?

I’d be glad to read some answers/opinions.

-- Christoph


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to