Backend Layer
In previous article, we saw based on whatever business logic is the entire information of data processing is stored in database. In some companies or project this information or part of that information is further analyzed, which can have several purposes.
For example, Amazon will analyze customers of which region, during which month, what type of products
they buy, or what type of products are purchased by customers of which age group or maybe user browses
or buys which type of products.
And you will have noticed that you get suggestion based on your purchase history.
Let's take another example of YouTube.
You watch one music video and then on your home page of YouTube, you can see suggestions of songs by
the same singer or songs in that same language or songs of the same genre.
This means someone, somewhere is analyzing your browsing history and based on your taste, they are
giving you suggestions. This can happen only when your browsing data is stored.
Whether analysis is done manually or some artificial intelligence is used, it can happen only when
the user experience data is stored.
This type of suggestion is given to all different users based on their activity.
This means some process is repeatedly collecting information.
Let us look into detail how it happens.
First of all, the user experience data needs to be collected for further analysis.
This will be done by scheduler. Several big applications, also use scheduler for some type of activity
which is common for all consumers.
For example, e-mail from bank after you complete your transaction. Sometimes you receive email within
a minute and sometimes it takes a little longer.
Why does it happen so?
Banking software applications will have a microservice for sending e-mails.
This microservice does not function each time when a customer completes the transaction, but because
for every individual user, this micro service will be invoked, which can result in slower performance
and backlog.
Usually it's run with a schedule.
The customers who completed transaction, their information will be stored in a database, scheduler will
pick those customer details based on the DB stored,
accordingly then send an e-mail. This scheduler is designed to run at a defined frequency 24*7
.
This is the reason it may happen that sometime your transaction completed when scheduler was about to
run and you receive the email quickly.
But sometime there was a delay in between your transaction completion time and next schedule run of
the e-mail scheduler.
This example is just to explain you how scheduler works.
The information sending back to customers is either done through same flow in which data is received
or depending upon the architecture.
These scheduler are always associated with a batch job which will have the frequency of running the scheduled
job under a defined period of time.
The batch job will collect data and send it to filesystem, where it will upload the file of information
after collecting from the scheduler or this batch job may connect to a database where it will store data.
Storage of data in database or file system will depend upon how your batch job is defined to function.
As we have discussed earlier in our previous example, that scheduler may also be used to
send notification to customers based on data it has processed, the notification can be in form of e-mail
or text message.
This batch job after completing the data.
Or after collecting the data I'm sorry, after collecting the data in database or file system, it may
also generate a report for further use by another application or artificial intelligence to analyze.
And as we discussed in our example earlier, to provide suggestion to the customer based on browsing
history. Thus to summarize the backend job runs in a schedule to perform a repeated task again and
again in a predefined frequency. It can perform several functionalities like collecting the data in
a file system or database or send it as a report through e-mail or upload the data at a
SharePoint.
This data is analyzed and used for several purposes, like business expansion, improve customer experience,
advertising, etc..
Thus so far, we have understood that an application will have different layers, which will work together
to serve a business purpose.
Now we will look at a few examples of applications we use in our day to day life and try to relate its
functionalities from SRE point of view.