1

Chapter 19: Physical Tiers and Deployment on MSDN describes "Distributed Deployment" (see figure 2). All well and good.

In my experience we've always deployed our web based systems as per what they describe as "Nondistributed Deployment" (figure 1). My understanding is that in the Microsoft world the "Application Server" as a separate thing doesn't really exist (as it does in the Java world) because it's effectively 'baked in' to the OS / Windows.

So my question is if you were to distribute the UI and Business Logic (BL) onto different servers / tiers, how would they communicate?

I know one answer is to use a "service layer" - what are the alternatives? How would you actually do that? What would it look like from a code perspective?

Adrian K
  • 9,880
  • 3
  • 33
  • 59

2 Answers2

4

First off. Don't do it. Just don't. You're in for a world of pain. Logical and physical layers are different things. Logical separation of application tiers is a good idea. Physical separation of application tiers is more often than not a recipe for disaster. If there is a good deployment reason (shared payment processor on another box), sure, go right ahead. You can use the standard mechanisms we all know and love - WCF, MSMQ, HTTP, ... Pick your poison. But don't take the overhead and complexity for the sake of living up to some mythical ideal in a MSDN white paper.

James Kovacs
  • 11,549
  • 40
  • 44
  • +1 for the practical advice - Totally agree that you shouldnt do it unless you really need to. Just to add to the options James already pointed out, the good old .NET remoting is also an option – Jagmag Nov 19 '10 at 01:50
  • Don't use .NET Remoting. WCF has been out for ... 3 years? 4? If you must distribute, use WCF. It supercedes .NET Remoting. – Cheeso Nov 19 '10 at 01:53
  • +1 - Interesting! I certainly agree with keeping everything simple, (on the same box). I guess this is possibly more of an academic question - how would you do it in the real world if you needed to. Thanks for your input. – Adrian K Nov 19 '10 at 02:28
  • If you want some interesting reading on distributed architectures, check out the notion of a service bus. And by service bus, I don't mean the BizTalk variety. (BizTalk is more an integration server than a service bus.) Check out NServiceBus, Rhino Service Bus, and MassTransit. These encourage you to think of your application as a distributed message passing/processing system. If you're dealing with a more traditional web server/db, there are other options for scaling without physical tier splitting, such caching servers a la Velocity or memcache. Just some things to think about. – James Kovacs Nov 19 '10 at 02:47
1

Application Servers were cooked up as an idea to help ration a scarce resource: compute power in the middle tier. This idea came from mainframe land, initially, where CPU was scarce and expensive, and therefore a great deal of time and effort and money was spent on dicing up the mainframe CPU to various users, throttling workload, keeping load off the database, "passivating" transactions until load diminished after hours, and so on. In those days people spent millions of dollars on software that kept track of transactions on the mainframe, so as to be able to perform "chargeback" - internal cost accounting for the use of the expen$ive mainframe. Yes, people spent boatloads money so they could do billing to internal departments for the use of the mainframe.

The thing is, Intel (and later AMD), Cisco (et al), EMC, Microsoft, and Linux rendered the entire idea moot. Computing became cheap. Really cheap. There is really, really, really no need to ration mid-tier compute resource. What's a dual-cpu server go for these days? How many of those could you deploy for the annual salary of ONE IT guy? This is an inversion of the old economics of mainframe computing, where compute was the expensive, scarce resource, and people were relatively (!!) cheap. Now people are the expensive part, and compute is cheap.

App servers, and all the bells and whistles that they have for restricting access to compute, or parceling it out, or throttling it or even "monitoring" transactions for purpose of chargeback.... these things are not necessary when you have racks of cheap AMD servers.

Another thing App servers did was shield the database from workload. Essentially, offload work from the db server. Time was, developers put the business logic in a stored procedure and, boom, there was your app. But there were scalability issues with this approach. Now, though, stored procs are fast and efficient. Database servers can scale up, cheaply. Chances are, you do not have one of the top-100 workload volumes in the world that cannot be borne on Intel hardware, with stored proc logic.

One major problem with the stored proc approach though, is that it is still sort of hard to author stored procs in mainstream languages (Java, C#, VB, etc), and manage them. Yes, I know about SQL CLR and Java VMs managed by the DB. But those aren't mainstream approaches. Also, the DB Admin doesn't like code jockeys messing up his utilization graphs. For these reasons there is still a desire to write business logic in a separate language dedicated to the purpose. And there's still a desire to run and manage that logic on dedicated compute resources. But... a traditional "app server"?? No. It doesn't make sense.

Put all your logic on an Intel server and let er rip! If you need more scale, clone the box. All the business logic is stateless (right?), so you can scale OUT. Use 3 "app" server machines, or 4 or 5 or however many you need. All running exactly the same code. Clones of each other. Regardless how many business logic machines you have, do not physically distribute the workload. For max scalability, strive to keep each transaction on a single box. That is a recipe for efficiency and optimal use of resources.

It is a best practice to use logical tiers in your application architecture. This makes it easier to develop and maintain. But do not suppose that logical separation must imply, or even recommend, physical separation. It does not.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • +1 - A very thorough explanation; I'd never really considered where App Servers came from in the first place. – Adrian K Nov 19 '10 at 02:42