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

[Feature] User Location LB policy [WIP] #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

AlexCuadron
Copy link
Collaborator

introduces a new load balancing policy called GeoDataPolicy to the codebase. This policy uses geographical data to determine the closest replica to a user based on their IP address.

Key Changes

  1. GeoDataPolicy Class:
    A new class GeoDataPolicy is added, which extends the LoadBalancingPolicy class. It uses an online GeoIP service to map user IP addresses to geographical locations and selects the nearest replica based on calculated distances.

  2. Distance Calculation:
    The class includes a method to calculate the distance between two geographical points using the Haversine formula.

  3. Integration with Load Balancer:
    The SkyServeLoadBalancer class is updated to accept a load_balancing_policy parameter, allowing it to use the new GeoDataPolicy.

  4. Command-line Argument:
    The script now accepts a --load-balancing-policy argument to choose between 'round_robin' and 'geo_data' policies.

These changes lay the groundwork for geographically-aware load balancing, which can improve performance by directing user requests to the nearest available service replica.

Tests TBD

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@AlexCuadron AlexCuadron self-assigned this Oct 10, 2024
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.

1 participant