Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add load balancer for backend nodes #90

Merged
merged 3 commits into from
Jun 22, 2024
Merged

Add load balancer for backend nodes #90

merged 3 commits into from
Jun 22, 2024

Conversation

ksysoev
Copy link
Owner

@ksysoev ksysoev commented Jun 22, 2024

This pull request adds a load balancer for backend nodes. It includes the following changes:

  • Added a LoadBalancerNode struct to represent each backend node.

  • Refactored the LoadBalancer struct and related code to use LoadBalancerNode instead of BackendNode.

  • Implemented the NewLoadBalancer function to create a new instance of LoadBalancer with the given backends.

  • Implemented the Handle method to handle incoming requests by sending them to the least busy backend.

  • Implemented the getLeastBusyNode method to return the least busy backend node.

  • Added unit tests for the NewLoadBalancer, getLeastBusyNode, and Handle methods.

@ksysoev ksysoev linked an issue Jun 22, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.51%. Comparing base (4b794d1) to head (e6d21e1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   92.21%   92.51%   +0.29%     
==========================================
  Files          21       22       +1     
  Lines         874      908      +34     
==========================================
+ Hits          806      840      +34     
  Misses         50       50              
  Partials       18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ksysoev ksysoev merged commit 16225d8 into main Jun 22, 2024
2 checks passed
@ksysoev ksysoev deleted the 78-loadbalancer branch June 22, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load balancing backend
2 participants