locked
Design Question RRS feed

  • Question

  • We are designing a Enterprise web application. This application will be typical 3 tier application . With ASP.net in UI layer, BusinessLogic layer and Data Access Layer in C#. Database will be SQL Server 2005.

    My question is what advantages we can have if we place UI layer in separate physical server and BL and DAL in other server? I am planning to use remoting in this context.

     

     

    Wednesday, July 5, 2006 10:58 AM

All replies

  • Hi,

    First of all, I noticed from your post that you just need to adopt one concept and apply it, or in other words you put the carriage in front of the horse, which is not the correct situation, as a rule of thumb if you can avoid N Tier it's good, don't do it for granted, however first we should mention the difference between a Tier and the Layer, simply the Layer is often used when we speak about Logic, in contrast Tier when we speak about Physical.

    If you can put all your layers into one tier it's okay as this will be a very good benefit for performance, and of course as the number of tiers increase the performance degrades, first you should ask yourslef why do you want to have more than one  tier, and is it serving the functional requirements of the application or not, if you can use only one tier where you host your DAL,BLL, and UI in one tier this will give you the best performance, condsidering that if you make an inter-process communication this is 1000 costy, on the level of performance, than you make it on the same process, so what if it's inter-machine communication, of course if you want to do so, you will use remoting to make calls between your machines.

    When you layer your application you get the benefit of organization, maintainability, and reusablity, but when you tier your application this will impact performance also this will pose new problems like network communications issues, security of data across machines that will make things more complex and this will expand time of development, but this will give you more scalabillity.

    P.S. I recommend you Rockford Lhotka Framework CSLA.NET, also you can read his book Expert C#/VB.NET 2005 Business Objects it'll answer most of your questions.

    Regards,

     

    Wednesday, July 5, 2006 12:48 PM
  • I would also mention that layers were never designed to be distributed. What I mean by this is that a well designed interface between layers that run in-process on the same machine would probably be a terrible interface when run across machines.

    If you want to plan to scale out your software, you need to design the fracture points ahead of time. What I would suggest is to introduce a middle man at those points whose implementation can be swapped out. One implementation to support in-process communication, another for cross machine communication. In all cases, the interface is designed for distribution, so don't expect chatty back-and-forth calls and callbacks.

    Hope that helps.

    Wednesday, July 5, 2006 1:06 PM
  • An excellent answer from Kareem.

    Just a couple of points, don't assume you need to physically distribute your business / data access layer to a separate machine to achieve scalability.  You could of course locate each layer on the same server (UI, Business and DAL) and simply load balance across your web server.  This would remove the overhead of remoting whilst still allowing you to scale.

    Another point is that you may wish to physically partition your application for security reasons, so that the web server has no direct access to the database server, in which case physically distributing the BL / DAL may be sensible.  If you do wish to physically distribute (or you think you may in the future) attempt to make the business logic stateless, as this would allow easier distribution, and would reduce network traffic.

    Regards

    James

    Wednesday, July 5, 2006 1:11 PM
  •  James Mac wrote:

    An excellent answer from Kareem.

    Just a couple of points, don't assume you need to physically distribute your business / data access layer to a separate machine to achieve scalability.  You could of course locate each layer on the same server (UI, Business and DAL) and simply load balance across your web server.  This would remove the overhead of remoting whilst still allowing you to scale.

    Another point is that you may wish to physically partition your application for security reasons, so that the web server has no direct access to the database server, in which case physically distributing the BL / DAL may be sensible.  If you do wish to physically distribute (or you think you may in the future) attempt to make the business logic stateless, as this would allow easier distribution, and would reduce network traffic.

    Regards

    James

    Thanks James for the kind words!

    I'd like to add one more thing that in this case you should opt to Layering first, as it will allow you to have a variety of UI solutions; Winforms, WebForms, MobileForms, WebServices..etc.., if you need to plan with Scalability in mind, I recommend Rockford framework CSLA, also one of the great benefits that there's a CodeSmith template that you can use to generate classes based on your DB and it will manage all the boring work like BLL Classes, it's providing solutions for most of your needs, but remeber technology serves the business not the opposite !

    Regards,

    Wednesday, July 5, 2006 1:29 PM
  • The question is not what the advantages of separate tiers (physical layers) rather what are your requirements for the system? - for example what is the expected load and growth rate - do you expect to have to scale out ?

    As Martin Fowler once said the first rule of distributed computing is - don't - but if you have to than you should plan it in advance or the move will be far from trivial

     

    Arnon

    Friday, July 7, 2006 6:22 PM