Pooled Threading Model
The Pooled Threading Model is the recommended ASTA Server Threading model as it makes the most efficient use of the most costly server side resource: providing a connection to the Database. Here is what happens when ASTA servers are run in Pooled Sessions threading mode.
1. When the server starts up a call is made to CreateSessionsForDBthreads where the AstaServerSocket.ThreadedDBSupplySession is called DatabaseSessions Number of times.
2. This populates the AstaServerSocket.SessionList with one or more DataModules that each remote client can use uniquely in a thread.
3. When a remote ASTA Client requires to do some database work on the server, a Session is "checked" out of the SessionList and reserved for that client to be used in a thread. This process ensures that the thread will only have access to thread safe Database Components.
4. The SessionList will expand on demand. If the server is started with 3 DatabaseSessions and there is enough Database activity so that a remote client cannot reserve a Session from the Session List another call to ThreadedDBSupplySession is made and the SessionList is incremented with the new Session.
5. The SessionList can be limited to MaximumSessions number of sessions in which case, if MaximumSessions is reached, any client request for a Database Session is queued up and when the next client finishes their database work the session is allocated to the first queued process.
One of the great benefits of the N Tier model is leveraging the fact that Users of Database Applications don't actually need an open Database Connection for their work. Much of their time is spent browsing or viewing data. The ASTA Pool Session Threading model, which is "stateless" recognizes this fact and makes the most efficient use of Database Connections allowing for 5, 10, 20 or more remote clients to share one Database Connection on the server. The number of sessions per client that an ASTA server can handle is dependent on the Database used, bandwidth, client application design and Delphi Database components used on the ASTA Server.
In normal Client Database applications, remote users will only use one Database Session at any given time. With ASTA, sophisticated Asyncronous Database applications can be developed which allow for remote users to have more than one Database Session and thread open on the server at any given time.