Client Server Architecture and Database Servers
In client server architecture the database server owns the data and answers requests, while clients ask questions. Understanding what the server keeps and what the client keeps explains most design choices above it.
-
DBMS Fundamentals
- Data, Information and Databases
- What a DBMS Is and Why It Exists
- File System versus DBMS
- Advantages and Limitations of a DBMS
- Database Users and the Role of the DBA
- Three Level Architecture and Data Abstraction
- Logical and Physical Data Independence
- Schema, Instance and Metadata
- Database Applications and the Database System Environment
- Database Architecture
- Data Models
-
ER Model
- Entities, Entity Sets and Entity Types
- Types of Attributes in the ER Model
- Keys in the ER Model
- Relationships, Relationship Sets and Degree
- Cardinality and Participation Constraints
- Strong and Weak Entities
- Drawing and Reading ER Diagrams
- Extended ER: Generalisation, Specialisation and Aggregation
- Converting an ER Diagram into Relational Tables
- ER Design Projects
- Relational Model
- Relational Algebra
- Functional Dependencies
-
Normalisation
- Why Normalisation Exists: Anomalies and Redundancy
- First Normal Form
- Second Normal Form and Partial Dependency
- Third Normal Form and Transitive Dependency
- BCNF and BCNF Decomposition
- 4NF, 5NF, Multivalued and Join Dependencies
- Lossless Decomposition and Dependency Preservation
- Complete Worked Normalisation: Unnormalised to BCNF
- Denormalisation and When to Use It
Concept
Client server architecture splits a system into a process that provides a service and processes that consume it. In a database system the database server owns the stored data, the catalog, the locks and the log; the client owns nothing but the question it wants answered and the answer it receives.
Architecture
CLIENTS SERVER
+-------------------+ +----------------------+
| request | connect | listener |
| driver / library |==========> | session per client |
| receives rows |<========== | parser + optimiser |
+-------------------+ results | execution engine |
| buffer pool |
+-------------------+ | lock manager |
| another client |==========> | transaction manager |
+-------------------+ | log writer |
+----------+-----------+
|
+------v------+
| data files |
| log files |
+-------------+What the server is responsible for
| Responsibility | Why it must be on the server |
|---|---|
| Storing the data | One authoritative copy, or the whole idea collapses. |
| Parsing and optimising | Only the server has the catalog and the statistics. |
| Executing | Only the server can reach the data files. |
| Concurrency control | Locks must be held in one place to mean anything. |
| Transactions and logging | Atomicity needs a single log that survives client crashes. |
| Authentication and privileges | A client cannot be trusted to check its own permissions. |
| Enforcing constraints | Rules must apply to every client, including new ones. |
What the client is responsible for
- Opening a connection and authenticating.
- Sending a request and receiving results.
- Presenting the result to a person or passing it to other code.
- Deciding when a transaction begins and ends.
Anything a client enforces is a suggestion, not a rule. Client side validation improves the user experience; server side constraints are what actually protect the data. Say both halves in an interview.
Connections, sessions and pooling
| Term | Meaning |
|---|---|
| Connection | An open channel between a client and the server. |
| Session | The server side state for one connection: current database, transaction, temporary objects, variables. |
| Connection pool | A small set of connections kept open and shared by many logical users. |
| Idle connection | Open but doing nothing. Still consumes server memory and a slot. |
| Max connections | The server limit. Reaching it is a classic production outage. |
WITHOUT POOLING WITH POOLING
2,000 users 2,000 users
2,000 connections 20 pooled connections
2,000 sessions of memory 20 sessions of memory
connect + authenticate connections already open,
on every request so no setup cost per request
Opening a connection is expensive: a network round trip,
authentication, and server memory allocated for the session.
Pooling removes that cost from every single request.Two kinds of client server split
| Fat client | Thin client | |
|---|---|---|
| Where logic runs | On the client | On the server or an application server |
| Data moved | More — raw rows pulled to the client | Less — the server returns only the answer |
| Deployment | Install and update on every machine | Update in one place |
| Network sensitivity | High | Lower |
Example
"Total fees collected this month"
FAT CLIENT approach
client asks for every payment row this month
server sends 240,000 rows across the network
client adds them up
-> slow, and the network did most of the work
THIN CLIENT approach
client asks the server for the total
server reads the rows locally, adds them up
server sends ONE number
-> the rule: move the question to the data,
not the data to the questionCommon mistakes
- Validating only on the client. Any other client, or a direct connection, bypasses it entirely.
- Opening a connection per request and never closing it. The server hits its connection limit and refuses everyone, including the administrator.
- Pulling rows to the client to filter or aggregate them. Filter and aggregate where the data is.
- Assuming client server means exactly two machines. It is a role split, not a machine count. One machine can host both.
Exam and interview questions
- Draw the client server database architecture and label the server side components.
- List five responsibilities that must stay on the database server, with reasons.
- What is a connection pool and which specific cost does it remove?
- Differentiate a fat client from a thin client.
- Why is client side validation insufficient for data integrity?
Practice
- List four pieces of state the server keeps for one session.
- An application opens a connection per request and closes none. Describe what fails first and what error users see.
- Rewrite the fat client fee example as a single server side request and explain the network saving.
Conclusion
The server owns the data, the catalog, the locks, the log and the rules; the client owns the question and the presentation. Keep enforcement and aggregation on the server, pool the connections, and most client server problems never appear.