InitializeCache Method

Introduction

 

Caching Graphs



Introduction

Flipper Cache Add-on is an incredibly easy way to boost the performance of Flipper Graph ASP.

Flipper Cache Add-on is a component that intelligently caches the images produced by the Flipper Graph ASP component. The caching process happens absolutely transparently, behind the scenes, without you needing to change your code.

 

Setting up

To set up the Flipper Cache component, you merely need to instanciate it in the IIS' Application object.

The best way to accomplish this is by including it in the global.asa file like so:

<OBJECT RUNAT=Server SCOPE=Application ID=FlpCache PROGID="FlpCacheCtl.FlpCache.1"></OBJECT>

This will create the object upon the first access to any file in the directory in which the global.asa resides. Please note that the ID of the object needs to be exactly "FlpCache".

At this point all your graphs will be automatically cached.
Note: The cache object is included with the licensed version of the Flipper Graph ASP.
 

FAQ

Q: Is the cache cross server, web-farm complient?

A: The cache is webfarm compatible in a sense that it will work. However, the cache hit rate will be, on everage, less than if the cache is housed on a single computer.

 

Q: Application object is always around, is the Flipper Cache component reliable, is it scalable enough to be placed in the Application object.

A: As per Microsoft's recomendations ASP components [that are to be placed into the Application object] need to be implemented with the "Both" threading model and implement the FreeThreaded Marshaler. This is exactly how the Flipper Cache component is implemented. Thus it is thread safe and provides maximum performance and scalability.

 

Q: What is the approximate performance gain?

A: This is best demonstrated with an example. Let's say your site generates 64 different images with random probability of any image being generated next. Thus the cache hit rate is 50%, on average. Let's assume that uncached your server can handle a decent 20 requests per second(rps). When cached this will grow to about 250 rps. Now with 50% hit rate the server should be able to handle about 40 rps, which is about 200% performance gain.

 

Q: Is there a performance hit if the graph is not found in the cache?

A: The performance hit is by all practical means non-existent. The time it takes to search for an object in the cache is on the order of microseconds.

 

Q: How many images are cached?

A: By default the cache is set to 32 graphs, however this number can be changed via the InitializeCache method.

 

Q: How much memory do the cached graphs consume?

A: This is largely dependant on the graphs you are generating. The memory requirement is slightly over the memory requirement to hold the images themselves.

 

Q: What happens when the cache is full?

A: When the cache is full the least used entry is discarded and a new entry is placed into it's location.

Q: How do I determine if it is beneficial for me to use the cache?
A: Only in rare cases will the cache give you a negative performance gain. However, we include a file CacheStats.asp that will tell you the approximate performance boost by using the cache. Run that page periodically to decide whether to use cache or not.



InitializeCache Method

 

 

Last modified on: Friday, August 16, 2002