Web Application Infrastructure

Khoa NguyenKhoa Nguyen
3 min read

Web Server

The most obvious piece of equipment required to host a website is the web server itself. A web server if just a piece of software such as Nginx, Apache, or IIS. This can be installed on any company/server and be hosted on the internet. In the most basic setup, this is all that is required to start hosting your own website.

Load Balancers:

When websites start becoming more popular and experience more traffic it gets to a point where one server cannot handle the load and more are required. The traffic load between these multiple servers can be split between them using a device called a load balancer. The load balancer sits in front of the web servers and can equally share the traffic amongst them. They are different algorithms to decide which web server will receive the traffic, some of them are as follows:

Round Robin:

This algorithm has a set pattern, so for example, if you had three servers it would send the first request to one, then two and then three and then back round to one again and keep in this order.

Sticky:

This method makes sure connections are always sent to the same server by using cookies. A useful use case for this algorithm could be for uploading and then editing an image via a website. The first request uploads the image, and then because that server holds the image you need to request the same one again to make sure you still have access to it. The load balancer keeps track of your server with the use of cookies.

Least Connections:

This algorithm monitors how many connections already exist from the load balancers to the web servers and directs any new connections to the least connected web server.

N.B Health Checks:

Load balancers also have health checks, this is a periodic request that the load balancer makes to the webserver which makes sure it is behaving properly. If the load balancer receives a predetermined amount of invalid responses from the webserver traffic will stop being directed to it. Health checks will still continue in the background until the webserver responds correctly and then traffic to it will be reinstated.

N.B Headers:

Sometimes web servers need to keep track of the original client that is connected to them and know information such as the client's IP address. Because the load balancer makes the connection to the webserver this information is lost, to solve this the load balancer adds extra information to the HTTP request being made. The client's IP is often found in a header called X-Forwarded-For.

Web Application Firewall (WAF)

A WAF sits in front of your web server and is used to detect and block malicious traffic. It monitors the contents of each request against pre-determined rules (these rules are usually constantly updated databases of malicious web requests) if a client's request matches any of these rules the request is dropped.

Databases:

When a website needs to store information it can use a database server to hold and process it. Database software can be installed on the same server as the website or on its own unique host. Popular database server software includes MySQL, MSSQL, SQLite, PostgreSQL, MongoDB, Redis and ElasticSearch. These databases fall into two different camps called SQL and NoSQL but we'll explore that in a future module.

0
Subscribe to my newsletter

Read articles from Khoa Nguyen directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Khoa Nguyen
Khoa Nguyen

Mình là người mới bắt đầu tìm hiểu công nghệ đặc biệt về ngành an toàn thông tin. Mình có viết lại các bài blog này để ghi nhớ thêm cũng như nắm bắt các kiến thức. Rất vui vì được chia sẻ với mọi người!