- Overview
- Features
- Architecture
- Getting Started
- Heartbeat Mechanism
- Handling Failures
- Diagrams
- Contributing
- License
The SmartLoadBalancer is a robust load balancing system that optimizes server traffic distribution through a two-way communication mechanism known as the "heartbeat tactic." It tracks the health of all available servers and routes requests based on server availability, ensuring enhanced system performance and reduced maintenance burdens.
- Health Monitoring: Continuously tracks the health of backend servers.
- Dynamic Routing: Routes requests to available servers based on real-time status.
- Passive Redundancy: Uses Kafka for checkpointing and data communication to handle server failures.
- Failure Handling: Detects and manages server crashes efficiently.
The SmartLoadBalancer operates as a reverse proxy, distributing communication traffic among multiple servers. This not only boosts system performance but also alleviates server maintenance.
- Java Development Kit (JDK)
- Apache Kafka
- Integrated Development Environment (IDE) such as IntelliJ IDEA or Eclipse
-
Download and Install Apache Kafka: Apache Kafka Downloads
-
Start the Zookeeper Service:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
-
Start the Kafka Server:
.\bin\windows\kafka-server-start.bat .\config\server.properties
-
Download and Extract Kafka:
$ tar -xzf kafka_2.13-3.6.0.tgz $ cd kafka_2.13-3.6.0
-
Start Kafka:
$ KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)" $ bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.properties $ bin/kafka-server-start.sh config/kraft/server.properties
-
Start the HeartBeatReceiver:
Execute the main function in `HeartBeatReceiverUpdated.java`.
-
Launch Backend Server 1:
Run `StartBackend1.java`.
-
Start the Load Balancer:
Execute the main function in `LoadBalancerUpdated.java`.
-
Launch Backend Server 2:
Run `StartBackend2.java`.
As the servers operate, they send heartbeats to the load balancer at regular intervals. This ensures continuous monitoring and synchronization between the servers and the load balancer.
In the event of a server failure, triggered by a random integer value, the server may crash and an error message will be generated. The backend will terminate, but the load balancer will continue running, awaiting new server connections.
The load balancer uses Kafka for checkpointing to manage data and ensure the system remains operational with the most active servers.