Last Updated on March 2, 2023 by Prepbytes
In this article, we will discuss what is database system architecture, and the types of DBMS architecture. We will also look at the differences between two-tier and three-tier architectures, and deadlock in DBMS.
What is Database System Architecture?
Database System Architecture refers to the overall design and organization of a database management system (DBMS), including the hardware, software, data, and personnel components. It defines the way data is stored, processed, and retrieved from the database. It encompasses the physical and logical design of the database, as well as the interactions between different components of the system.
There are various types of database architecture, such as single-tier, two-tier, three-tier, and n-tier architecture. The choice of architecture depends on factors such as the size of the database, the number of users, the type of applications that will be accessing the database, and the level of security and scalability required.
The architecture of the database can be viewed as a logical model or a physical model –
Logical model: This model describes the data and relationships within the database in terms of entities, attributes, and relationships. It provides a high-level view of the data and the relationships between data elements and is typically represented using an entity-relationship diagram (ERD).
Physical model: This model describes the physical design and implementation of the database. It includes information about the storage structures, indexes, and access paths used to store and retrieve data. The physical model also includes details about the hardware and software components used to support the database.
Both the logical and physical models of a database are important to consider when designing a database management system. The logical model is used to determine the structure of the data and the relationships between data elements, while the physical model is used to determine how the data will be physically stored and retrieved.
Database architecture in RDBMS is based on the relational model, which uses tables to store and manage data. The database architecture of an RDBMS consists of the following components:
- Database: A collection of related data stored in tables.
- Tables: A collection of records (rows) and columns (attributes) that represent the data in the database.
- Attributes: The columns of a table that represent specific characteristics or properties of the data.
- Records: The rows of a table that represent individual data elements, and are made up of values for each of the attributes.
- Primary Key: Each record in a table has a unique identifier.
- Foreign Key: A key that links records in one table to records in another table, representing a relationship between the data.
- Indexes: Structures used to speed up data retrieval by allowing the database to quickly locate specific records in a table.
- Query language: A language used to retrieve data from the database, such as SQL (Structured Query Language).
- Transaction management: A component that ensures data consistency and reliability by managing changes to the database as a single unit of work.
In DBMS architecture, in RDBMS, the database and its components are stored on disk and managed by the RDBMS software, which provides facilities for adding, updating, and deleting data, as well as searching and retrieving data based on specific conditions.
Types of DBMS Architecture
Let’s have a look at the most common types of DBMS architectures:
- 1 Tier Architecture (Single Tier Architecture)
- 2 Tier Architecture
- 3 Tier Architecture
1 Tier Architecture
The most basic DBMS architecture is the 1-tier DBMS design. All DBMS components are placed on a single server or platform, which means that the database is directly accessible to the end user. Because of this direct connection, the DBMS gives a quick response, which is why programmers frequently adopt this design to improve local applications.
Any edits made by the client are reflected directly in the database in this structure, and all processing is done on a single server. Furthermore, no network connection is required to execute database tasks. Another name for this database management system is the local database system.
A 1 tier architecture is suitable when:
- The information is not updated frequently.
- The database system is not being visited by many users.
- We need a straightforward and simple means to edit or access the database for application development.
Advantages of 1 Tier Architecture
Below are a few advantages of 1 tier architecture:-
- Simplicity: Single-tier architecture is simple to set up and maintain, as all components are on a single machine.
- Low Cost: Single-tier architecture does not require additional hardware or software, making it a cost-effective solution for small or personal databases.
- Easy Deployment: Single-tier architecture can be deployed quickly and easily, making it a good choice for small projects.
2 Tier Architecture
2 tier architecture in DBMS refers to a client-server architecture where the user interface and the application logic are separated into two separate components. The client component is typically the user interface and the server component is responsible for handling the data and business logic. In this architecture, the client component communicates directly with the server component to request data and perform actions.
2 Tier Architecture Examples
A few 2 Tier Architecture examples are:-
File-Server Architecture: A client accesses a shared file server for data storage and retrieval.
Client-Server Architecture: A client communicates directly with a database server for data storage and retrieval.
Terminal Services Architecture: A client communicates directly with a terminal server, which then communicates with a database server for data storage and retrieval.
Web-Based Architecture: A web browser communicates directly with a web server, which communicates with a database server for data storage and retrieval.
Remote Procedure Call (RPC) Architecture: A client communicates directly with a database server using remote procedure calls for data storage and retrieval.
Advantages of 2 Tier Architecture in DBMS
Below are a few advantages of 2 tier architecture in DBMS:-
Simplicity: Two-tier architecture is simple and easy to understand, as it involves only two components: the client and the server.
Cost Effective: Two-tier architecture is less expensive to implement and maintain compared to three-tier or multi-tier architecture.
Ease of deployment: The client software can be deployed on individual workstations, making it easier to manage and update.
Direct Access to Database: The client has direct access to the database, allowing for fast data retrieval and update.
Client-side Processing: Some processing can be done on the client side, reducing the load on the server and improving performance.
Scalability: The architecture can be easily scaled by adding more clients or upgrading the server hardware.
Independence: The client and server can be developed and deployed independently, which can improve the overall development process.
Another layer exists between the client and server in the 3-Tier architecture. The client cannot communicate directly with the server with this design.
On the client side, the program communicates with an application server, which then communicates with the database system.
Beyond the application server, the end-user has no knowledge of the database’s existence. Aside from the application, the database has no knowledge of any other users.
In the event of an extensive web application, the 3-tier design is used.
Three-Level Architecture of DBMS
3-tier architecture divides the complete system into three levels as shown below:
- Physical Level: Information about the location of database objects in the data store is preserved at the physical level. Several DBMS users are unaware of where these objects are located. In simpleton’s words, the physical level of a database specifies how data is kept in secondary storage devices such as discs and tapes.
- Conceptual Level: Multiple database tables represent data at the conceptual level. It determines what type of data will be stored in the database and is also known as the logical schema.
- External Level: An external level defines a view of the data in terms of conceptual level tables. Each external level view is designed to meet the demands of a specific user group.
As a result, separate views can be created for different users. The external level’s primary focus is data abstraction.
Advantages of 3-Tier Architecture
Below are a few advantages of 2-tier architecture:-
- Scalability: The architecture can be easily scaled by adding more servers or upgrading existing servers, improving performance, and ensuring high availability.
- Increased Security: The three-tier architecture provides a clear separation of responsibilities, which makes it easier to secure data and control access to the database.
- Improved Maintenance: The architecture makes it easier to maintain and upgrade the system, as changes can be made to one tier without affecting the others.
- Reusability: The business logic can be centralized in the application tier, making it easier to reuse and share across different applications.
Difference between Two Tier and Three Tier Architecture
The key difference between two tier and three tier architecture are:
- Number of Layers: 2-tier architecture has two layers (client and server), while 3-tier architecture has three layers (presentation, application, and database).
- Middleware: 2-tier architecture does not have a separate middleware component, while 3-tier architecture includes an application layer as a middleware component between the client and the server.
- Scalability: 2-tier architecture is less scalable than 3-tier architecture because the application server in 3-tier architecture can handle a larger number of clients and complex processing.
- Maintenance: 2-tier architecture is simpler to maintain than 3-tier architecture as it has fewer components, but it can also become a bottleneck as the number of clients and the complexity of the system increase.
- Security: 3-tier architecture provides better security as the middleware component can enforce security policies and hide sensitive information from the client.
In summary, 3-tier architecture is more flexible, scalable, and secure than 2-tier architecture, but it is also more complex and requires more maintenance. The choice between 2-tier and 3-tier architecture depends on the specific requirements of the project.
Deadlock in DBMS
A deadlock in DBMS (Database Management System) is a situation where two or more transactions are waiting for each other to release locks, resulting in a standstill. Deadlocks occur when multiple transactions have locked resources and are waiting for the other transactions to release their locks. This creates a cycle of waiting, where each transaction is waiting for a resource another transaction holds.
For example, consider two transactions, T1 and T2, each requiring two resources, R1 and R2. If T1 acquires locks on R1 and R2, and T2 acquires locks on R2 and R1, a deadlock will occur as each transaction is waiting for the other to release its lock on R2.
To prevent deadlocks, DBMSs use various algorithms, such as the Wait-Die and Wound-Wait algorithms, to detect and resolve deadlocks. These algorithms monitor the state of the transactions and release locks when necessary to avoid deadlocks. Deadlocks can also be prevented by using timeouts, where a transaction is automatically rolled back after a specified time if it has not been able to acquire all required locks.
- DBMS architecture outlines the structure and how users are connected to a certain database system.
- The database’s performance is influenced by its architecture.
- All DBMS components are housed on a single server in a single-tier architecture. It’s the most straightforward method.
- The client-server model is used in the two-tier architecture.
- The three-tier DBMS design is an expansion of the two-tier architecture that includes an intermediate layer, the Application layer, between the client and the server. It is the most common type of architecture.
- Deadlock is an undesirable state that grinds the entire system to a standstill since no task is ever completed and is stuck in a waiting state indefinitely. If any of the transactions have the potential to cause a deadlock, that transaction is never completed.