03/04/2023
Find out how to improve efficiency in the development of web applications by optimising the backend in this comprehensive article.
When we are asked to implement “super-efficient” web applications, it sounds like a very simple requirement that is just asked for in the specifications.
In this article, we talk about the back-end efficiency of a web application and we will discuss recommendations for achieving heavily used web applications.
Efficiency factors in applications on this end are able to present an optimal user experience, and this requires frameworks that allow us to move views and interact with the components in a fast and agile way.
Back-end efficiency.
Front-end web applications are not published in an App Store or Play Store, but the browser downloads an initial file (usually the index.html file) from a website (URL) and its content retrieves other resources like “.js”, “.css”, “.html”, etc.
Normally, the volume in terms of number of resources and size is high, which leads us to focus on a series of communication factors.
These SPA applications “cry out” for load balancing so they can communicate with the HTTP 2.0 server in order to parallelize the mass download because otherwise the HTTP 1.x protocol will negotiate ridiculous windows of files in parallel.
TIP #1: Optimise the parallel download of front-end resources. The parallel download of a high number of front-end resources can be achieved with load balancers that can negotiate HTTP 2.0.
At CaixaBank, we are working on having a “Content Distribution Network” (CDN) that will distribute these resources according to geographies in order to speed up the download.
TIP #2: Optimise latency times in downloading resources. Setting up “Content Distribution Network” (CDN) servers improves download latency times as they are distributed in different geographical locations.
Efficient web application development: Independent stateless services (API REST).
If you want to prioritise the robustness of the system without losing speed, you must have independent and stateless services that specialize in what they are requested to do in order to respond in the shortest possible time. These applications are known as microservices.
TIP #3: Optimise response times in stateless microservices. Stateless microservices have the following advantages:
- Easy to add new instances
- Avoiding problems and loading times in creating a session for users
- Memory usage (HEAP) is usually lower
- Development more aligned with the DevOps methodology
At CaixaBank, Java has been chosen for the implementation of microservices. The way to implement these microservices is API REST (REpresentational State Transfer).
The definition of API RESTful is based on applying a common interface/standard where there is no state and the inherent semantics of the HTTP protocol verbs are used. The most commonly used are directly related to CRUD (Create, Read, Update, Delete) operations that can be performed on an entity (a project, e.g., “card”). This way of organising the services us means they can be used without requiring a learning time.
TIP #4:Optimise response times in Read (GET) microservices. In the different levels, starting with the browsers when they launch “GET” requests, there is a caching system that prevents the call. This is achieved by correctly defining the API exposed to front-end applications using an API RESTful interface.
Efficient web application development: Layers of microservices.
Usually, the microservices that implement the APIs are organised in three layers or levels in order to provide the system with scalability and flexibility that favours the growth of the set of APIs in an orderly manner. The three layers the web application can interact with are:
- Data API: The minimum functional unit of access to the database that contains the “core” of the entity’s data. In other words, these APIs specialise in obtaining the filtered data from the database based on the input parameters or headers.
- Product API: They present to the web application a product integration with which transactions can be made. They interact not only with data APIs, but also with process systems (BPM – Business Process Management) and with security systems that maintain the integrity of the flow.
- Front-end API: Also known as BFF (Backend For Frontend) APIs. They specialise in integrating/orchestrating data needed by this web application. The main reason for this is efficiency and user experience, since it is more agile to carry out many calls from the backend than from the frontend.
TIP #5:Optimise response times in specialised microservices. By defining different layers, the “divide and conquer” technique is put into action. Where each layer is specialised in a series of functions, maximising efficiency.
Efficient web application development: Cloud computing.
At this point, we have created our microservices and now we need to package them and launch them in the cloud in order to have “unlimited computing capacity” to move away from dependence on hardware and base software. We just need to ask for “more iron” or, in other words, more servers.
What is DevOps?
For this, there is the figure of DevOps, a philosophy (framework, development methodology) that focuses on communications, collaboration and integration between software developers and IT systems professionals.
The most widespread way to implement the DevOps philosophy is through Docker virtual servers managed by the data centre contained in the Kubernetes application.
TIP #6:Optimise response times in microservices with great computing capacity and/or parallel requests. Deploying microservices in the DevOps philosophy allows us to have “unlimited computing capacity and requests” by adding more nodes.
Efficient web application development: Super-efficient services.
There are certain functionalities in web applications, such as a predictive search engine (options added as you type), that require microservices that respond in “crazy” times.
For this, it is necessary to plan to have an ad hoc infrastructure in the data core. And this is where Big Data comes in.
How does the use of Big Data help us?
Applying Big Data in our systems, in terms of efficiency, provides us with microservices that respond “100 times faster” than any core service. This is because prior work has taken place, known as ingestion, in which the search is recalculated quickly to obtain the output data.
TIP #7:Optimise response times for certain consultation services that require it. We can reply on applications that implement Big Data for certain functionalities of the visual interface that require these low response times.
Efficient web application development: Measurement of efficiency in services.
As the slogan goes, “power without control is nothing”. You can have the best hardware, base software and all the rest, but any software is prone to go to production with memory consumption problems, high CPU usage, thread usage problems and memory clean-up problems, such as with garbage collection.
For this, we must have an efficiency measurement strategy. There are many monitoring tools on the market, which are wonderful and can save us from having to do manual analysis of “bottleneck” problems.
These tools usually work by adding an agent on each service node (Docker node) where the API request comes in. This agent works by automatically discovering new services (microservices) and sending the input and output data of the request to the data centre where it analyses using AI whether the service status is optimal or, if not detects any type of incidents:
- Process and node memory usage problems
- High process and node CPU usage
- High micro response times
This type of tool is also able to give us traceability of the request, specifically in all the layers through which it passes.
TIP #8: Optimise response times by detecting incidents in time.
Automated service monitoring becomes necessary when there are many independent microservices. This allows us to quickly detect any problems for minimum impact on clients.
These tools also include an agent for front-end installation and to provide information about user experience in order to identify possible incidents there as well.
Summary of "super-efficient back-end" web applications.
There is a lot of work required behind the scenes, where, as times becomes shorter at all layers, it becomes increasingly complicated and involves more powerful systems and new emerging technologies.
The availability of connectivity is one of those factors that cannot be controlled by development teams. Getting efficient web applications to work in a bunker without connectivity could be covered in a future instalment of this blog. So follow us closely to make sure you don’t miss any news!
tags:
share: