Global Resources

What are Global Resources

Global Resources are external resources made accessible within from a script, which includes databases, mail servers, ftp servers, and etc.
Global Resources can be registered, modified, and deleted using Global Resource Settings in Control Panel or WebConsole.

Advantages of using Global Resources are the following:

Component Pool

May a global resource maintains database connections.Opening and maintaining connections for every request made are costly and wastes resources.A mechanism called component pool, which is used to enhance the performance of over all data processing, allows reuse of components maintained when future requests to the same data source are required.
Component Pool can be configured in Global Resource Settings and the following properties can be set to make sure the component pool works well according to the environment it is deployed to work in.

Enabling or disabling the use of component pool

When this property is set to true, the connection created is placed in the pool and it is used over again so that a new connection does not have to be established.
However there are times that connections need to be released right after being used.By disabling this property, connections are not going to be cached in the pool, but they are created every time there is a request to connect to data source,
in which case you may experience degraded overall performance.

The initial and the maximum size of a component pool

The initial size is the number of connections initially created and pooled when DataSpiderServer is started.
It is encouraged to set the initial size appropriately, if the operation performed is transaction-intense or if there is a measured average number of connections used.
Setting the initial value too large will affect the start up of DataSpiderServer and there will be connections that which will never going to be used.

The maximum size is the upper bound of the connections that can be placed in a pool simultaneously.
If all the connections are being used, a new connection is made and is added to the pool but the pool will never allow this value to be exceeded.It is therefore encouraged to it to an appropriate value, because having this value too small will cause
the connection exhaustion condition, which will affect the over all performance of the system and setting it too large may lead to memory depletion in the data source to which connections are made.The life time of a component maintained in a pool

The life time of a component maintained in a pool

The length of time that a connection may remain idle before being removed from a pool by Component Pool GC
Component Pool GC is a memory management feature that periodically checks connections placed in a pool and reclaims memory allocated to those fall under certain conditions.
The following diagram illustrates how a global resource is garbage collected.
The numbers in parentheses () correspond to the numbers used in the Component Pool GC diagram.
  1. A global resource is created at a point between (1) and (2).
    Countdown for the lifetime of the connection starts.
  2. The global resource is used between (2) and (3).
    The value of the lifetime is reset. Countdown for the lifetime starts again once the connection is returned to the pool.
  3. The lifetime is exceeded at a point between (4) and (5).
    The global resource is not yet removed from the pool.
  4. The global resource is removed at (5)
Component Pool GC diagram

Global resources garbage collected by the Component Pool GC can be confirmed in the Server Log if the log level is set below FINFO.

Reset Component Pool

You can reset component pools on the control panel.
When reset is performed, below will occur:

Destination Versions Each Global Resource Support

Each global resource only supports the versions displayed on [Resource type] or [Type].
If no destination versions are displayed on [Resource type], or [Type], please check the support versions in each adapter's "Operating Environment" pages.

If, for instance, the database versions of destinations are changed in database adapters, please be sure to change it to the global resource that supports the version.

Global Resource Name

In components that use global resources references them by their Global Resource Names.
Global Resource Name given to a data source when registering it to DataSpiderServer, it needs to be unique within the entire system.

Global Resource Name is mutable and there is a recommended approach when switching data sources used by a script.
  1. Replace the name of an existing global resource that is referenced in a script.
  2. Create a new global resource you want switch to in the same script and give it the exact name that just have been replaced to something else in the previous step.
This way, it is possible to switch to different global resources without modifying the script at all.

Of course, it is only possible if both data sources referenced in the script are identical in all aspects except for the connection settings.