Skip to main content
Version: 0.10.x

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.

note

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.

CTRL + M