Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [392]

By Root 5629 0


As a matter of fact, most distributed applications today need distributed caching and just can’t afford the native ASP.NET Cache object. AppFabric Caching Services is a solution that addresses many scenarios, but overall it is not feature-complete yet from the perspective of a realistic distributed cache. What other solutions are available?

Memcached


Memcached (http://memcached.org) is a popular, open-source distributed cache widely used by some popular social networks. Facebook is the most illustrious example. Technically speaking, Memcached can be hosted on a number of platforms, including Windows. Memcached, however, was originally created for Unix-based machines. For this reason, it’s often associated with PHP and, in general, with the LAMP stack (where LAMP stands for Linux, Apache, MySQL, and PHP/Python/Perl).

Memcached runs as a background service on a variety of servers and communicates with the outside world through a configured port (usually port 11211). Client applications employ ad hoc libraries to contact a Memcached-equipped server and read or write data. A client can connect to any available servers; servers, on the other hand, are isolated from one another. The server stores data in memory and applies an eviction policy when it runs short of RAM.

A .NET library that can be used to talk to a Memcached installation (regardless of the host environment) can be found at http://sourceforge.net/projects/memcacheddotnet.

Note

Is it Memcache or Memcached? Both names seem to be frequently used to mean the same product. The product name is Memcache, but because on Unix it runs as a daemon, the program file has been named with a trailing “d” just to stay consistent with Unix naming conventions for daemons. It soon became common to use Memcached to refer to either the product or the executable. A subtler question is, how should you pronounce that? Should it be like the past form of “to cache” or like it would be in a Unix environment—that is, memcache-dee? In the end, it’s up to you!

SharedCache


Written in C# and entirely based on .NET managed code, SharedCache (sharedcache.com) is another open-source distributed and replicated cache for use in server farms. SharedCache supports three deployment scenarios: a partitioned cache, a replicated cache, and a single instance.

With a partitioned cache, the entire data set is split across the active servers that form the cluster of cache server machines. With a replicated cache, each cache server contains the entire data set. In this case, the runtime infrastructure is responsible for keeping data over the servers in sync. Finally, the single instance mode entails you having a single cache server but host it out of process with respect to the client Web application. Moving from one configuration to another doesn’t require code refactoring; it’s simply a matter of configuration.

Commercial Solutions


With good products available for free or under open-source licenses, why should you ever consider commercial solutions, then? The answer is simple: commercial solutions offer more advanced features, capabilities and, especially, support. At their core, both commercial and free solutions provide a fast and scalable caching layer; the difference is in the extras that are provided. If you’re OK with the core features you get from ACS or the community edition of Memcached, by all means stick to that. Otherwise, be ready to spend some good money for the extras. Table 18-7 lists a few products currently available.

Table 18-7. A Quick List of Commercially Distributed Cache Products

Product

Description

NorthScale Memcached Server

It’s the leading commercial distribution of Memcached as worked out by some of the key contributors to the original open-source project. Enhancements include security, dynamic scaling, packaged setup, and Web-based management capabilities. From the same group, you can also get Membase Server, which is a NoSQL database backed by Memcached.

For more information, visit http://www.membase.com/products-and-services/memcached.

ScaleOut

Return Main Page Previous Page Next Page

®Online Book Reader