How client variables are purged
Based on the time-out period of inactivity specified in the ColdFusion Administrator, ColdFusion removes client variables stored in either the registry or a data source. This TechNote will explain the purge process for client variables.
ColdFusion MX:
With ColdFusion MX and higher, the client variable purge process is incorporated into the ColdFusion Application service and does not rely on a separate service. In addition, the process runs once per hour, beginning one hour after the ColdFusion service is initially started. This frequency is hard coded in coldfusion.runtime.ClientScopeServiceImpl.java and cannot be modified.
Purging variables stored in the registry:
- Each expired CFID is purged individually
- A maximum of 5,000 entries per hourly run will be purged
- No log entries are entered
Purging variables stored in a data source:
- All expired entries will be purged per hourly run
- For every JDBC client datastore:
{ SELECT CGLOBAL.cfid FROM CGLOBAL WHERE CGLOBAL.lvisit < {current_time - timeout} for each row returned: { delete from CDATA where cfid = {cfid} } delete FROM CGLOBAL WHERE CGLOBAL.lvisit < {current_time - timeout} }
ColdFusion 5 and earlier:
In versions 5 and earlier, the client variable purge process is handled by the ColdFusion Executive service. When the Executive service is started, it waits a fixed 30 seconds and then purges expired client variables. It then sleeps for a fixed time, usually 24 hours, and repeats the process. The cycle time is therefore 24 hours plus the time required to delete the expired client variables.
To modify the frequency of the purge process, modify the following registry setting:
HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\ Server\PurgeInterval REG_SZ {time_in_milliseconds}
If this setting is less than 3600000, then a minimum sleep time of 3600000 will be used instead (3,600,000 milliseconds = 1 hour). If this registry key does not exist, the default value is 86400000 (86,400,000 milliseconds = 1 day).
Purging variables stored in the registry:
- Each expired CFID is purged individually
- Every CFID purged is logged in the executive.log file:
Purged client ID '{cfid}'; Last visited '{date}'
Purging variables stored in a data source:
- All expired CFIDs are purged with a single SQL statement each for CDATA and CGLOBAL
DELETE FROM CDATA WHERE CDATA.cfid in (SELECT CGLOBAL.cfid FROM CGLOBAL WHERE CGLOBAL.lvisit < {date} ) DELETE FROM CGLOBAL WHERE CGLOBAL.lvisit < {date}
- The pair of SQL statements is logged as a single entry in the executive.log file:
Purged client data from Data Source '{dsn}'; last visit older than '{date}'
Additional Information
Related TechNotes:
- ColdFusion 5: Hot fix for client variables not purging from data sources
- ColdFusion 5: Cannot change the purge interval for client variables stored in registry
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
