Quantcast
Channel: The SharePoint Farm
Viewing all articles
Browse latest Browse all 184

What is the SharePoint Configuration Cache?

0
0
SharePoint has what is known as the Configuration Cache. Sometimes we get recommendations to clear it, especially when timer jobs don’t appear to be operating properly. But what exactly is the Configuration Cache and how does it function? The Configuration Cache exists on each SharePoint server joined to the farm, regardless of role. The cache is sorted at C:\ProgramData\Microsoft\SharePoint\Config\<GUID>\ and consists of often thousands of XML files and a single cache.ini file. The XML files are simply farm objects from the SharePoint Configuration database within the Objects table. For example, take this file, 7fb0b296-fae7-45bd-88fc-9a4a4e69b484.xml. If we look at the internals of the file, it is simply an object! In this particular case, it is the User Profile Import Job. [crayon-5304ab2882869771476296/] The XML file name matches the ID column in the Objects table, as well as the Persisted Object ID. From clearing the Configuration Cache, we know that cache.ini is involved in this process. It must exist, and it must have a numeral value contained within it (1 or higher). The cache.ini file closely mirrors the number contained within the Configuration database’s LastUpdate table. This table contains two columns, a Value column and a Version column. The Version column increments on a regular basis, and the cache.ini updates from the Version value. To accomplish this, there is a local Timer Job on each server with the internal name of “job-config-refresh”. This timer job runs on a 15 second interval. The timer job itself validates that the cache.ini has not been invalidated, then runs the stored procedure within the Configuration database, proc_getNewObjects. If the value in the cache.ini file is less than the value contained in the LastUpdate table, a SELECT statement is run against the Objects table where the value within the LastUpdate table is less than the value of the Version column in the Objects table; it also tombstones objects in the Tombstone table. From there, the timer job compares the objects on the file system in the Config folder with the newest returned versions of the objects. Expired objects (files) are deleted, and new or updated objects (files) are written to the Config folder. Now, as for how the value of the Version column is updated in the LastUpdate table? Within the Objects table there is also a column named Version. This is a timestamp column, which means the value is unique within the database (and doesn’t actually have anything to do with a date or time, it is just an incremental binary number). This data type is automatically incremented when the row has changed (or is inserted, etc.). When SharePoint makes a change to a row in the Objects table via the stored procedure proc_pubObjectTVP, that particular object has it’s Version column updated automatically. In addition, there is a SQL Trigger on the Objects table named trigger_OnTouchObjects. What this trigger does is simply update the value of the Value column in the LastUpdate table to 0 (the single row in this table always has a value of 0 for the Value column). By doing this, the Version column within the LastUpdate table is automatically updated, as it is also a timestamp column! And for a bonus, since the timestamp column is unique in the database, the LastUpdate Version column will always be one greater than the last Object updated! This will also explain why you may encounter the Concurrency Update exceptions from either PowerShell or commonly, the Configuration Wizard. A service has updated an object which then updates the Version of the object as well as the LastUpdate Version column, thus when attempting to execute against that “old” object, it is no longer valid and must be manually refreshed. Hopefully this helps demystify the Configuration Cache, what it does, and how it is associated with the Configuration database!

Viewing all articles
Browse latest Browse all 184

Latest Images

Trending Articles





Latest Images