Why use shared cache?
There is no more efficient way to increase the scalable performance of applications then the use caching to unload deeper layers.
>> Shared Cache>> Console Test App
Console Test Application
this test application is provided as-is and should help developers to figure out how to use indeXus.Net Shared Cache. It covers all relevant options which are available but not all of them can be used at once then some are depend on the server topology, eight er you use distributed caching or replicated caching. Some of the provided functionalities are available to make a kind of proof of concept and some others available to make end-to-end measurements.
This section will explain each option which is availbale with the actual upcoming releases. Please consider that this options are used for ourself during development and it can be that between releases or even pre_release some of the functionalities are not provided or have been changed. If you like to make benchmarks with other products we highly suggest you write a small solution to do that where you also use our RELEASE build and not the DEBUG version.
Working with Data - XML Files
we diden't liked the idea of working direclty with a RDBMS system, so we decided to export some data and use instead of that xml files. With the solution we provide 2 xml files which are related. The content is quite simple, one of the xml files contains some countries and the other one has a relation to the country and various states of this country. Lets have a look on some content:
| Country.xml demo snippet |
Region.xml demo snippet |
<?xml version="1.0" encoding="utf-8" ?>
<Country>
<ConCountry>
<nCountryId>42</nCountryId>
<cName>Cameroon</cName>
<cIso2>CM</cIso2>
<cIso3>CMR</cIso3>
<cCapitalCity>Yaounde</cCapitalCity>
<cMapReference>Africa</cMapReference>
<cCurrency>CFA Franc BEAC</cCurrency>
</ConCountry>
<ConCountry>
<nCountryId>43</nCountryId>
<cName>Canada</cName>
<cIso2>CA</cIso2>
<cIso3>CAN</cIso3>
<cCapitalCity>Ottawa</cCapitalCity>
<cMapReference>North
America</cMapReference>
<cCurrency>Canadian Dollar</cCurrency>
</ConCountry>
</Country>
|
<?xml version="1.0" encoding="utf-8"?>
<Region>
<ConRegion>
<nRegionId>1</nRegionId>
<nCountryId>14</nCountryId>
<cRegionIso2>VI</cRegionIso2>
<cName>Victoria</cName>
</ConRegion>
<ConRegion>
<nRegionId>2</nRegionId>
<nCountryId>14</nCountryId>
<cRegionIso2>TS</cRegionIso2>
<cName>Tasmania</cName>
</ConRegion>
</Region>
|
Test Application Menu Options
The test application exposes various options to demonstarate how powerful indeXus.Net Shared Cache is. This chapter will explain each of the avilable options.

The menu is structured into sub-categories
1xx - Country Options
As mention previously this options demonstarate how to work within a project. Instead of accessing a database we done the demonstration with some XML files which are mention above.
200 - Object Options
This option enables developers to select first the object size. Following object sizes are available:
Once size is choosen a second user input is requested for amount of iterations. If both values are enterend the logic first init. all requested objects. Once all objects are created it will simply make:
- Add all objects
- Get all objects
- Remove all objects
The result of it is an overview with taken time for each operation and a statistical overview over selected action.
3xx - Multi Operations
Shared Cache provides the following MULTI options:
- Multi Add - adding a bunch of data
- Multi Get - receiving a bunch of data based on a list of provided key's
- Multi Remove - removing a bunch of data based on a list of provided key's
- RegExGet - receive a bunch of data based on a regular expression
- RegExRemove - receive a bunch of data based on a regular expression
4xx - Compression and Concurrent Threads
With Compression the availablity is enabled to reduce big amount of data. Every object can be compressed which has an overhead therefor be careful what you configure in your *.config file. Due a client connection pooling its very efficient to work with multiple threads.
5xx - Cache Options
Demonstrate various options which are provided by custom provider.
6xx - Compare between objects with different Attributes
Some day a request come up that shared cache slows down on objects which contain generics (e.g. List<T>). This small benchmark demonstrate the oposite.
700 - Timebased Cache Test
A testing option for objects they added with an expiration time.
800 - Long Term Test
Running several combinations together to ensure cache has no problem to handle various calls.
900 - Continous Tests
This test is used to measure that new features has no bad influence on indeXus.Net Shared Cache.
TestSizeObject Structure
A very simple structure which defines an object which is able to init various object sizes to test indeXus.Net Shared Cache. Based on ObjectSize Enum the TestSizeObject contains various sizes.
/// <summary>
/// defines object size
/// </summary>
public enum ObjectSize
{
/// <summary>
/// 1 kb
/// </summary>
One,
/// <summary>
/// 100 kb
/// </summary>
Hundert,
/// <summary>
/// 1 mb
/// </summary>
Thousend
}
|
/// <summary>
/// Test Size Object
/// </summary>
[Serializable]
public class TestSizeObject
{
/// <summary>
/// an byte array which contains object payload.
/// </summary>
public byte[] byteArray;
/// <summary>
/// object id
/// </summary>
public string Id = Guid.NewGuid().ToString();
/// <summary>
/// Initializes a new instance of the <see cref="TestSizeObject"/> class.
/// </summary>
public TestSizeObject()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="TestSizeObject"/> class.
/// </summary>
/// <param name="size">The size.</param>
public TestSizeObject(TestApplication.ObjectSize size)
{
switch (size)
{
case TestApplication.ObjectSize.One:
byteArray = new byte[1024];
break;
case TestApplication.ObjectSize.Hundert:
byteArray = new byte[1024 * 128];
break;
case TestApplication.ObjectSize.Thousend:
byteArray = new byte[1024 * 1024];
break;
}
Random r = new Random();
for (int i = 0; i < byteArray.Length; i++)
{
int bb = r.Next(65, 97);
byteArray[i] = Convert.ToByte(bb);
}
}
}
|