Try Lunar Sandbox
This sandbox simulates lunar.dev simplifies 3rd-party API consumption shared by different environments through effective load-balancing policies.
What Youβll Seeβ
Lunar.dev helps allocate quotas to different environments or services sharing the same API key, ensuring optimal orchestration and preventing unnecessary 429 errors.
Step 0: The Tutorial (Optional)β
If you prefer a guided introduction to the Sandbox, click the button below to access a quick interactive tutorial. It offers comprehensive instructions for navigating the Sandbox effectively. If you choose not to follow the tutorial, proceed to the steps below.
Step 1: Launch the Sandboxβ
Our Sandbox is set up in Gitpod. Click the button below to set up the GitPod environment.
Connect with your GitHub account. If you don't have one, sign up for free here.
Create your new workspace by pressing the Continue button, without modifying any predefined specifications.
To hide your left file explorer sidebar, press Ctrl+B (Windows/Linux), or β+B if you're a MacOS user.
Step 2: Check out the Sandbox Scenarioβ
Examine the Grafana Dashboard.β
View the large error rates being presented, observe any triggered Alerts, and refer to the initial allocation between environments is set at 50/50.
Run Lunar's discover
command using the GitPod Terminal.β
docker exec sandbox-lunar-proxy-1 discover
The output will display the involved endpoints and assigned interceptors. Gain insights into traffic patterns, highlighting successful and error responses.
Step 3: Enable the Load Balancing Policyβ
Activate Lunar's remedy plugin, change its enabled
field to true
in the policies.yaml
file.β
Apply the changes using the apply_policies
command using the GitPod Terminal.β
docker exec sandbox-lunar-proxy-1 apply_policies
Step 4: View it in Actionβ
Assess the impact by running the remedy_stats
command in the terminal.β
docker exec sandbox-lunar-proxy-1 remedy_stats
Check Grafana for improvements made by Lunar.dev:β
π Review the rate of successful requests per minute.
π Review the improvements in the presented Status Codes distribution graph. Now, most of the returned API responses are not facing the rate limits by the provider, resulting in mostly 200s API responses.
π Note the improvements in alignment with the configured policies for each service/client. Observe the allocation between the staging and production environments which now corresponds to the assigned percentage quotas of 20% for staging and 80% for production.
π½ Observe the reduction in overall error rates, indicating itβs success in preventing unnecessary 429 errors and rate limit violations.