Monday 10 February 2014

SharePoint - Ghosted vs. Unghosted

I know this is a subject that has been covered many times but it's often hard to find an explanation that is aimed at the appropriate audience for a particular situation.  This explanation is for someone who does not necessarily know the ins and outs of SharePoint in detail but does understand web development and has an understanding of the basics concepts within SharePoint.  It is intended to purely describe what ghosted and unghosted mean and the underlying behaviour surrounding these terms.

What do ghosted and unghosted mean?
SharePoint has a myriad of files behind-the-scenes and it also has a lot of database content.  Many of the behind-the-scenes files are “blueprints” for content/data.  When you create site collections, sites, lists and libraries, etc. you are using these blueprints to create content in the SharePoint database(s), but some of this content will be simply a pointer to the blueprints.  These blueprints are cached by each web server and so if something remains unchanged from its blueprint version, the web server is able to use the cached version of the information, which is very efficient.  The blueprints come in the form of site definitions, list definitions, field definitions, module features, etc.

When content is changed within a SharePoint site (e.g. uploading a new version, using SharePoint Designer, using explorer view, etc.), if the content was previously linked to a blueprint file and thus cached on the web server, the new content is then written to the database and from that point onwards whenever that piece of content is requested it will be retrieved from the database.  When compared to the blueprint cached version, in performance terms, there will be an increase in time taken to retrieve the information, network bandwidth taken up passing the data to the web server and (usually minimal) increased storage space used within the database.

So, when a file is "ghosted" this means that it is cached - residing in memory on the web server - and as such there are performance gains.  When a file becomes "unghosted", it is written to the database and every time it is referenced it will be retrieved from the database.

Hope this helps, any comments greatly appreciated.