Pooling objects with server objects


If your Web application or Web service does not make use of a MapServer, GeocodeServer, GeodataServer, or GlobeServer object for its functionality, you can use empty server contexts for the application or Web service perform its geographic information system (GIS) work. Empty server contexts are non-pooled, so all objects you need to use must be created each time you get an empty context using the CreateObject method.
In some cases, the creation of an object may be expensive. A good example of this is a connection to a geodatabase workspace. Making a geodatabase workspace connection involves connecting to a database management system (DBMS) and querying various tables in the database. If each invocation of a Web service started with connecting to a geodatabase workspace, that introduces the fixed cost of making the connection. Additionally, this puts a load on, and can impact the scalability of, the database server.
Ideally, your Web service should make use of a pooled workspace connection, such that a small number of connections are made to the database once and shared across invocations of the Web service. One method of doing this is to use a pooled GeodataServer that is configured to connect to the workspace to which your Web service needs to connect. When the instances of the GeodataServer are created to populate the object pool, each will make and hold on to a connection to the workspace. Your Web service can get a reference to one of the pooled instances of the GeodataServer and get the workspace from the server object. Once the Web service finishes executing and releases the GeodataServer, it and its database connection return to the pool for use by another invocation of the Web service.


See Also:

ArcGIS Server application performance tuning
Limiting query results and output
Monitoring performance