Load Balancer

A load balancer is essentially a reasonably simply concept where in order to handle heavy traffic, traffic is diverted to many multiple copies of the same app. This allows for easy horizontal scaling

Initial Performance

First, sudo apt-get update

then sudo apt install nginx

run sudo systemctl start nginx (this will start nginx)

sudo vim /etc/nginx/sites-enabled/default

Paste something similar to this



upstream sdcgroup {
least_conn;
keepalive 500;
server <one instances public ip>:<your api port>;
server <another instances public ip>:<your api port>;
}

server {
listen 80 backlog=4096;

location /<your api endpoint> {
proxy_http_version 1.1;
proxy_pass <http://sdcgroup>;
}

location /loaderio-95196c056520a04c106a81f0501ef836 {
return 200 'loaderio-95196c056520a04c106a81f0501ef836';
}
}

sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

sudo systemctl restart nginx

End Performance

Other things learned

Within vim text editor :1,$d will delete all text within a document

bash .sh can run the ubuntu app

example: bash deskspace.sh

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store