When we speak of web apps like FaceBook or WikiPedia there are several critical layers of code involved in the running of the app. Each layer gives something to delivering the final product we all love and use every day.
In this post I will attempt to explain the important layers involved with running a web app, and briefly highlight what (if any) impact that layer has on a web app’s scalability.
Layered architecture is a term used by many with different models developed to explain different concepts.
For web applications the following layers probably best describe the critical aspects involved in the running of the app:
1) Web Server Layer
The web server layer is usually the first layer to confront an end user’s request to access your web app. It decides if the user has requested the correct resource and then fires up the resource to render what should be shown to the end user.
The web server layer can do a lot. In different organizations a host of different strategies are adopted to deal with traffic concerns. There could, for example, be additional layers added in front and behind the web server layer to manage traffic flows or to deal with security concerns. However, in hopes of not being too heavy with technicalities the web server layer can be seen as the usual gateway for your app: barring and permitting those it deems best!
Typically a web server is written in C++, however we are seeing trends of new web servers being built in higher level languages like NodeJS, PHP, Java, etc. All of this is good to know when thinking of scalability for your web app. In the PHP space, there are some attempts at bringing about pure PHP-based web servers.
The web server layer is where DevOp engineers get involved to develop efficient server setups that can handle scalability concerns when an app starts suffering from latency issues.
Our approach is to focus more on the Backend Application layer and the Database Layer when dealing with app optimization for scalability reasons.
2) Frontend (client-side) Application Layer
Most business people close enough to the technical side of any web project know the term ‘Frontend Developer’; she/he is the person(s) concerned with making the app look good and function well for the end user. The Frontend UI layer is code written in common languages like HTML, CSS and Javascript to deliver good user experiences.
In a way the front-end application layer is unique to the entire web application infrastructure as it is least impacted by increased traffic to a web application. The frontend application runs in the client’s browser, so it doesn’t matter if ten or ten million users access the app.
That said, there are good practices to follow in frontend development as well (e.g. CSS/JS mini-fication), as a good front-end developer will tell you.
3) Backend (server-side) Application Layer
Your technical (and business) team will choose from PHP, Java, NodeJS, Python, .Net or Ruby to develop the backend (server-side) app.
In traditional web apps, the entire business logic of the software would be implemented in this layer; with a view generation component that passed along a final UI display to the client. Modern web apps are being restructured however to make the frontend layer more logic heavy; this reduces the stress on the backend server-side application; though potentially increasing the stress on the web server (with excessive server requests).
The backend application should be inspected for bottlenecks and better resource allocation. Complex backend components of an app can create points of unnecessary strain for the system; guzzling server resources or even putting stress on the database layer.
4) Database Connection Link Layer
This layer is the channel/socket with which the backend application talks to the database. It can be important to look at how the connections to the database are being handled in your app for some scalability projects.
5) Database Layer
The database/data store holds data the web app needs. A typical PHP application employs MySQL as the data store of choice. However there are quite a few data stores out there:
- No-SQL stores:
- Mongo
- Casandra
- SQL database:
- MySQL
- Postgresql
- Oracle
While our expertise lie in MySQL we can definitely talk to you about the various data stores out there (i.e. NoSQL vs SQL) and which ones would be good for your project.
Software developers come from a background not aware of the sophistication of the data layer; great optimizations can be found for your app in this layer! Queries written to the database, DB table design and indexing are all critical to a well tuned app.
6) Operating System Layer
The operating system (OS) is usually chosen based on the backend server-side programming language selected for the web app. Python and PHP code typically runs on Linux family of OS and .NET apps typically run on Windows family of OS.
The OS – much like in the case of your personal computer – allows for a web server to function. All programs on the server require the OS. The OS is typically written in a low level language such as C.
OS and server level infrastructure is important for a scalable web app; DevOp Engineers look at the Web server layer and the server infrastructure (while keeping the OS in mind) when making scalability decisions.
Talk to us about how our expertise fit in with your next scalability project!
By Mustafa Ghayyur,
July 3rd, 2018