FAQ: Should I store ActiveX Connector objects in the ASP session object?
Should I store ActiveX Connector objects in the ASP session object?
ESRI discourages the practice of storing ActiveX Connector objects in an ASP Session and Application objects because of the following two reasons:
The ActiveX Connector uses the single threaded apartment model
After being instantiated, single-apartment threaded objects must remain associated with a single worker thread. Usually ASP handles requests from a pool of threads using the first available thread. When storing ActiveX Connector objects in ASP variables the same thread that handled the previous request must be used. This means that the request will be delayed until that single thread is free even if there are many other threads free that could have completed the requested operation.
This will cause a significant performance hit.
The ActiveX Connector consumes excess memory
Developers storing the ActiveX Connector generally only need a very small subset of the information that the ActiveX Connector stores. The ActiveX Connector when stored in the session object takes megabytes when most users only want to store a few bytes of information, such as extent and layer list information. Lightly used or moderately used ASP sites that cache the ActiveX Connector Map object can see memory for only the Map objects that consume over a hundred megabytes of RAM.
Session usually exist for 20 minutes after the user has stopped using the site. ASP websites storing the ActiveX Connector in session variables consume more RAM than they need to while that site is accessed by many people for short periods of time.