GAS Basics / Architecture of the Genero Application Server |
Requests for Web services are processed by the GWS proxy and are managed using the DVM pool. The examples will assist you in configuring the pool element of your Web service.
The main reason is due to the way the Dynamic Virtual Machines (DVM) is unable to support more than one application at a time, see Reliability inherent in the architecture. The GWS proxy needs to launch new DVM (fglrun process) for each request on the Web server. If traffic to a Web server was to become very high with, for example, hundreds of requests at any period, this could potentially result in slow response time or even overloading of the server.
To avoid unnecessary use of resources, therefore, and to respond as fast as possible to client requests, the GWS proxy manages DVM processes in a pool. From the pool it can release inactive DVMs or launch new ones when required; up to the maximum number of DVM processes specified for the application. These parameters are defined in the POOL element of the Application Server configuration file.
Assume the following values have been specified for a Web service application:
<POOL> <START>3</START> <MIN_AVAILABLE>2</MIN_AVAILABLE> <MAX_AVAILABLE>5</MAX_AVAILABLE> </POOL>
When the Genero Application Server first starts, the START element defines how many DVMs to start for a particular Web service. There is one GWSProxy in charge of the pool of DVMs for the Web service. For our example, this means that one GWSProxy will launch three DVMs.
While the START element defines the number of DVMs to start initially, DVMs that are not actively processing requests can be released based on GAS statistics. For example, the GWS proxy calculates the elapsed time since it received the last new incoming request. If this is three times greater than the average frequency of new requests it has been receiving, it stops one inactive DVM. See Releasing DVMs not Actively Processing Requests.
Continuing with our example, if all of the DVMs are not actively processing requests, then one DVM will eventually be released, bringing the total number of DVMs to the MIN_AVAILABLE amount of two.
As requests come in, the GWS proxy determines whether there is a need to start up new DVMs. For the number of pending requests in the queue, the GWS proxy computes the average request execution time against the time to start a DVM. If dispatching all pending requests over the active DVMs takes less time than starting a new DVM, no new DVM will be started. In other words, a new DVM will only be started if it will help to decrease the waiting time of all pending requests. At most, MAX_AVAILABLE DVMs can be started.
Continuing with our example, up to five DVMs can be launched to handle requests.
What happens when there are MAX_AVAILABLE DVMs actively processing requests, and a new request comes in? The new request is placed in a connection queue, waiting for a DVM to become available. The new requests could (in theory) be waiting indefinitely, except:
There is the option of a timeout in the Web server to handle infinite wait.
Any Web service client can define its own timeout limit. If a client is willing to wait indefinitely for a Web service response, it is permitted.
Continuing with our example, this means that if all five DVMs are actively processing requests, and a sixth requests comes in, that request is placed in the connection queue until a DVM is available to process the request, or a timeout is reached based on settings in either the Web server or the Web service client.