Windows Azure Caching

Last updated

an in-memory, distributed caching feature designed for Microsoft Azure applications. Caching was available as a part of the Windows Azure SDK. The Azure Managed Cache and In-Role Cache services were retired, and Microsoft recommended migration to Azure Redis Cache.

Contents

Architecture

Windows Azure Caching allows a cloud service to host Caching on a Windows Azure role. [1] The cache is distributed across all running instances of that role. Therefore, the amount of available memory in the cache is determined by the number of running instances of the role that hosts Caching and the amount of physical memory reserved for Caching on each instance. [2]

There are two deployment topologies for Caching:

Dedicated topology

In the dedicated topology, you define a worker role that is dedicated to Caching. This means that all of the worker role's available memory is used for the Caching and operating overhead.

The following diagram shows Caching in a dedicated topology. The cloud service shown has three roles: Web1, Worker1, and Cache1. There are two running instances of each role. In this example, the cache is distributed across all instances of the dedicated Cache1 role.

Windows Azure Caching (Dedicated).jpg

A dedicated topology has the advantage of scaling the caching tier independently of any other role in the cloud service. [5] For the best Caching performance, a dedicated topology is recommended because the role instances do not share their resources with other application code and services. [3]

Co-located topology

In a co-located topology, you use a percentage of available memory on existing web or worker roles for Caching. [4]

The following diagram shows Caching in a co-located topology. The cloud service has two roles: Web1 and Worker1. There are two running instances of each role. In this example, the cache is distributed across all instances of the Web1 role. Because this role also hosts the web front-end for the cloud service, the cache is configured to use only a percentage of the physical memory on each instance of the Web1 role.

Windows Azure Caching (Co-located).jpg

A co-located cache is a cost-effective way to make use of existing memory on a role within a cloud service. [4]

Examples

The following sections show Windows Azure Caching configuration and code examples.

Configuration example

In Visual Studio, Caching is configured in the Caching tab of the properties of the role that hosts Caching. [6] This makes underlying changes to the ServiceConfiguration.cscfg file. [7] These settings determine the topology used (dedicated or co-located) and the number of named caches [8] and their settings.

Other roles must be configured to use Caching. [9] One way to do this is with a NuGet package. This includes modifying the web.config to contain a properly configured dataCacheClients [10] section. The following example dataCacheClients section specifies that the role that hosts Caching is named “CacheWorker1”.

<dataCacheClients><dataCacheClientname="default"><autoDiscoverisEnabled="true"identifier="CacheWorkerRole1"/></dataCacheClient></dataCacheClients>

Code examples

Note that the code samples in this section are shown in C#.

When hosting Caching on roles, the DataCache class constructor can be used to specify both the named cache and the dataCacheClient section for the cache client settings. The following code shows how to create a named cache, NamedCache2, using the settings from a dataCacheClient section named customClient.

varcache=newDataCache("NamedCache2","customClient");

The following method shows how to use the Cache object to retrieve data from the cache. In this example, a user identifier (userid) is the key for the associated user information object. The code first attempts to get this user information from the cache using the userid key. If that does not succeed, the code retrieves the information with a database query and then stores the returned user data in the cache. The next time the same code is run, the user information will be returned from the cache rather than the database. This assumes that the cached data has not been expired or evicted.

dataTypeGetUserData(stringuserId){dataTypedata=null;// Attempt to retrieve the user data from the cache:objectdataObject=Cache.Get(userId);if(dataObject!=null)data=(dataType)dataObject;else{// If it doesn't exist in the cache, retrieve it from the database:data=GetUserDataFromDatabase("SELECT * FROM users WHERE userId = @userId",userId);// Put the returned data in the cache for future requests:Cache.Add(userId,data);}returndata;}

The following method shows how to update data that is already in the cache.

voidUpdateUserData(stringuserId,dataTypedata){// Update the user information in the database:result=UpdateUserDataInDatabase(userId,data);if(result){// If successfully updated, update the cache:Cache.Put(userId,data);}}

The following call removes the item from the cache.

Cache.Remove(userId);

Shared Caching

Windows Azure Shared Caching provides caching as a managed service. [11] Unlike co-located or dedicated topologies, the cache is not hosted on Windows Azure roles in a single cloud service deployment. Instead, the cache is provided as a multitenant service with usage quotas. [12] The service is divided into tiers that range from 128 MB to 4 GB. [13] In addition to storage capacity, each tier provides increasing processor and network capabilities. [13] Shared Caching provides a way for multiple cloud services to access the same cache.

History

Windows Azure Caching has its roots in an on-premises technology, AppFabric. It was originally released as one of several Windows Azure AppFabric services, but the AppFabric designation in Windows Azure has since been abandoned. Many of the assembly names, namespaces, and APIs are identical between Windows Azure Caching and AppFabric Caching. [14] The first release of Caching for Windows Azure in April 2011 provided caching as a managed service in Windows Azure. [15] This offering is now called Shared Caching.

In October 2012, support was added for hosting Caching on roles within a cloud service deployment. [16] This is now called Windows Azure Caching.

Windows Azure Caching is related to other Microsoft caching technologies. These technologies share similar features, such as the assembly name, namespace, and types. [14] However, there are some differences. The table below describes these technologies.

Caching TechnologyTargetInstalled ByDescription
AppFabric Caching On-Premises AppFabricDistributed on-premises cache that uses servers that the user provisions and manages.
Windows Azure Caching Cloud Windows Azure SDK Caching is distributed across the instances of a single role in a Windows Azure cloud service deployment.
Windows Azure Shared Caching Cloud Windows Azure SDK Caching is provided as a multitenant service for use by Windows Azure cloud services.

Related Research Articles

Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. Windows Server operating systems include it as a set of processes and services. Originally, only centralized domain management used Active Directory. However, it ultimately became an umbrella title for various directory-based identity-related services.

VBScript is a deprecated programming language for scripting on Microsoft Windows using Component Object Model (COM) based on classic Visual Basic and Active Scripting.

Memcached is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source must be read. Memcached is free and open-source software, licensed under the Revised BSD license. Memcached runs on Unix-like operating systems and on Microsoft Windows. It depends on the libevent library.

Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft Corporation which provides a user with a graphical interface to connect to another computer over a network connection. The user employs RDP client software for this purpose, while the other computer must run RDP server software.

Microsoft Servers is a discontinued brand that encompasses Microsoft software products for server computers. This includes the Windows Server editions of the Microsoft Windows operating system, as well as products targeted at the wider business market. Microsoft has since replaced this brand with Microsoft Azure, Microsoft 365 and Windows 365.

<span class="mw-page-title-main">Microsoft Data Access Components</span> Framework

Microsoft Data Access Components is a framework of interrelated Microsoft technologies that allows programmers a uniform and comprehensive way of developing applications that can access almost any data store. Its components include: ActiveX Data Objects (ADO), OLE DB, and Open Database Connectivity (ODBC). There have been several deprecated components as well, such as the Jet Database Engine, MSDASQL, and Remote Data Services (RDS). Some components have also become obsolete, such as the former Data Access Objects API and Remote Data Objects.

As the next version of Windows NT after Windows 2000, as well as the successor to Windows Me, Windows XP introduced many new features but it also removed some others.

The Microsoft Enterprise Library is a set of tools and programming libraries for the Microsoft .NET Framework. It provides APIs to facilitate proven practices in core areas of programming including data access, logging, exception handling and others. Enterprise Library is provided as pluggable binaries and source code, which can be freely used and customized by developers for their own purposes. It also ships with test cases and quickstarts.

Microsoft Application Virtualization is an application virtualization and application streaming solution from Microsoft. It was originally developed by Softricity, a company based in Boston, Massachusetts, acquired by Microsoft on July 17, 2006. App-V represents Microsoft's entry to the application virtualization market, alongside their other virtualization technologies such as Hyper-V, Microsoft User Environment Virtualization (UE-V), Remote Desktop Services, and System Center Virtual Machine Manager.

Azure DevOps Server, formerly known as Team Foundation Server (TFS) and Visual Studio Team System (VSTS), is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, testing and release management capabilities. It covers the entire application lifecycle and enables DevOps capabilities. Azure DevOps can be used as a back-end to numerous integrated development environments (IDEs) but is tailored for Microsoft Visual Studio and Eclipse on all platforms.

<span class="mw-page-title-main">SharePoint</span> Web application platform

SharePoint is a web-based collaborative platform that integrates natively with Microsoft 365. Launched in 2001, SharePoint is primarily sold as a document management and storage system, although it is also used for sharing information through an intranet, implementing internal applications, and for implementing business processes.

<span class="mw-page-title-main">Visual Studio</span> Code editor and IDE

Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms including Windows API, Windows Forms, Windows Presentation Foundation (WPF), Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

Microsoft SQL Server is a proprietary relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network. Microsoft markets at least a dozen different editions of Microsoft SQL Server, aimed at different audiences and for workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users.

Microsoft Azure, or just Azure, is the cloud computing platform developed by Microsoft. It offers management, access and development of applications and services to individuals, companies and governments through its global infrastructure. It also provides a range of capabilities, including software as a service (SaaS), platform as a service (PaaS), and infrastructure as a service (IaaS). Microsoft Azure supports many programming languages, tools, and frameworks, including Microsoft-specific and third-party software and systems.

Some of the new features included in Windows 7 are advancements in touch, speech and handwriting recognition, support for virtual hard disks, support for additional file formats, improved performance on multi-core processors, improved boot performance, and kernel improvements.

Redis is a source-available, in-memory storage, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. Because it holds all data in memory and because of its design, Redis offers low-latency reads and writes, making it particularly suitable for use cases that require a cache. Redis is the most popular NoSQL database, and one of the most popular databases overall. Redis is used in companies like Twitter, Airbnb, Tinder, Yahoo, Adobe, Hulu, Amazon and OpenAI.

AppFabric Caching provides an in-memory, distributed cache platform for Windows Server. Microsoft developed AppFabric Caching and released it as part of AppFabric.

Azure Web Apps was the name for a cloud computing based platform for hosting websites, created and operated by Microsoft. It is a platform as a service (PaaS) which allows publishing Web apps running on multiple frameworks and written in different programming languages, including Microsoft proprietary ones and 3rd party ones. Microsoft Azure Web Sites became available in its first preview version in June 2012, and an official version was announced in June 2013. Microsoft Azure Web Sites was originally named Windows Azure Web Sites, but was renamed as part of a re-branding move across Azure in March 2014. It was subsequently renamed "App Services" in March 2015.

The history of Microsoft SQL Server begins with the first Microsoft SQL Server database product – SQL Server v1.0, a 16-bit relational database for the OS/2 operating system, released in 1989.

ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, such as C# or Visual Basic. The main building blocks of Web Forms pages are server controls, which are reusable components responsible for rendering HTML markup and responding to events. A technique called view state is used to persist the state of server controls between normally stateless HTTP requests.

References

  1. "Caching in Windows Azure". MSDN Library. Microsoft. Retrieved 12 February 2013.
  2. "Capacity Planning Considerations for Windows Azure Caching". MSDN Library. Microsoft. Retrieved 13 February 2013.
  3. 1 2 "Windows Azure Caching on Dedicated Roles". MSDN Library. Microsoft. Retrieved 13 February 2013.
  4. 1 2 3 "Windows Azure Caching on Existing Roles". MSDN Library. Microsoft. Retrieved 13 February 2013.
  5. "About Windows Azure Caching, Cache Cluster". MSDN Library. Microsoft. Retrieved 13 February 2013.
  6. "How to Use Windows Azure Caching". Windows Azure Website. Microsoft. Retrieved 13 February 2013.
  7. "Windows Azure Caching Role Configuration Settings (ServiceConfiguration.cscfg)". MSDN Library. Microsoft. Retrieved 13 February 2013.
  8. "About Windows Azure Caching, Named Caches". MSDN Library. Microsoft. Retrieved 13 February 2013.
  9. "Getting Started with Development for Windows Azure Caching, Configure the Clients". MSDN Library. Microsoft. Retrieved 13 February 2013.
  10. "Windows Azure Caching Client Configuration Settings (Web.config), dataCacheClients". MSDN Library. Microsoft. Retrieved 13 February 2013.
  11. "About Windows Azure Shared Caching". MSDN Library. Microsoft. Retrieved 13 February 2013.
  12. "Understanding Quotas for Windows Azure Shared Caching". MSDN Library. Microsoft. Retrieved 13 February 2013.
  13. 1 2 "Windows Azure Shared Caching FAQ". MSDN Library. Microsoft. Retrieved 13 February 2013.
  14. 1 2 "Differences Between Caching On-Premises and in the Cloud". MSDN Library. Microsoft. Retrieved 13 February 2013.
  15. "Introducing the Windows Azure Caching Service". MSDN Magazine. Microsoft. Retrieved 13 February 2013.
  16. "Windows Azure Caching Release Notes (October 2012)". MSDN Library. Microsoft. Retrieved 13 February 2013.