hi
i've have my first simple JDBC servlet working and it's ok but it won't
scale. i read about connection pooling and looked at the global broker
stuff, but i wondered if i could use a schema like this to make the whole
process more scalable. any comments gratefully received!!!!
1. Use a Connection Manager and event model
Seems to me that servlet incurs much of its overhead if it needs to make a
connection to its query target each time it is called. It is better to
create a single static Connection Manager object (created in the init()
method of the servlet when the web server's Servlet Manager starts up) which
establishes a pool of connections and allocates them on demand to worker
threads (see below) as "real" user requests come in. There are a number of
downloadable Connection managers classes which can be used for this purpose.
Here's a bit of a thinking-out-loud about how it would work.
The Connection manager's job is to maintain a free pool, keep track of
allocated conenctions, and maybe expand the pool if necessary using some
%age free algorithm, report errors in the connection layer etc. An
event-based model seems useful for connecting the Connection Manager (as a
server) to its worker threads (the clients). When the servlet's destroy()
method is called, a servletClosing event should be fired which will cause
the Connection Manager to repeatedly try to close its free connections, and
not respond to "connectionRequested" events. This will mean that existing
queries will be honoured, but no new ones can be created.
2. Use Java Threading and separate worker threads for processing queries.
The servlet class should maybe just create a new worker thread to handle
each request and then go back to listening for requests. The worker should
fire an "connectionRequested" event, which the ConnectionManager is
listening for. The Connection manager will reply with a Connection object
The worker will run the query, and fire a "connectionFree" event (which
causes the Connection manager to return the connection to the pool), deposit
the result set wrapped in (probably) HTML on a stack and fire a
readytoShipToClient event for which another thread is listening - this
thread can serve the results back to the client.
what do folk think? am i overthreading? :) obv. i want to get the design
right at the outset. btw, i'm running on Domino R5.
peter
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html