6 Most Common Backend Questions and Answers for Beginners, Explained! [PART 1]
Intro to backend questions and answers for beginners
In this article, I gathered 6 the most common and exciting questions about backend development, and I’d like to answer them and explain them one by one.
Those questions mostly cover tools used in backend development, databases, and architecture, so if you just start learning about backend and plan your backend career. It’s a great idea to go through those questions and understand the essentials you’ll need.
On this list, you can find an explanation of topics like microservices architecture, relational and non relational databases, NGINX, apache web servers, and reverse proxy.
This knowledge may be beneficial when you start building your own project. In the beginning, it’s not easy to decide what you need to use to set up everything, which database would be better, how you should structure the project and what kind of architecture will be the best solution. Besides that, in every company there are some tools used in the project that you should know as a backend developer.
As always, I’ve got a videos for those who prefer to watch then read the content. Under each of the questions you’ll find a simple video with explanation of the each topic.
Are you ready to start?
What is Microservices Architecture - tutorial?
Until now, the most popular way to develop applications was to build with the monolithic approach, which means that the UI and the data access code are combined together in a single software on a single platform. But when applications started to grow and became more complexed, developers began to use the microservices architecture, where the application is structured as a single-function module connected together. Let’s get a closer look at the difference between the microservices architecture and the monolithic approach, and let’s check what benefits and drawbacks can microservices architecture bring.
In the image below, you can see the visualized difference between the microservices architecture and the monolith application. Microservices application consists of the few single services independent from the UI layers, and connect with it by the API gateway. Microservices are kind of separate applications, with their own database, and they can be connected to each other.
The main benefits of using microservices architecture are:
- simple deployment, only the changed part of the software is affected by the deployment, so if something went wrong, just a part of the backend wouldn’t work;
- simple to understand, debug and modify, because if the software’s functionalities are divided to a single function, it’s much easier to understand it, find existing bugs and fix them, or add new features, then when it’s connected to the other parts of applications;
- reusable across the business, imagine that one microservice of the application, we are building for the corporate system is user login and registration, it can easily be reused in other applications;
- ability to change easily, if there is another technology that developer would like to use in a project, there’s no need to rebuild whole application at once;
- better scalability, it’s possible to scale up only the services that require that and scale down the services that don’t require a big space, which can affect the cost of the application;
Like everything, even the microservices have some drawbacks, so let’s see come of them: - the complexity of the architecture, even though during the building application it can be easier to understand and divide the task between the team, in the end, it can be much more complicated, with much more components and interconnections; - information barriers, while the application grows and has a lot of services. It can be difficult to handle information sharing, so developers have to put additional effort to implement a communication mechanism; - possible security issues, due to the multiple services and connecting them together there may occur some challenges with the security of our application;
Microservices architecture has many advantages over the monolithic architecture, but it has to be planned carefully so it won’t make issues in the future.
What is relational database?
A relational database is an organized collection of data, where we can create relations between the certain point of the data. The relational database is often organized by tables, which consist of the columns with data attributes. Each row of the relational database table holds a record of the data with the unique identifier; most often, it’s id. Each record assigns the value to the attribute.
In the relational database, we can keep thousands or millions of data records.
Relational databases use SQL (Structured Query Language), to read, store, update, and delete the data from the database. SQL syntax is very similar to plain English language, so it’s not very complicated to use.
Relations in the relation database are set between the different tables, established based on the interaction between those tables.
Let’s take a look at the visual representation of the tables models, connected by the relation to the other table model.
In the image above, you can see the models of the three tables: users, posts, and comments. Users are related to posts and comments by id, wherein the posts and in a comment, it’s the author_id. Then posts and comments are related by the post_id.
It allows developers to get the data of the author of the post without saving it again the post table, just by asking for the data of user by user id from the users’ table.
What is Relational Database Management System (RDMS)?
Relational Database Management System is a software that allows managing the database by creating, updating, and administrating the relational database. The most popular ones are:
- MySQL - mostly used with PHP websites, integrated with WordPress;
- OracleDB - mostly used with a huge amount of data in large applications, often used in banking;
- PostgreSQL - open-source database, easy to use and inexpensive, can handle big amounts of data, but it can be a little slower in performance than MySQL;
The most important question you might ask before starting a new project is which type of database you should use, relational or non relational. Here are some benefits of using the relational database:
- data can be easily categorized and sort, so later it’s easy to query filtered information;
- data is accurate, which means it’s stored just once and you can avoid the duplicating information;
- relational databases are secure because the access can be limited to specific users;
- the flexibility of getting data, even with a little more complicated queries;
Based on the benefits listed above, I could easily say that relational databases are a great solution for big projects, with large amounts of structured data.
What is non relational database?
Now you already know the relational database, but there is also the other type, the non relational database, also called NoSQL databases. A non relational database is a database that doesn’t follow the tabular schema with rows and columns. There are four categories of grouping data in non relational databases:
key-value stores - data is collected as a key-value pair. It allows the horizontal scaling, which is impossible with different databases. The most popular use cases for this kind of non relational database are gaming or IoT.
graph stores - those types of databases are used to build applications that work with the highly connected datasets. The most popular use cases of this type of database are social networking apps, recommendation apps, and fraud detection.
column stores - in those NoSQL databases, data is collected similar to a relational database, by columns and rows, but the difference is that in non relational databases the names and formats of the columns can be changes from row to row in the same table.
document stores - those are the databases where the data is stored in the file in a JSON format. The best cases to use document non relational database are projects with big data and real-time applications.
The most popular NoSQL databases are MongoDB, DynamoDB, ElasticSearch, Cassandra. The biggest benefits of using the non relational database are simplicity of the design, developers don’t have to care about the proper relations between the data in the tables and speed, because operations in NoSQL databases are much faster.
What is NGINX - tutorial for beginners?
NGINX started to be known as an open-source web server, but now it’s also used as a reverse proxy, HTTP cache, and load balancer. As a web server, It was designed for maximum performance and stability.
To make it simple and understandable, let me explain how the web server works. When you try to open a website, the browser sends a request to the server, then the server looks for the requested sources and returns it to the browser. Of course, requests are usually much more complicated.
The process described above is a single thread, and usually, the web server creates a thread for every request, but NGINX makes it a different way.
NGINX manages similar threads as a one process worker, and each process workers have smaller units, called worker connections. Process connections deliver the request to the worker process, and the worker process delivers it to a master process, and the request is returned to the browser.
NGINX can process thousands of requests.
Let’s visualize the usage of NGINX in the application.
What is Apache Web Server - tutorial for beginners?
The older brother of NGINX is Apache Web Server. It’s one of the most popular ones and a very old web server, as it exists for about 25 years.
Like other web services, Apache performs the behind the scenes actions that return the website from the server to the browser.
When the user opens the browser and enters the website’s address, he would like to see the request is sent to the server, and the server returns the proper resources to the browser. Apache is the software that takes part in the process and proves a smooth and secure HTTP communication between those two parties.
Apache has a modular structure and is highly customizable. Server admins can turn on and off the web server’s additional features, and custom server configuration can be set through the .htaccess files.
The main disadvantage of the Apache Web Server is performance issues when the website has very heavy traffic.
The other web services that can be used are NGINX or Tomcat Apache.
What is reverse proxy and how it works?
I think that at first, I should explain what proxy is, also called the forward proxy. Let’s take a look at the visualization of the forward proxy.
In this image, you can see how the communication with the forward proxy looks like. The request is sent from the client, and then the request takes over the proxy server, which communicates with the servers to get the data and send them back.
There are a few reasons why the forward proxy can be used.
First of all, it’s used to avoid browsing restrictions, for example, companies sometimes limit access to the internet, and the proxy can be used to overcome it.
The second idea is why the forward proxy may be used to stay anonymous on the internet because when we send the request through the proxy, the only visible IP is the one form the proxy server.
Now, let me explain what the reverse proxy is, and for that, let’s take a look at the other graphic.
In the case of the reverse proxy, the proxy server is between the network and the application origin server with data. When the client does a request, it’s sent to the network, and then it’s grabbed by the reverse proxy server, then the request sent to the origin server, and the response is returned. The main advantages of using the reverse proxy server are:
- preventing the attacks like DDoS, because the attackers won’t be able to hit the origin servers of the application, just the proxy server;
- helps in caching content;
- provides the SSL encryption;
- can help to distribute the requests to multiple origin servers;
- can add basic HTTP access authentication to a web server that doesn’t have one.
There exist the third-party reverse proxy servers like Cloudflare.
In this article, I answered the most essential questions for backend beginners. We went through subjects like microservices architecture, relational and non relational databases, NGINX, Apache web server, and reversed proxy.
In learning backend programming, not only the programming language matters. As a backend developer, you need a lot of knowledge about the tools, and servers, to be able to build good quality and secure software.
I hope you’ll find this information useful and explained easily. All that information can be very useful in planning and building your future applications.
Thank you for reading,
Anna from Duomly