N(=3) -Tiered Systems

23
1 N(=3)-Tiered Systems Naim R. El-Far, PhD Candidate TA for SEG3202 Software Design and Architecture with N. El-Kadri (Summer 2005) Tutorial 2 of 4 – 3/6/2005

description

N(=3) -Tiered Systems. Naim R. El-Far , PhD Candidate TA for SEG3202 Software Design and Architecture with N. El-Kadri (Summer 2005) Tutorial 2 of 4 – 3/6/2005. About Today’s Material. - PowerPoint PPT Presentation

Transcript of N(=3) -Tiered Systems

Page 1: N(=3) -Tiered Systems

1

N(=3)-Tiered Systems

Naim R. El-Far, PhD Candidate

TA for SEG3202 Software Design and Architecture with N. El-Kadri (Summer 2005)

Tutorial 2 of 4 – 3/6/2005

Page 2: N(=3) -Tiered Systems

2

About Today’s Material

Slides based on presentations by N. El-Kadri of the University of Ottawa (http://www.site.uottawa.ca/~nelkadri) and Dr. D. Penny of the University of Toronto (http://www.cs.toronto.edu/~penny).

Page 3: N(=3) -Tiered Systems

3

System Architecture Choices

Monolithic 1 large program, imports/exports data

Client/Server collection of clients, updates server (usually hosting a database) “fat client”

N-tiered (N ≥ 3) collection of clients, mid-tier process for functional process logic aka

“business rules” “thin client”

Page 4: N(=3) -Tiered Systems

4

3-Tiered Systems

Client

Middle-TierServer

DatabaseServer

Presentation logic

Data

Business rules

some logicto client

some logicto db

Page 5: N(=3) -Tiered Systems

5

Example Business Rule

pay = hours_worked * pay_rate In a client/server architecture:

1. Prompt the user for employee_id & hours_worked

2. Fetch pay_rate from DB withselect pay_rate from pay_table where employee_id = <id>

3. Calculate the pay for the employee

4. Generate and execute an SQL statement to update the DB

update payroll

set pay = <calculated_pay>

where employee_id = <id>

Page 6: N(=3) -Tiered Systems

6

Change to a Business Rule

Problem: Suppose you need to change the system to account for overtime

if(hours_worked < 40)pay = hourseWorked * payRate;

else { pay = 40 * payRate; overtimeRate = payRate * 1.5; overtimeHours = hours_worked – 40; pay += overtimeHours * overtimeRate;}return pay;

Solution (C/S systems): Multiple client program needs to be modified, re-compiled, re-tested, and re-installed.

(N.B. Separation of concerns at code level can be maintained but at what expense?)

Page 7: N(=3) -Tiered Systems

7

Alternatively

Solution (3-tiered systems): A database stored procedure could be used to compute the pay. (using Oracle PL/SQL, programming language extensions to DBs, etc).

Page 8: N(=3) -Tiered Systems

8

Pros and Cons of 3-Tiered SystemsPros:

Clients could concentrate exclusively on presentation. Single database would have to be changed, re-tested & migrated.

Cons: DBs are fragile especially in relational models DB engines are not designed to have extensive functionality (but that’s

changing): inefficient limited choice of language hard to interact with outside services poor development environment poor error recovery

Page 9: N(=3) -Tiered Systems

9

Architectural Issues

Know your system! Balance, balance, balance. Client-resident business rules

client bloat + lack of scalability on client machines need to address lowest common denominator machine

transactions involving more than just db (e.g. queues) must configure all client machines

DB-resident business rules DB bloat (too much for the db to do – runs out of steam)

Common Issues large # db connections lack of support for caching wide-area data distribution (data partitioning strategy) fault tolerance (physical, user, etc)

Page 10: N(=3) -Tiered Systems

10

Some Industry Statistics

Jan 1999 survey by Cutter Consortium of Fortune 1000 companies (sorry couldn’t find anything more recent)

2/3 of respondents had a formal system architecture Monolithic

14% client/server

26% n-tier client/server

54% web centric

3%

Page 11: N(=3) -Tiered Systems

11

Legacy Issues

In large corporations, different departments develop their own client/server systems

Inevitable in the case of mergers and acquisitions

Page 12: N(=3) -Tiered Systems

12

Solution

Add a middle tier to isolate clients from databases.

Re-engineer the databases going forward.

Page 13: N(=3) -Tiered Systems

13

Case Study

Source: “A Software Architecture to Support a Large-Scale, Multi-Tier Clinical Information

System” by J.A. Yungton et al. (Clinical Systems R&D at PHCS, Boston, MA) http://adams.mgh.harvard.edu/PDF_Repository/D004726.PDF

Paper uses different naming convention, but the concepts are universal Paper addresses both developer and user “Partners HealthCare” merger of two Boston-area hospitals

Brigham and Women's Hospital Massachusetts General Hospital

Clinical Information System patient health records tests and results …

Each hospital had its own “homegrown” system decision was made to merge the systems neither was superior to the other

each system had its strengths

Page 14: N(=3) -Tiered Systems

14

Case Study

Issues and Goals of the R&D Team Delivery and maintenance of 20,000+ computers A solid data access tier

software services data access routines reusable modules to

minimize duplication of effort maximize application interoperability

Intuitive, consistent, clinical computing environment diverse end-user population usability!

Page 15: N(=3) -Tiered Systems

15

Case Study – Software Distribution

Given the goals and issues discussed, what are the architecture options that we have? network architecture (terminal/server model)

applications resident on servers pro: applications always up-to-date con: excessive load on servers, no functionality at terminals

N-tiered/client-server architecture local executables

pro: frees server from download and execution con: program and patch distribution

Boils down to how you do it Initial distribution: Microsoft Server Management System, IBM

Tivoli software – no problem Update and patch distribution: MSMS uses “server push” triggered

on system reboot – problem! Might be days before a system reboots.

Page 16: N(=3) -Tiered Systems

16

Case Study – Software Distribution

Network is no good, strict n-tiered/client server is no good, how about a … Hybrid approach (basically a modified n-tiered/client server approach)

Client maintains local program cache executables, support files, shared libraries

On each execution, cache checked against server to ensure most recent updates are installed by a …

“Launcher” installed on each client, triggered by each application launch “Version Console” resides on a network server

front-end to version control database Launcher communicated workstation type (alpha, beta, production) and asks for

updates that can be delivered as a “release” if needed Release = project (collection of files) + its dependencies

Page 17: N(=3) -Tiered Systems

17

Case Study – Data Access Tier

Goal: enterprise-wide data consistency and data access Problem: no existing common denominator, no common protocols to handle

data, no common format to display data. Solution: add an abstract “data access” tier

provides common data objects & services to client applications while hiding the details of disparate back-end systems

How to? Microsoft COM

Object Linking and Embedding (OLE) Component Object Model (COM) .NET robust, easy to use, relatively fast allows application development to proceed in parallel with middle-tier development

Where does the Data Access Tier physically reside? could reside anywhere chose to distribute data access servers to client workstations

Better performance Distributed data models (proximity, division, etc)

Page 18: N(=3) -Tiered Systems

18

Case Study – Data Access Tier

Design and analysis of the data to identify key objects and services (core to build upon and around) PatientObject UserObject, UserSecurity OrderEntry-based objects:

Order, Test, Medication, … Service-based objects:

PatientLookup, Observation, Procedure, Therapy, … Results-based objects PCISClientManager

MGH data stored on Tandem Nonstop SQL

Page 19: N(=3) -Tiered Systems

19

Case Study – Data Access Tier

Such division allows for: Client-to-data access tier communications

callable well-defined interface names of callable routines parameters

set in stone modifications require justifications and approvals

returning well-known objects heavily documented online objects can be plugged into applications

proven system agility and performance built web-based clinical info viewer built web-based phone directory back-end redirected to first look into a data cache before attempting a retrieval

Page 20: N(=3) -Tiered Systems

20

Case Study – Data Access Tier

Client-to-client communications (workstation or application) e.g.,

PatientObject can be passed from one application to another. UserSecurity object can be passed

Security Very important (authentication, privileges, etc) Problem: with servers resident on clients,

e.g., can use Excel/VB to interface to COM objects such as PatientLookup. Solution:

DB of authorized applications as well as users Token passing: launched applications receive an ALK (Application Launch Key).

Using ALK, will get an SLK (Server Launch Key) that must match the local server’s SLK, or server will not respond.

Page 21: N(=3) -Tiered Systems

21

Case Study - Application Framework Clinical Application Suite (CAS)

a framework used to house applications merges multiple clinical applications into a single visual and functional context

(GUI) maintains a single CurrentPatient and CurrentUser object across all applications consolidates common system services

e.g. only one connection to PatientLookup objects one GUI for displaying patient fields

button bars along top and down sides launch apps and switch between them

because of its persistence on the screen, CAS provides a constant point of reference for the user

App builders code to the CAS API

Page 22: N(=3) -Tiered Systems

22

Case Study – Results and Conclusions Know your project! The more complex the project is, the more

“hybrid” the solution should be The architecture remains basic in concept (N-

tiered, client/server, RDBMS) Strategy vs. Tactics (Architecture vs. Design) for

the end product as well as the development process

Page 23: N(=3) -Tiered Systems

23

Recap

Reviewed N-tiered systems State of the industry via case study

(legacy systems, hybrid architectures, development process)

Again, modularity, interoperability, separation of responsibilities, etc

Questions?