"Noufal Ibrahim" <[EMAIL PROTECTED]> wrote >> What's the point in having a server app between the user frontend >> and >> a database backend?
> Off the cuff, I think the layer would decouple your store (the db) > and > the UI. That's part of it but not the main reason. N-Teir was being touted long before web clients had been heard of! > On the negative side, it's one more thing that needs to be written > and > maintained and is a point of failure especially when large number of > clients connect simultaneously. Actually the latter scenario is the main reason for going 3-teir client server. The middle teir can be replicateed and thus a 3 teir (or more generally an N-Teir) application will scale much better. Most 2-teir C/S apps runout of steam with a few hundred concurrent users due to problems with the database locking and other types of contention. With a mid teir doing the business rules andcalculations you can generally wscale 3-teir up to 10's of thousands of concurrent users. Also because you have multiple servers for 10,000 users - say each handles 1000 users - then if one server goes down the rest keep functioning and you only lose service to 10% of your users. Even better if you have a layer of middleware doing the load balancing the users won't even know the server failed because their requests will be bounced to another server instance. The worst that happens is a time-out and an error message for the transaction that was running at the point of failure. Multi-teir also gives you much more flexibility over where to put the processing. Databases are very good at searching and sorting, but not usually very good at high intensity calculations. So by moving the math into the server and keeping the data access in the database you optimise performance. You can also create services that are usable across a range of applications using multiple databases - eg an image processing server. But that takes us into the realms of Service Oriented Architectures(SOA) Further, where an application is dispersed geographically an N-Teir solution can dramatically improve performance by reducing network delays. For example I worked on a customer service app for a global company with offices in Asia, Africa, the Middle East, Europe and North America. The main database was on a mainframe in Europe but we had intermediate app servers in South Africa, Australia (for all Asia) , two in the USA, and two in Europe(UK & Italy). During the trials (with only one server in the UK) we were getting 5 second plus transaction times in the US and Asia but after distributing the servers we got 1-2 seconds everywhere. Of course to make that work you have to design the transaction sequences to maximise caching etc, it's not automatic, but done right it can be a major boost to performance. Finally, by using intelligent caching, intermediate servers can partially protect from a database failure, since many transactions (especially read-only) can be carried out using most recently used data in a cache. This will typically be adequate to cover the downtime between the database going down and a cold standby being booted into life (say 10-20 minutes) and the network reconfigured. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
