#Golang V4 Proxy TCP-IP Load Balancer Go Implementation
To briefly talk about Load Balancer and its related technologies;
As the number of users increases in current technologies, there are 2 different ways. You increase the existing system or buy new servers etc.
Increasing existing resources means -Scale Out - adding new servers means - Scale Up - current way to grow.
Upgrading the existing system means extra processor and ram. Instead, many companies have chosen to buy new server systems.
As the amount of servers increases, we have new problems. We need to distribute the traffic coming over us efficiently.
We put a load balancer in front of this new server cluster and assign the work to the servers that will do the actual work.
The load balancer not only distributes the load, it scans our existing systems and identifies the systems that cannot be acted upon.
If necessary, it cannot assign processes to the problematic system.
Ok, How is my load balancer?
The main reason for this is that #Go is a system language. It was my choice when writing #Go Load Balancer, which compiles really fast and is a good garbage collection system.
Outside of Go, Python could be done with #Django or #Flask. However, as the load on this system increases, it may give us a headache. I don't want this and the best is to do something in #Go, one of the new world languages, and keep up with the change.
In the project, I will set up a Layer-4 TCP Load Balancer.
This structure will actually act as a proxy.
The purpose of this structure is to send only the connections received from the front end to the servers at the back end.
It will send traffic from the frontend to a randomly chosen backend. Bytes on the LB will be transmitted to the server until the connection is disconnected. Multiple incoming connections at the same time will be handled.
To try the project run python http server, nginx etc. but we using npx packages.
>> npx http-server -p 5001
then we run main.go file
>> go run main.go
then we run main.go file
>> go run main.go
we can use curl
>> curl localhost:8080
Then the system is full capacity, of course only for 3 servers :)
for testing we can run 5001, 5002, 5003 http-servers
>> npx http-server -p 5002
>> npx http-server -p 5003
- For project development, it is possible to switch to http instead of TCP-IP.
- Currently not ideal for use in any living system.
- Concurrency, efficient memory usage etc. Many parts need improvements.
- Many proxy load balancers can be found in Github.
- Adding Github Actions to deploy CI/CD pipelines