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:
Separation of concerns
In a script which defines a business logic, Global Resources are referenced by their user specified identifiers.Any network related information such as host name and IP address for each global resource are configured separately in Global Resource Settings and they are hidden from the script.
By having the network details configured separately, it will require only minimum modification to the script when there are changes in the host names
and the IP addresses specified for the Global Resources referenced.
Resource connection management at one place
Resource settings shall not be modifiable by every one who can access in that user can only edit or delete the settings of his own resources and only system's administrator is privileged to take full control of all of the Global Resources registered to the system.The settings for the Global Resources are aggregated in one place where they are manageable uniformly by an interface provided.
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.
The initial and the maximum size of a component pool.
The life time of a component maintained in a 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 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 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.
A global resource is created at a point between (1) and (2).
Countdown for the lifetime of the connection starts.
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.
The lifetime is exceeded at a point between (4) and (5).
The global resource is not yet removed from the pool.
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.
You can reset component pools on the control panel.
When reset is performed, below will occur:
Unused data resource components are destroyed. If they are in use, they will be destroyed after the script execution.
Data resource components for the first connections are created.
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.
Replace the name of an existing global resource that is referenced in a script.
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.