Chuck Esterbrook wrote:
> At 01:07 PM 12/1/2000 +0000, Tom Schwaller wrote:
> >One small WebWare showstoper right now is the missing
> >User Authentification and Security stuff and a Database
> >layer (connection poling and things like that.
> >MYSQL as a start is ok..). Is the MiddleKit supposed to
> >do that? One could of course implement something simple,
> >but in the long run this is a waste of time, because it
> >belongs in the WebKit itself. This 2 pieces and I'm ready
> >to migrate part of out websites..
> MiddleKit maps object and relational data in a manner such that you
> primarily work with Python objects whose persistence in a SQL database is
> largely automated. It does not do anything with connection pooling at this
quite ambitious. Hope we have something to test soon :)
Connections between tables are quit difficult to
get right. I once saw the Open Source Tool POSSL
(http://www.possl.org) in action, where you visually
select the tables, make a selection of the fields per
drag and dropand the rest is for you. It even detects
the connnections between tables (if not, you can give hints).
> There is such a class floating around in the message archives.
I've found it, applied the 2 proposed patches and put it in
Webware/WebKit/Cans/DBPool.py (DBPool.py file is attached).
Then I teste it according to another posting (Examples/DB.py)
from ExamplePage import ExamplePage
self.writeln('<p>Welcome to the DBPooling example</p>')
pool = self.getCan('DBPoolCan', 'DBPool', 'application',
MySQLdb, 5, host='localhost', user='..',
db = pool.getConnection()
cursor = db.cursor()
cursor.execute("SELECT realname FROM users WHERE userid < 25")
for realname in cursor.fetchall():
self.writeln('%s<br>' % realname)
Works fine (my first Can based SQL example :-)).
But then I wanted it to know:
/usr/sbin/ab -n 1000 -c 2 http://localhost/wpy/Examples/DB.py
Requests per second: 48.28
WOW! Then I overloaded the site with
/usr/sbin/ab -n 1000 -c 10 http://localhost/wpy/Examples/DB.py
Requests per second: 31.40
WOW. Still very good compared to the same Zope example (I even
did a loop (for in in range(15)...) and still got amazing resultas
on my Dual Celeron, 256 MB RAM maschine). Unfortunately under
this heavy load I also got the following exception:
Traceback (innermost last):
File "Application.py", line 283, in dispatchRequest
File "Application.py", line 382, in handleGoodURL
File "Application.py", line 455, in respond
File "Transaction.py", line 93, in respond
File "HTTPServlet.py", line 38, in respond
File "Page.py", line 33, in respondToGet
File "Page.py", line 52, in _respond
File "Page.py", line 100, in writeHTML
File "SidebarPage.py", line 56, in writeBody
File "Examples/DB.py", line 10, in writeContent
db = pool.getConnection()
File "Cans/DBPool.py", line 53, in _threadsafe_getConnection
con = PooledConnection(self, self.connections[self.nextCon])
IndexError: list index out of range
There seems to be a problem in the proposed implementation.
I guess, it should allocate 5 connections and use them
as before, but under heavy load it should allocate 5 more
conections (and 5 more,...) when necessary. Anybody this kind
of improvements at hand? Generally
is a very ood Java-implementation (Open Source)
of a JDBC compliant connection pool (and even object pool ),
which could serve as code basis.
> Perhaps we need a component named DBKit or DBUtils that provides connection
> pooling and whatever other DB enhancements people need.
> Regarding security and authentication, I have been using Apache's .htaccess
> and htpasswd stuff. What kind of security and authentication enhancements
> do people want to see in Webware? e.g., what would these features be and
> how would they interact with WebKit?
Probably I think to much in term of Zope Object publishing here,
because you have accees to the methods and attributes there, but
I prefer my classes to know what a user can do and what not and
to instatiate the user data (e.g. from an SQL-DB) in memory
when the user logs in.
A general user/group permission framework (for people who want it)
seems natural. The Zope code is quite instructive here, but not
optional. WebWare could make that optional (some bases classes to use
or not to use ), which is much better, because in many cases you
do not need it in such a sophisticated way.
ah, I forgot: the more I play with WebWare, the more
I like it. Well done , guys :-)
P.S. Did anybody try to get WebWare running with Jython?