Share a previous technical study of the Windows Server AppFabric distributed cache.
I. AppFabric technology architecture and principles
AppFabric is similar to memcached, using the C/S mode, the server side to start the service process, at startup can specify the listening IP, its own port number, the size of the memory used and several key parameters. Once started, the service is always in a usable state.
Applies to applications built using ASP. NET, Windows Communication Foundation (WCF), and Windows Workflow Foundation (WF).
Windows Server AppFabric has three core features: Distributed caching, workflow management, and service management.
- ? For WEB applications, Windows Server AppFabric provides caching capabilities that provide caching, extensibility, and high availability for application data, thereby avoiding unnecessary calls to data sources.
- ? For composite applications, Windows Server AppFabric makes it easier for users to build and manage the services that Windows Workflow Foundation and Windows Communication Foundation Build.
- ? Windows Server AppFabric is an effective way to simplify the development, deployment, and management of these composite applications.
When a client obtains some data for the first time, such as an ASP. NET application user provides some information or reads from the database, it can use the AppFabric Caching The Services Client class library stores a unique name along with the information in the cache cluster (caches cluster). For clients, all cache servers in a cache cluster are single logical stores. The client neither knows nor cares about which physical server caches which data.
The main features of Windows Server AppFabric Caching are:
- ? Any CLR object that can be serialized can cache the data through a simple cache API
- ? Support Enterprise Size: server architecture that can support hundreds of hosts
- ? Resilient configuration and Network cache service
- ? Supports dynamic resizing and can add nodes at any time
- ? Support for high availability architectures
- ? Automatic load Balancing
- ? Integrates management and monitoring with Event tracing for Windows (ETW), System Center, and other mechanisms
- ? Provides seamless integration with ASP, stores Session data to cache, and caches application data under the Web farm architecture, reducing the burden of large database reads
- ? The first version follows Cache-aside architecture (explicit cache, Explicit Caching), meaning that you must explicitly indicate in your application that you want to add (Put) or remove a cache item, All cache data is not automatically synchronized with any source database.
Two. AppFabric Logical architecture
A named cache is also a cache that configures one or more named caches for an application, and each named cache can be configured independently of each other so that each named cache can be configured individually to achieve optimal performance.
Three. Code examples
1. Test environment Configuration
? Two-node AppFabric cluster
? Windows Server 2012 Test environment
? Windows Server AppFabric 1.1
? Master node: 10.24.13.27 administrator/test1234
? From node: 10.24.12.206 administrator/test1234
? AppFabric Cache service Configuration shared file path: \\WIN-5SF1MT124FA\Cache
? Cache service configuration file: \\WIN-5SF1MT124FA\GSPCache\ clusterconfig.xml
? Port configuration:
Show Cache configuration:
2. Application Configuration Cache
App.config/web.config Add configuration section:
3. Sample Code
4. Main methods of the Datacache class
Iv. Installation Deployment Configuration AppFabric
1. Prepare before installation , enable the Windows Update Service
To create a shared folder on the master node:
Ensure that you do not need to enter a user name and password in the same workgroup machine to access the shared folder:
\\WIN-5SF1MT124FA\Cache
2. Installing appfabric and configuring it as a cluster
3. Install additional AppFabric and join the cluster
Installing the second appfabric is similar to the first one, unlike configuring AppFabric for a different
4. Set up and start the AppFabric cluster
Run Windows PowerShell as an administrator
The following command is executed sequentially:
Add a distributed Cache management module
Import-module distributedcacheadministration
Set Cache cluster
Use-cachecluster
Authorize one of your accounts domain\username:
Grant-cacheallowedclientaccount WIN-5SF1MT124FA \administrator
Verify that the authorization is successful:
Get-cacheallowedclientaccounts
Set the security mode and protection level:
Set-cacheclustersecurity-protectionlevel None-securitymode None
Last boot:
Start-cachecluster
V. Common Commands
1.start-cachecluster
2.stop-cachecluster
3.get-cachehost can get all the cache hosts
4.start-cachehost gftest:22233 start a cache host
5.stop-cachehost gftest:22233 Stop a cache host
6.get-cacheallowedclientaccounts the user who has been authorized.
7.grant-cacheallowedclientaccount NetworkService to user authorization
8.export-cacheclusterconfig-file E:\VelocityCache\ClusterConfig.xml
9.import-cacheclusterconfig-file E:\VelocityCache\ClusterConfig.xml
10.get-cachestatistics default Gets the detailed statistical results of either the defaults or the current cache.
Six, performance testing
1. Two-node virtual machine performance test results
2. Two-node physical server performance test results
3. Parallel read and write cache
Zhou
2017/6/21
Windows Server AppFabric Distributed Cache Research