Posts
24
Comments
14
Trackbacks
0
May 2009 Entries
Developing With Velocity CTP3

Developing With Velocity - Phase II

In my limited testing environment I have decided to try only the basic sample of MS Velocity found in CTP2 Samples, and what I thought would be the most often used properties of Velocity.

By default, the Velocity's DistributedCache service after the installation is not running and is set to manual start, so to begin working with it you will need to launch it. This can be done using the admin PowerShell applet or by starting the Microsoft project code named “Velocity” Windows Service. I opted for using the PowerShell Administration tool. To use it double-click the icon of the admin tool and type in Start-CacheCluster. You must see a success message in the following form:

Velocity Start

The service status column displaying word UP means the DistributedCache is running. If you have changed the default port then it is time to memorize it now before starting coding.

At this point one may want to review the settings of the Distributed Cache. To do so issue a Get-CacheConfig command and a window will populate with the basic configuration settings:

If you wondered what High/Low Watermark parameter means, it is a memory consumption threshold. This has to do with the eviction process of cached objects. Let's leave it out for now, but this is an interesting item to explore.

Now let's get our feet wet! To code against the DistributedCache one needs VS2008 and .NET 3.5 installed. Well, I would like to tell you right here that the CTP2 samples are not running out of the box with MS Velocity CTP3.

But do not get disappointed, I needed about 30 minutes to skim through the code and apply all the necessary changes to make the sample working. Besides, I can share my updated version of the SampleTest on demand with whoever does not wish spend time editing the code sample. The important thing that the help file accompanying CTP3 outlines all the changes between the two CTPs. This file is also very helpful in understanding the concepts behind and the base model of MS Velocity.

I guess any typical client app will require some preparations, so is in the sample, the first step is to configure the client.

We do it by defining the Cache Server Endpoint 

DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];

//  Parameter 1 = host name
//  Parameter 2 = cache port number
//  Parameter 3 = cache service name
servers[0] = new DataCacheServerEndpoint("localhost", +
             22233, "DistributedCacheService");

and create the cache factory

//Pass configuration settings to cacheFactory constructor
myCacheFactory = new DataCacheFactory(servers,false, true);

False is used here to specify that it is not a routing client and true is for using local cache.

The last step is to add the reference to the cache like that:

//Get reference to named cache called "NamedCache1"
myDefaultCache = myCacheFactory.GetCache("default");

Hooray, we are ready to run our sample tests!

The SampleTest CTP2 is a console application, but it is enough to provide one with enough information on the capabilities and get the sense of power the MS Velocity has to offer.

There is a number of tests that will be executed in a manner as displayed at the very top image. The code for the very first test looks like this:

I hope I encouraged you to explore Velocity further and do your own experiments.

posted @ Monday, May 04, 2009 3:27 PM | Feedback (0)
Velocity - Installation Phase

Velocity - Installation Phase

Today I have proceeded with the installation of the MS Velocity CTP3.

I would like to mention that first one needs to verify one's system for prerequisites. Basically the most up to date components as a Service Pack of the Windows OS and the latest .Net Framework are needed, also PowerShell 1.0 is a required component because the administration can be later done using PowerShell applets.

I also recommend reading the velocity_help.chm file that can be downloaded separately. It includes very valuable information on the ways of installing the product. It helped me to understand the concepts of the implementation and make decisions about how I want Velocity configured in my environment.

Because my goal was to experiment with Velocity and because it was a CTP I have decided to install it and its shared cache on my computer locally using the Folder Share mode. By the way it is a very acceptable scenario for a production system too.

I have made a folder of my choice shared accepting the defaults and without doing any special security settings. Need to note here that the setup will add the Network Service to it allowing change and read operations.

The actual download was actually small so in a few seconds I was presented with the setup screen and asked to fill in the basic info as the project installation location.

Overall, the installation tool is very intuitive, so one should feel comfortable about the whole setup process.

Next, I was asked by the Windows Firewall if to allow communicating with the Velocity instance and I agreed.

Then, while the main installation window continued running, a Cache Host Configuration screen (above) popped up that contained initial set up information parameters. I have changed the settings to reflect my choice. One small side note I would like to mention: if you are installing on a local machine to a shared folder you will need to type the path to it in as UNC path.

Next I was able to test the settings and name my cluster instance. At this stage I saw two MS SQL Server Compact databases named ClusterConfig.sdf and ConfigStore.sdf created in the shared folder.

I was able to see the final success message on the installer tool and a shortcut put onto the Desktop leading to the PowesShell based Administration tool for Microsoft Distributed Cache.

That's it, I am ready to test the waters!


posted @ Friday, May 01, 2009 10:55 AM | Feedback (0)
News
Did you know you can create your own search engine with Google?