VS 2010 & .NET Framework 4.0 Presentation

Slideshare PResentation about VS 2010 & .NET Framework 4.0

Advertisements

ASP.NET website scalability experience

Last six months have been great for me when I was exposed to the great world of scalability of my product. I will try to summarize some of my findings regarding scalability and then may take some of those stuff in detail in coming days/weeks/months.

  1. Before we start anything related to scalability for the website measure the performance of the pages with a single user on a idle bandwidth above 500 KB/s.
  2. To measure the response time of pages do the following
    1. Install tool like HTTPWatch on your machine. The basic version is free and available on http://www.httpwatch.com.
    2. Set the expiry content on the virtual directory to large number of days i.e. 3 or 5 or 10 (this can changed based on your particular need).
    3. Set the Application Pool(IIS 6.0) property such shutdown worker process if idle for 20 minutes and restart after 1740 minutes. (Switch off this setting).
    4. Now traverse through the selected interactions that you would like to measure once. This will warm up the browser cache.
    5. Now measure the response time using the HTTPWatch.
    6. If the response time of the page are below 3 seconds then it is right case for scalability otherwise first tune the pages to bring the response time below 3 seconds.
  3. One of the first thing that you should target to improve the scalability is to start with the database layer.
    1. Check how many queries are getting fired per interaction.
    2. Is there any redundant data being fetched.
    3. If yes then can we cache the data to lesser down database resource usage.
    4. Can we differentiate between Read and Write operations on database.
    5. If yes then can we have separate connection string for both of them.
    6. This is useful if you want to have separate database for Read and Write. (Synchronization can be an issue, will propose my proposal in later posts).
  4. Moving to the website having aspx pages,
    1. Are you using Session variables?
    2. If yes then use ASP.NET State Service for storing the session variables.
    3. Do you store the data in files?
    4. If yes then can they be stored on shared location.
    5. Do you generate content dynamic?
    6. If yes then can they move to shared location.
    7. Now use the VS 2005 Load Test tool to identify the bottleneck for number of users at which the website starts breaking or deteriorating.
  5. Use Windows 2003 Server Network Load Balancing (NLB) component to load balanced your website. Its simple to configure and leverage.
  6. Now again use the VS 2005 to load test tool to measure now at what point the website starts deteriorating.

One of the reason of slow response time is the way we have written the ASPX pages. In my coming post I will share my experience.

WCF: Hosting Service with multiple end points

In continuation of previous post regarding WCF, here goes another. In this post I will do step step explanation for hosting service using config file (remember this is the beauty of WCF, we don’t need to recompile to add multiple endpoints).

The assumtion is readers have already implemented the service contract. I will use a dummy class named IService for my explanation

  1. Create a instance of ServiceHost. 
    1. ServiceHost servicehost = new ServiceHost(typeof(Examples.ServiceImplementation));
  2. Use the Open to start listening.
    1. servicehost.Open();
  3. Now put the following in the App.Config file

config1.gif

Let me explain each of the element

  • The host element declares the base address for the endpoint. In this case its declaring two base address the http address and another one is the tcp address. The host address is used by the ServiceHost to listen on the respective port and address.

host.gif

  • There are three endpoints

http.gif

Each endpoint basically is collection of address, contract and binding. Here in the above case the address is not specified as we have already sepcified in the base address. The contract is Examples.IService and the binding is HTTP.

  • The second endpoint

tcp.gif

is the TCP endpoint for the same service. Smilar to the previous one this definess the endpoint as collection of Examples.IService as contract and binding as TCP and address is not mentioned and taken from the base address.

  • The last endpoint

mex.gif

is used by the client to generate the meta information about the Service. This  is standard and ideally should be there for each service.I hope the above helps in understanding this beautiful technology.

The author has 10+ years experience with Enterprise Poduct Development. He is also the Co-Founder of PCVITA. He have expertise in Enterprise Architecture, Enterprise Messaging Platform Migration, Email Archiving.

Understanding WCF

Windows Communication Foundation(WCF) that is part of .NET Framework 3.0 is in the line of Microsoft(MS) classic work of abstraction. MS have been innovator in providing abstraction over various technologies from many years. In the same tradition I do believe WCF is another achievement. Undoubtedly they understand the difficulties in any technologies being faced by technology implementors and then they use their experience to nake the technology simple by intoroducing the layer of abstraction.

Let me talk about WCf in particular now

  1. It was always challenge from many years to talk to remote objects.
  2. Many technologies have come and gone or become extinct as dinosors.
  3. To name a few will be CORBA or DCOM.
  4. But there was always problem with the technology itself and its implementation.
  5. Web Service was the most pouplar of all the technology and it still one of the best for such communication.
  6. The problem comes when we want to expose a remote object interface with multiple protocol interface such as HTTP, TCP etc.
  7. The problem with existing technology is that we have create multiple interface for the remote object i.e. each specific to each protocol.
  8. This really become a stumbling block while deciding on the protocol to be used as creating multiple interface results in maintainence overhead.
  9. So if we want a complete interoperable solution we need a web service based interface but if its standalone system the same Web Service interface becomes a performance bottleneck.
  10. WCF really becomes a great help for such scenario. It allows developer to create interface irrespective of the protocol to use.
  11. Developer can then configure the so called end points to decide on which protoocl to used for communication.
  12. The developer will create the interface and implement it. It will then expose the interface using multiple end points i.e. HTTP, TCP, Named Pipes.
  13. The client using the interface then can use the appropriate end point based their need.
  14. WCf as infrastructure takes care all overheads related to messaging etc.