Showing posts with label cache. Show all posts
Showing posts with label cache. Show all posts

Tuesday, July 2, 2013

AppFabric Cache – Installation Modes

The AppFabric Caching service installation can be done in 3 different modes, each mode has its own function, together the 3 modes form a complete distributed caching system which can effectively handle caching in a distributed environment. AppFabric takes care of replicating the cache defined in one cache server to the other servers, so that the cache data placed in one of the servers in the cluster can be accessed from the other servers in the cache cluster.

The following are the modes in which the AppFabric caching can be installed.

AppFabric – Pre Requisites

AppFabric is available for free and can be downloaded from the following Microsoft’s site


The following are the pre requisites for installing AppFabric caching.

AppFabric Caching Cluster Configuration

A AppFabric cache cluster includes a number of cache host servers which jointly form a cache cluster, the configuration details of the cache host servers should be placed in a common location, each time a cache host starts it gets the basic configuration information and starts operating.

AppFabric provides the following options to store configuration information.

AppFabric Caching Architecture

AppFabric Caching can handle multiple cache servers running parallel, the individual cache servers form a cluster, the client web servers see the cache as a single cache cluster and not as individual cache servers. AppFabric caching takes care of synchronizing the cache handling between the various cache servers.

Each cache server contains a Cache Host windows service, which takes care of the managing the cache and replicating cache data across the various servers in the cache cluster.


The following diagram shows the AppFabric caching architecture in a cache cluster environment.

Monday, June 24, 2013

What is AppFabric Caching

AppFabric provides a distributed caching platform, used to develop highly scalable applications which require a cache to provide performance optimization. The caching platform can be scaled out by adding multiple cache servers to the architecture.

AppFabric caching platform takes care of sharing the cached objects across the cache servers automatically, and makes sure that the cache objects added to one of the instances is made available in all other instances.

Advantages of Distributed Caching

In general Caching improves performance of an application by storing frequently used information in the cache memory which is easily accessible when compared to the standard memory. Simple caching techniques can be used for smaller applications which get executed in a single server, however when it comes to larger applications which cannot run in a single server the simple caching techniques are not sufficient enough.

Larger applications required multiple servers, running in parallel to handle the huge volume of requests, hence we need Distributed Caching for large applications. The following are the advantages of using Distributed Caching.


Distributed Cache

Data is an important part of any application, in a conventions web application architecture which does not use any cache, data can be stored in 2 ways, using the database or using sessions, but both these options have their own limitations.

The database can store any amount of data, but fetching large amount of data from the database and displaying in the UI will bring performance of the application. Sessions are quick but there is a limitation on the amount of data that can be stored in session, adding more data to the session, consumes more memory and hence brings down the application performance.

Limitations of Asp.Net Cache

Asp.Net cache is a good approach to improve the performance of an application, frequently used data can be stored in the cache and re-used to avoid unwanted database hits. However Asp.Net cache has its limitations.

The following are the limitation of Asp.Net Cache.

Limitations of Asp.Net Cache

Asp.Net cache is a good approach to improve the performance of an application, frequently used data can be stored in the cache and re-used to avoid unwanted database hits. However Asp.Net cache has its limitations.

The following are the limitation of Asp.Net Cache.

Asp.Net Cache

Asp.Net provides a caching mechanism which can be used to store data in a key value format. The data stored in the Asp.Net Cache can be retrieved at any time by using the key against which the value is stored.

The following example stores the list of countries is a Cache variable “cacheCountryList”.

What is a Cache?

A Cache refers to an intermediate storage location which can respond quickly to requests, thereby helping in improving the performance of the applications which makes use of the Cache.

In Hardware we refer to Cache memory as an intermediate memory which stores frequently used data and responds quickly when the processor requests the data. For example RAM (Random Access memory) is a intermediate cache memory used to store and respond to frequently used data. Data stored in the cache memory is retrieved quickly as compared to the data stored in the hard disk. Similarly a cache in the software world in an intermediate storage location used to provide quick response to users requests. 

Wednesday, October 17, 2012

jquery ajax caching Example

The cache property can be used to set the caching of Ajax data in the browser, the propertu can take value true or false.

In this post we shall see on how to control the caching of data in the browser using the cache property.

The following script sets the cache property to true, hence every Ajax request will be served from the server.

$.ajax({
    url: "AjaxData.html",
    cache: true,
    dataType: "html",
    success: function(result) {
        $("#divHTML").html(result);
    }
});

Here is a full Example.

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Ajax Handlers</title>
<script type="text/javascript" src="JavaScript/jquery-1.7.2.js"></script>
    <script
        type="text/javascript"
        language="javascript">
        $(document).ready(function() {
            $('#btnGetHTML').click(function(event) {
                event.preventDefault();
                $.ajax({
                    url: "AjaxData.html",
                    cache: true,
                    dataType: "html",
                    success: function(result) {
                        $("#divHTML").html(result);
                    }
                });
            });
        });
    </script>                 
</head>
<body>
    <form id="AjaxHandlers" runat="server">
        <table border="1">
            <tr>
                <td><b>Action</b></td>
                <td><b>Response</b></td>
            </tr>
            <tr valign="middle">
                <td>
                    <asp:Button
                        ID="btnGetHTML"
                        runat="server"
                        Text="Get HTML" />
                </td>
                <td align="center">
                    <br />
                    <
div
                        id="divHTML"></div> 
                </td>
            </tr>
        </table>       
    </form>
</body>
</html>

Run the example click on the Get HTML button, notice that the data from the server page AjaxData.html gets displayed in the browser, not change some data in the server page AjaxData.html and again click on the button, notice that the changes done in the server page gets refreshed in the browser.

Now set the cache property to false [
cache: true] and perform the same steps, notice that the changes done to the server page are not reflected in the browser.

Related Post

jquery ajax status
jquery ajax status example
jquery ajax readyState
jquery ajax readyState example
jquery ajax caching
jquery ajax caching example
jquery ajax async
jquery ajax async example
jquery ajax authentication
jquery ajax authentication example

jquery ajax caching

The cache property can be used to set the caching of Ajax data in the browser, the propertu can take value true or false.

When set to true – The ajax data response is cached in the browser and reused for to serve successive requests.

When set to false – The ajax data response is not cached in the browser and a fresh request is made to the server every time to fetch the data from the server.
Syntax
$.ajax({
    url: "ServerPage",
    cache: true/false,