Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

The Servers

Iosif George Andrei edited this page Jun 19, 2020 · 4 revisions

Description

The server represents the other entity of the structure and it is the destination of packets distributed by the load balancer.

The servers have two cores and the time of processing a packet depends on its load. After every packet from load balancer arrives at a server and it is processed, the server responds with its load, so that load balancer can update its information.

The servers run on virtual machines, having assigned IP addresses.

Screenshots

Server Screenshot

Implementation

The implematation of server can be find in headers/common/CServer.h and headers/common/CServer.c.

The tasks of processing packets are assigned to pseudo-threads. The time of processing is projected to be related to the load of the server. In the formula for estimating the time, it can be found a random for monitoring the composition of the project in a different situation. In the implementation, a packet is processed if the time assigned at delivery reaches the 0 value.

It is important that the server must be turned on before load balancer because they contain a socket connection, like listening connections. This means server sockets do not locate clients, instead, they form passive "half connections" that listen for client requests. Server sockets associate a queue with their listening connections, the queue records client connection requests as they come in.

A server can get from load balancer two types of packets:

  • packet representing a task, sent from the load balancer to servers
  • packet designed to change information between servers and load balancer, sent from the server to load balancer

So, the process in details consists of two principal routines:

  • before the time of processing is set up for the incoming packet, the method do_work() is called in a while() loop which depends on a random.
  • after the old packets' timer is decremented, the timer of the new packet is sent.

Observation: This implementation was chosen from simulating a thread function (pseudo-thread).

How to Build

Also, in Makefile, it is a target to build the servers.

make build_server
Clone this wiki locally