Caching interview questions and answers in ASP.NET

1)What is cacheing?
    
    -Holding output of webpage temporarily at client or at server are called as caching

2)What are different categories of cacheing?

     -there are two categories of caching
1) Client side caching: 
Holding output of webpage at client system is called as client side caching
Advantage: Number of round trips to server from client can be reduced
                     
 2)Server side caching:
Holding output of webpage at server system is called as server side  caching
 Advantage: Number of page lifecycles can be reduced, so that request response time can be reduced

3) What are the different types of caching in asp.net?

   There are three types of caching

 a) Output caching: Complete output of webpage will be maintained at client or at server for a specified amount of time.
                        There are two types of output caching
                         
                         a) Single output caching: only one output for page will be maintained
                         b) Multi Output caching: We can maintain multiple outputs of same page in cache due to some change in input given by user.
              
  b) Fragment caching: if only some part of webpage output is cached then it is called as fragment         caching   
    -Fragment caching can be implemented by using Web user control and Substitution control
                                      
 c) Data Caching: if Data is stored in cache then it is called as data caching. Data Stored in cache can be accessed in any webpage and for any client

4)What are the types of output cacheing?
                         
  There are two types of output caching
    a) Single output caching: only one output for page will be maintained
    b) Multi Output caching: We can maintain multiple outputs of same page in cache due to some change in input given by user

5)What is fragment cacheing and it is it possible to implement it at client side?

    if only some part of webpage output is cached then it is called as fragment caching
    -it cannot be implemented at client side, it is possible at server only

6)How to implement fragment cacheing?

   - Fragment caching can be implemented by using Web user control and Substitution control

7)What is data cacheing?

  If Data is stored in cache then it is called as data caching.Data Stored in cache can be accessed in any webpage  and for any client

8)What are the different types of expiry for DataCacheing?

   -There are two expiry mechanisms

 a)Time based expiry

   there are two types of time based expiry
1)Absolute time expiration: 
Data will be existing for a specified amount of time only, once time period has been completed automatically data is removed
2)Sliding time expiration: 
Expiry time will be automatically extended based  on the data access.if time period is 20sec, and no request for 20 secs then data will be removed. If there is a request at 10th sec,then time period will be extended for 20 secs....

  b)File based expiry:

data will be existing in  the cache until one of file content has been modified. Once file content has been modified automatically data will be removed

9)What AggregatecacheDependency?

-it is introduced from asp.net 2.0, if Data cache expiry dependents upon state of multiple files then it will be called as Aggregate cache dependency

10)Where do u find usage of DataCacheing?

-While dealing with company Quarter results, Dataset can be maintained in Cache
 -In news website common news will be maintained in Cache

11)What is the advantage of Cacheing?       

 -It can be used as performance tuning technique
 -Number of round trips to server can be reduced
 -Number of page lifecycles can be reduced

12)Is it possible to implement data caching at client?

 -no, it will be possible at server only

13)Where the  memory for cache is allocated?

  -As part of appDomain of website.i.e in the process memory of  asp.net worker process

14)How much data can be stored in cache?

-no limit

15)Types of Cache dependencies in Asp.net?

Aggregate :
      this type combines the multiple dependencies. The cached item is removed when one of the dependencies in aggregate changed.
custom: Here cache is depend on custom class. we can create a custom webservice cache.
File :  Cached item depend on external file content and is remove when the file is changed.
key:  The cahed item depend on another item in application cache.The cached item is removed when thee target item remove from the cache.
sqlserver: The cached items depends on SqlServer tables.

16)Scavenging in ASP.Net?

It is the process of deleting cache items from the cache when memory is scarce.

The items that are removed are those have not been accessed in some time and low priority.

using "CacheItemPriority" for setting priority.

17)What is Donut Caching?

It is s server side caching. its cacheing entire web page except small dynamic portions.

18)What is Donut Hole Caching?

It is s server side caching. its cacheing small dynamic portions instead caching entire web page.

19)Distributed caching?

when multiple instaces of our application running from multiple websersers. we need create multiple cache. depend on request reaching server.To overcome this we use distributed caching.

Here cached data is stored in central location that all instances of application access from these location.

For this microsoft caching solution is use Velocity.

Velocity is the WindowsAppFabric caching layer. 



Thanks for visiting this blog. How is the content?. Your comment is great gift to my work. Cheers.

No comments:

Post a Comment