The back-end web application is the backbone of the web based software.Whether it is SAAS, Mobile Application or E commerce Application, all these applications are dependent on the back-end web application to send and process the data sent by the front end client application , receive the processed data into the client application.
In this article I am going to discuss about the two key design techniques or issues which slow down the web application.Although the speed of the web application is dependent on several factors, but here I will discuss about the two key design techniques ;
1.Heavily Layered Frameworks or Heavily Layered Software
2.EAV Data Modeling
Heavily Layered Framework or Heavily Layer Software :
Most of the scripting language used for writing web back-ends are either interpreted languages or they run on virtual machines. Python,Ruby,PHP,Perl are interpreted languages whereas the Java uses its own Java Virtual Machine.
Python,Ruby and PHP are the three most popular scripting language used for writing web applications.
As these are interpreted languages , so, whenever a server receives a request to run these scripts , the server passes the scripts to the interpretor of the language to run and process the script.
But , before the script is run and processed , the interpreter of the language goes through the following steps :
1.Scanning
2.Parsing
3.Interpretation
After the above steps have been successfully executed and no error has been reported , the interpreter then executes and processes the script.
Each time a server receives a request to run and process the script, the process of scanning,parsing and interpretation is executed each time.
So, an extra time is consumed to scan,parse and interpret the script.
Now, if heavily layered framework is introduced between the language interpreter and the main script , then what happens is that the interpreter has to do more work . And more work means more time to run and process the script.
And more time means , the client application has to wait more to receive response from the server.
Web frameworks are intermediate applications which support the web development. Although the frameworks enable rapid development and standard coding of web applications , but they slow down the speed and performance of the web application.
Some web apps use third party web frameworks and some have their own heavily layered software.
EAV Data Modeling :
EAV is an acronym for Entity,Attribute and Value. As you know , A web application requires a database server to store the data permanently. Some database servers are SQL database servers and some are NoSql database servers.
In SQL databases , the data is stored in tables . And each table represents a coherent data related to a specific entity. The entity may be employee,product ,sales order or anything else.
Generally the schema for each entity uses flat table structure , that means all the information related to that entity is stored in single table.
As long as the attributes of entity are fixed, flat table structure is good. But, when an entity has variable attributes then it unnecessarily creates the length of the table structure.
And this is where EAV data modeling comes to the rescue for data modeling of variable attribute entity data modeling.
Example : product table
Suppose there are three products . Shirt,book,mobile
The common attributes of “Shirt,Book and Mobile” are :
product_id
product_name
product_description
category_id
But, there are some attributes which are not common to “Shirt,Book and Mobile”
A Shirt has :
size
color
A Book has
genre_id
author_id
no_of_pages
A Mobile has
processor_id
speed
internal_memory
external_memory
front_camera_pixel
back_camera_pixel
wifi
bluetooth
If a single table is used to store all types of products , then the table will like below :
product_id
product_name
product_description
category_id
size
color
genre_id
author_id
no_of_pages
processor_id
speed
internal_memory
external_memory
front_camera_pixel
back_camera_pixel
wifi
bluetooth
When information about Shirt is stored in this table then the fields which are unused are ;
genre_id
author_id
no_of_pages
processor_id
speed
internal_memory
external_memory
front_camera_pixel
back_camera_pixel
wifi
blootooth
When information about Book is stored in this table then the fields which are unused are ;
size
color
processor_id
speed
internal_memory
external_memory
front_camera_pixel
back_camera_pixel
wifi
blootooth
When information about Mobile is stored in this table then the fields which are unused are ;
size
color
genre_id
author_id
no_of_pages
To avoid this , some developers use EAV data Model where two or more tables are used to store information related to the product.
Example
Product Table
product_id ,product_name ,product_description ,category_id
1, Shirt ,Cotton Shirt, 1
2, Learn ABC in 2 Days, Learn ABC in 2 Days, 2
3, ABC Mobile, ABC Mobile, 3
Attribute Table
attribute_id, attribute_name
1, size
2, color
3, genre
4, author
5, processor
6, speed
Value Table
product_id, attribute_id, value
1, 1, 40
1, 2, Green
2, 3, Fiction
3, 4, XYZ
This is how EAV data model is used to store different types of products with different attributes.
But as you can see that three tables are used , it requires a complex SQL query to retrieve presentable data.And this complex query takes considerable amount of time to process and return the results.
The time to process the query is not evident when products are less , but when product listing increases then the query takes the time to process and return the results.
Thus, you can see that how and why two key design techniques slow down the web app.
There are some e-commerce softwares which use this EAV data model.Whereas some don’t.
The purpose of this article is not to discourage you from using Web Frame Works and EAV data model.But to inform you that how these two things play an important role in deciding the speed of your web application, and help you make an informed decision.
Now, The question is , What is the substitute for these two design techniques ?
There are many alternatives and options, from selecting the software to selecting the language for development to selecting the database servers.