Learning Objectives
By the end of this chapter, you will be able to:
- Group architectures by tiers and state what lives in each.
- Compare 1 tier, 2 tier, and 3 tier on users, security, and scale.
- Distinguish centralized and distributed and choose for a cooperative.
- Price a DR copy in NPR dated BS 2081.
How the table is reached
Siddhartha has a server in Butwal, branches in Sunwal and Bhairahawa, and a member app. The same Member table must serve a teller in Butwal and a backup site if Butwal goes dark. Architecture maps who talks to what through which layer.
flowchart TB
T[Teller and phone] --> APP[App server: auth, VAT logic]
APP --> DB[(DBMS: Member, Account, Transaction)]
DB --> DR[(Replica: disaster recovery)]
Tier count is hops to the table. Placement is where copies live.
Framework 1: Tiers, grouped by separation
A. One tier, all on one machine
App and database on one laptop. Single user work. A shopkeeper runs Access on one PC.
| Fit | Good for | Fails when |
|---|---|---|
| Local prototype | One user, one branch | Second branch needs same member |
B. Two tier, client talks to server
Client holds screen, database holds tables on a LAN server. Five PCs query one MySQL over LAN.
| Fit | Good for | Fails when |
|---|---|---|
| Small LAN app | Tens of users on one site | Internet users arrive, rule change needs reinstall |
Business rule lives partly in client. VAT 13 percent change needs update on every PC. Security leans on each client holding the password.
C. Three tier, middle carries rules
Presentation in browser or app, logic on app server, data on database server. Client never touches DBMS directly. eSewa and Daraz work this way.
| Tier | Lives on | Holds |
|---|---|---|
| Presentation | Browser, app | Screens, input check |
| Application | App server | Auth, VAT maths, NRB checks |
| Data | Database server | Tables, keys, replica |
Why move to three tier: only app server holds DB credentials, rules live once so rate change is one deploy, and scaling adds app servers.
| Aspect | One tier | Two tier | Three tier |
|---|---|---|---|
| Hops | Zero, same box | One direct | Two via app server |
| Who may reach DB | File owner | Client app | Only app server |
| Scale | One user | Tens on LAN | Thousands over internet |
| Rule change | Edit file | Reinstall every client | Redeploy middle |
| Internet | None | LAN only | Yes |
Framework 2: Placement, grouped by where truth lives
A. Centralized, one site holds truth
All rows in one center. Branches query over network. Admin is simple, consistency strong.
- Plus: single audit trail for IRD.
- Minus: single failure pauses all branches.
B. Distributed, many sites act as one
Rows split by key across sites yet app sees one logical database. Replication copies rows for reads and failover. Horizontal partition splits Members by Branch. Central with replica is the balanced BBA choice for three branches that need one VAT number.
| Placement | Rows live | Failure | Complexity |
|---|---|---|---|
| Centralized | One site | Site down pauses all | Low |
| Distributed partitioned | Partitioned by branch | One partition down, its rows unavailable | High |
| Central with replica | Central plus DR copy | Replica takes over | Medium |
flowchart LR
DB[(Primary: Butwal)] -->|replication| REP[(Replica: Pokhara)]
B1[Sunwal] --> DB
B2[Bhairahawa] --> DB
APP2[Member app] --> DB
Nepal worked example: tiers plus replica on BS 2081-09-18 (NPR)
Siddhartha serves 40 tellers and 2,000 app users. Option A two tier on LAN server: server Rs 85,000, UPS Rs 18,000, LAN Rs 22,000, backup Rs 12,000 = Rs 1,37,000. Rule change needs five PC updates at Rs 1,500 each = Rs 7,500 per change, three changes a year = Rs 22,500 plus downtime.
Option B three tier with app server plus central DB plus warm DR in Pokhara: app VPS Rs 2,800 a month = Rs 33,600 a year, DB server Rs 85,000, UPS Rs 18,000, DR VPS Rs 1,800 a month = Rs 21,600 a year, domain and TLS Rs 6,000, DBA Rs 60,000 a year. Year one = 85,000 + 18,000 + 33,600 + 21,600 + 6,000 + 60,000 = Rs 2,24,200. Year two run = 33,600 + 21,600 + 6,000 + 60,000 + 12,000 = Rs 1,33,200.
Proof on 2081-09-18: manager changes fee Rs 180 to Rs 200. Three tier changes once on app server, all users see new rule in ten minutes. Two tier missed one PC, two counters charge old fee for a day. Gap = 46 x Rs 20 = Rs 920, VAT gap = 920 x 0.13 = Rs 119.60 plus one NRB query because totals do not tie. Replica gives four hour recovery if Butwal loses power.
Self-check
Try this: choose and price (calculable)
- Which tier fits a public app that must hide DB credentials and allow one deploy for VAT change?
- Two tier needs five PC reinstalls at Rs 1,500 each per change and three changes a year. Compute annual labour.
- For 2081-09-18 build above, compute year one gap versus two tier Rs 1,37,000 and year two run gap. State benefit that justifies premium.
- IRD asks VAT on Rs 1,80,000 at 13 percent. Compute output. Then branch split if Butwal Rs 1,10,000 and Sunwal Rs 70,000.
Answer sketch
1. Three tier. Only middle holds credentials, rules once, app servers scale. 2. Labour = 5 x 1,500 = 7,500 per change. Annual = 22,500. 3. Year one gap = 2,24,200 - 1,37,000 = 87,200 premium. Year two run = 1,33,200 versus about 34,500 for two tier power and support. Premium funds remote access and DR. 4. Output = 1,80,000 x 0.13 = 23,400. Butwal = 14,300, Sunwal = 9,100, sum = 23,400.Summary
- One tier is local, two tier adds LAN server but locks rules in clients, three tier adds middle that holds rules and credentials.
- Centralized is simplest to audit. Central with replica balances audit and continuity for three branches.
Key Takeaways
- Count hops for tier, sites for placement.
- Hide DB behind app server for public apps.
- One rule change in middle, not on every PC.
Exercises
Short answer
- Compare one, two, and three tier on hops and security.
- Differentiate centralized and distributed for a cooperative.
- What does warm DR protect that nightly disk alone does not?
Long answer
- Compare two tier Rs 1,37,000 with three tier plus replica Rs 2,24,200 year one. Show Rs 22,500 labour and Rs 119.60 VAT gap.
- Explain three tier plus centralized with replica where auth and VAT live and how failover keeps day book open.


