Single page Caching scheme
Single-Static page caching
Problem solving Scenario
The common cache design uses System.Web.Cache in memory and is efficient to reduce the stress of database access. But in addition to the web to get data, there are rendering page rendering, the generation of HTML many features are consumption performance. There is also a need for a cache at the Web layer, while the flexible design, application code does not require big changes.
Architecture
Client Access /report
Nginx receives the request, determines whether the memcached exists with the URL of the Key, the presence of direct return does not pass through IIS, does not exist, is uploaded to IIS, and is saved in memacched
Advantage:memcached performance, easy to deploy the cluster. It is easier to manage than static generation and does not generate disk IO. Flexible design, application code does not require any modification.
Problem: Save page Default 1m limit,key maximum length 256 bits, longest expires 30 days
Cache policy: Passive expiration (design fixed expiration time), background thread update requires updated URL, add #refresh配置成自动触发更新to URL
Test results:
DEMO:
1. Installing memcached
Unzip, run memcached.exe-d install in CMD after running successfully installed the memcached service in the Windows service , start it.
You can determine if the installation started successfully by Telnet 127.0.0.1 11211
2. Run a ASPNET Web site
The URL of the /report path under the page we will cache thes
3. Run nginx (windows for test environment, compile with VC2010)
Unzip, Configure the Conf nginx.conf in the current directory
Among them proxy_pass http://localhost:48273/Report/; For the back-end IIS proxy address, modify the port to the actual address
CMD running nginx.exe will start nginx
4. Access http://localhost:81/Report/View cache effects
Extended:
The presence of personal information on the page can use CSI technology (the page uses Ajax to call personal information data) or use ESI tags to configure the vanish server to resolve the next re-parsing
Required tests for Windows versions Nginx and memcached
Http://files.cnblogs.com/files/yuzukwok/NginxMemcached%E8%BD%AF%E4%BB%B6.rar
nginx+memcached Cache Design