WebSTAR 4 Manual & Technical Reference

Manual Contents | Chapter Contents | Previous Page | Next Page

Caching

Caching is a method of storing data in memory (RAM) rather than reading it from the hard disk every time. WebSTAR includes caches for file information, and for the contents of the files that the server has sent (such as text, images, and sound).

Both these caches are stored in WebSTAR's memory partition. Quitting WebSTAR will flush these caches.
 

File Info Cache

This cache stores information about files recently served: the file name and suffix, type, creator, size, and last modified date. Because this information is accessible in RAM, WebSTAR can perform Suffix Mapping lookups and other processing very quickly. In most cases, enabling this option will improve performance considerably.

It also uses this cache to track folder requests, where the URL does not include a slash at the end, like this:

 

	http://www.domain.com/widgets

The server must check to see that there isn't a file named widgets before converting the URL to the folder format ( widgets/ ) and then getting the index file. Storing this information in the file cache lets the Web server perform this step very quickly, which will improve performance on busy servers.

Note that this cache cannot tell when your files have been modified on the disk. You must flush it to make sure that the newest pages are served: see Updating Caches for more information. If you are making constant changes to your files, see Auto Flush Cache ).

To specify the File Info Cache size in the Browser Admin, use the "Misc. Settings" page.

The File Info Cache Size is amount of RAM to use for this purpose, in kilobytes. The default setting for this field is 50 K. Setting it smaller than the default setting results in virtually no performance gain, because the cache is continually being changed as new files are loaded into the few available slots. The maximum setting is the current amount of free memory displayed in the server's status window when file info caching is disabled. Increasing the application's memory partition increases this upper limit correspondingly.

A relatively small amount of data is stored for each file in the info cache, and there is some overhead in managing the cache itself. Therefore, if you are serving hundreds or even a few thousand files, you should probably set the File Info Cache at no more than 150 K.

Data Cache

Web server data caching stores copies of the contents of the files on your web site in memory (RAM) so that the server doesn't have to open each file to serve the data inside it. This is particularly useful for sites with many small graphics files (such as logos and navigation buttons) used throughout the site. Opening and reading files requires calls to the Mac file system and accessing the hard disk, so serving the contents of these files directly from the data cache will speed up access to your site considerably. In addition, the WebSTAR SSI Plug-In automatically caches its data in memory using the Data Cache, saving time and processing.

The Data Cache is a WebSTAR Core Plug-In.If you remove it from the Plug-Ins folder, the Data Cache section of this panel will be disabled, and the server and WebSTAR SSI Plug-In will not cache data.

All files not explicitly handled by Plug-Ins are cached. This includes those with suffixes .html, .gif, .jpeg, and so on. SSI pages are also cached automatically. Unlike other web server caches, you do not have to designate the best files to cache: the Data Cache will do it for you.

There is only one Data Cache per server: it works for all Virtual Hosts on the server.

The Data Cache is an intelligent cache, using a frequency-based algorithm to automatically adapt to changing server loads. The Least Recently Used system tracks when files are requested: when the Data Cache runs out of memory, the files requested recently are retained and the others removed.

As files change on the server disk, you want the Data Cache to serve the most recent version. However, checking the file before responding to every request takes significant time, especially on busy servers. You can schedule how often the Data Cache should check to see if the file has been changed. See Checking File Modification Date (Minutes) .

Plug-Ins can use the WebSTAR Data Cache, and a number of third-party Plug-Ins do so, or have their own caching.

Plug-In Developers, see Calling WebSTAR Data Cache .

Data Cache Size

The Maximum Data Cache Size is the amount of RAM allocated for this purpose, in kilobytes. The default setting for this field is 256 K. You can change the Maximum Data Cache size to any number between 32 K and the amount of memory allocated to the WebSTAR server. If you allocate more, be sure to increase the memory allocation of the WebSTAR server application by an equal amount (see Server Administration Responsibilities ).

The Data Cache is always enabled, and will be called whenever the Web server serves a file that is not handled by another Action (see Suffix Mapping ).

If you're using the Browser Admin, use the Plug-Ins "WebSTAR Data Cache" page to set the Data Cache size.

Maximum File Size to Cache

You can control the Data Cache storage by defining how large a file can be cached. For example, if you have many 5 KB files and a few 200 KB files, it's much more efficient to serve the smaller files from the Data Cache. Large files take less advantage of the data cache--WebSTAR overruns most network connections long before the file transmission is completed, so reading the file from disk does not slow the transfer rate.

If you have many large files, and your server has a lot of RAM, you can allocate more memory to the server, increase the Data Cache size, and increase the Maximum File size.

The default is 32K , and the range is from 32 K to 10,000 K (10 MB).

Optimizing the Data Cache

Selecting the best cache size requires experimentation. A cache that is too small has no effect on performance, while a cache that is too large could waste memory. Use the Data Cache Information Window , described below, to help configure your data cache.

In addition, the data cache only avoids the overhead of disk access. You still have the network delays, even if you are on a T1 or a T3 internet connection. Data caching is most effective for small files used often in your web site.

If you are serving large files, you can also experiment with increasing the size of the system's disk cache.

For testing, you may want to use a utility such as Pounder or Netsplat to simulate a high load on your site, as well as checking your site from several different locations. For testing tools, see the Extending WebSTAR pages on the StarNine site:

http://www.starnine.com/extendingwebstar.html

The Status windows and Browser Admin monitor page will show you the memory usage while you're testing. Be sure to wait while the data cache fills up during your experiments.

Server performance is affected by the amount of bandwidth you have. If you have a large or busy site, you should consider getting a more bandwidth or mirroring your content at your ISP using a third-party Plug-in.

Data Cache Information Window

The Data Cache Information Window will appear when you choose Data Cache from the Plug-Ins menu in the WebSTAR server application.

 

After your server has been running for a while, refer to the WebSTAR Data Cache Info window. When the "Efficiency" and "% of Cache Used" numbers are high (over 75%) the Data Cache is working properly. These numbers are also displayed as the speedometer and fuel gauge.

If the cache usage is low, you may want to increase the Data Cache size. Make sure you also allocate more memory to the server. Keep testing and incrementing until you reach a balance.

Sometimes the Data Cache window will report a different amount of data sent then WebSTAR server status window, even though all suffixes are cached. Your Data Cache may be running out of RAM (it will say 100% efficiency). In addition, some items never appear in the Data Cache number, including CGI data, Error files, No Access files, and File-Not-Modified responses.

Checking File Modification Date (Minutes)

This slider specifies how often the Data Cache should check the server disk for the file modification date when it gets a client request for that file. It will only read the file from disk again if the date and time indicate that the file has changed.

The default is to check when a request comes at least 5 minutes after the last check. The allowed range is from Always (10-20 seconds) to Never (about 20 minutes).

Updating Caches

Because the Data Cache checks file modification dates, it will read your changes at most 20 minutes after you save the file to the server disk. However, if you are updating your site, you may want to see changes immediately. There are several ways to make sure you can see the changes.

Nocache HTTP request

You can use the Super Reload option, if your browser supports it. This will send a special nocache command as part of the request header, and the Data Cache will always check the file modification date. If it finds that the file on disk is newer than the cached data, it will open the file and read the data into the cache before serving it.

Flushing the Caches

The WebSTAR Web server can flush the caches , which means that it will clear the File Info Cache, the Data Cache, and the DNS cache, and send a message to third-party Plug-Ins to flush any caches they are keeping.

The caches are always flushed when you upload a file using the WebSTAR FTP Server .

When you quit and restart WebSTAR, all caches are automatically flushed.

Manual Cache Flush

To flush the cache, you can use any of these commands:

When you view the WebSTAR server status window, you'll see an entry confirming that the cache was successfully flushed.

Auto Flush Cache

The WebSTAR Admin Web Settings Cache panel and Browser Admin Controls page allow you to set an interval for the system to automatically flush both the File Info Cache and the Data Cache. This is rarely necessary.

The default setting is to have Auto Flush Cache set Off . If you enable it, the default interval is 30 minutes.


Manual Contents | Chapter Contents | Previous Page | Next Page