Cache issues

From Organic Design
Jump to: navigation, search


MediaWiki and Caching

Caching

Caching is method of storing information you get from other places locally on the computer that you are using. Understanding how caching works will save you countless hours of frustration of making changes, and then troubleshooting as to why the changes you have made do not appear on your website. There are two different caches that you will have to contend with. The first is browser cache that is kept locally on your computer. The second is the cache of information that is on a web server.

Browser Cache

Every time you access a page on the internet from your web browser, your computer actually stores the information from the web site you are accessing onto your computer’s hard drive or in your computer’s memory. The information you see on your screen is actually coming directly from your computer, and only indirectly from the website you are viewing. This is useful because cashing makes your browsing experience much faster. Pages that you visit often will load up quickly, since they are already on your computer. This type of cache is called your browser cache.

Parser Cache

In addition to the, software programs such as MediaWiki also utilize caching in serving up pages. For example, the first time a pages is accessed on your wiki, MediaWiki requests the latest information from its database and actually writes that information to a static page. The next time that article is accessed, MediaWiki automatically serves up the cached page instead of requesting the information from the database each time. This reduces server load and makes MediaWiki and the website perform much faster. There are other kinds of server-side caching too such as memcached.

Advantages of Caching

Cashing allows performance can be increased for several reasons. First, because the information is local, it requires a shorter “trip” to access that information, making access faster. Second, because you are accessing the information locally, it places less strain on the bandwidth and processing power necessary to access the information from the database, or to move the information from the internet or network to your computer. Finally, it saves resources in terms of time and money because the information does not have to be re-processed and sent from the database or host computer each time you need to access it. While it may seem trivial to send just a single file across the internet, multiplied by frequency of access, this becomes a paramount concern for managing resources for database, servers, and bandwidth performance. Caching save money, time and energy by reducing bandwidth overhead. Simply put, caching is “green friendly”

Disadvantages of Caching

The primary disadvantage to caching is that you have a much higher chance of aged data. Since the information comes from a local computer’s cache or remote server’s cache, it is not necessarily the latest information that is on the website, or in the database.

Get the Latest Information- Refresh

If you want to make sure you are looking that the latest version of the information on a website, you can request a new copy from the website you are viewing by pressing the Refresh or Reload (F5) key while your browser is the active window. This type of refresh works for most users, but this command only downloads a fresh copy of the written content from the website you are looking at. If you need to update the content and scripting/ display information, such as images, JavaScript, and cascading style sheets, you need to engage in some finger gymnastics by simultaneously holding down the Shift or Command key (depending on your computer’s operating system), in addition to the F5 key to request all new information from the website or server. This is a useful and necessary step if you are designing a website and need to view changes frequently.

Get the Latest Information- Purge

To get the latest information from MediaWiki, it is important that you understand the basics of the Purge action. To reduced overhead and increase performance, every article you view from a website running MediaWiki comes from a cached page (in most cases).

To be sure you are accessing the latest version of an article, you simply need to append &action=purge to the end of the URL for the article you want to refresh.

http://example.org/wiki/index.php?title=Main_Page&action=purge

Note: Remember to change the "example.org" to match the host name of your actual Wiki. Note that hitting refresh on your web browser will just get a new copy of the cached page served from MediaWiki.

Purging is a useful and necessary step when employing advanced wiki techniques such as modifying templates, working with the design and layout of a page, and working with extensions such as DPL, Semantic, and Widgets.

Recap

To make sure you are getting the current version of an article from MediaWiki, you need to do both of the following two steps:

  • Ctrl or Command-F5
  • append &action=purge to the end of the website address.
Extension Tip: http://www.mediawiki.org/wiki/Extension:Purgetab
MediaWiki Manual: http://www.mediawiki.org/wiki/Manual:Cache