📜 ⬆️ ⬇️

AppFabric Cache Pitfalls

As part of its web development platform, Microsoft provides NoSQL caching solution - AppFabric Cache. One of the interesting modes of AppFabric Cache is High Availability - the ability to create a cluster of cache servers where, in the event of a drop in any of them, your service is not interrupted and all data remains available to the application. When you create a .NET web application without a single point of failure, using such a server cache seems like an easy and natural solution. Especially here the price may be good, since AppFabric is provided by Microsoft for free as part of its operating system. However, choosing a caching solution is useful to see not only what is on the surface.

How it works

When you turn on High Availability mode for any object in the cache there are two instances on different servers in the cluster, so losing one server will not result in data loss:

(from msdn.microsoft.com/en-us/library/ee790974.aspx documentation)

This configuration does not require anything from the application, the API is exactly the same as if the cache works without High Availability. In this way, you can store session data in such a cache with the help of the built-in provider and get the ability to scale the application and failover without writing a single line of code.

And although it looks quite interesting, there are a number of points that are better known before deploying ready-made applications sharpened under AppFabric on production servers:
')
High Availability requires a minimum of 3 servers.

AppFabric cluster in High Availability mode will work with two computers, but will not work with one. Therefore, if you get rid of a single point of failure, you need at least 3 computers so that in case of loss of one of them your work would not stop.

High Availability requires that all computers have Windows 2008 / 2008R2 Enterprise Edition (or higher)

See if your hosting provider has Enterprise Edition in the list of images, or you can use special Microsoft programs for getting start-up licenses (http://www.microsoft.com/bizspark/).

Suppose you have a cache cluster of 3 computers, what happens when one of these computers suddenly goes down?

You can decide that once you have copies of objects on other computers, the service will work without interruption, right? No, not at all. The rule of the service says that copies of objects must be at least two nodes in the cluster. When one of the nodes becomes unavailable, the objects of which exist in a single copy will be copied to the other nodes of the cluster until all the objects are represented in duplicate. While the objects will be copied, your service will not be available.

In particular, this means that you cannot safely overload one of the computers in the AppFabric cluster since the service will take some time off.

This will be a bigger problem if your nodes contain a lot of RAM, because then copying will be longer. To minimize this problem, it is better to keep more servers with less RAM.

Configuration

All cluster nodes use a common configuration, which can be maintained either on the file ball or on the MSSQL server. If you deploy a service in High Availability mode to get rid of a single point of failure, then using the file ball is pretty stupid, the inaccessibility of the computer with the configuration will stop the cache. But here's a surprise - when you set up a configuration in the SQL server, the configuration utilities do not allow you to do this by requiring that your server be in the Windows domain.

What to do?

All this is rather sad and could be a file # 1 for High Availablity, but fortunately you can find a simpler solution if you have a Windows account with the same name and password (account mirroring) on ​​all computers in the cluster. This configuration can be done using the AppFabric Powershell Console; a regular GUI cluster setup program will not allow you to do this.

Throttling
AppFabric Cache uses RAM for caching. When the Memory \ Available MBytes memory count is less than 15% of the size of the physical memory of the computer, the node goes into the Throttled state. In this state, recording new data on this host is not possible. It should be remembered when planning resources.

findings

Source: https://habr.com/ru/post/125879/


All Articles