2023 — How API Scheduling Affects Proxy Stability

In 2023 API 2.0 launched. Scheduling efficiency directly affects how users perceive proxy stability -- response time consistency matters more than raw speed.

16Yun Engineering TeamFeb 18, 202314 min read

What Happened That Year

In 2023, proxy users expanded from individual developers to enterprise teams. Enterprise requirements went beyond "does it work" to include "how easy is it to integrate" -- API speed, scheduling flexibility, and onboarding experience all became critical.

Unlike individual developers who might tolerate the occasional hiccup, enterprise teams treat proxy services as infrastructure. An API that is slow to respond or frequently fails directly impacts their collection pipeline throughput and team productivity. This shift in user profile drove every major decision we made that year.

Our biggest achievement was launching API 2.0. This was not a routine version bump but a complete architectural overhaul of the entire scheduling system. The core objective was clear: make every proxy request more predictable for every user.

In the API 1.0 era, scheduling was simple -- when a user requested a proxy IP, the system sequentially assigned the next available IP from the pool. This worked when user counts were small, but as enterprise users grew, problems emerged: wide response time variance, uneven IP allocation, and prolonged wait times for some users. API 2.0 was built to solve these problems.

Understanding Stability: Response Time Consistency

A frequently overlooked dimension of proxy stability is response time consistency.

A proxy might average 200ms response time but range from 50ms to 2,000ms. This unpredictability hurts more than consistently high latency -- because it is unpredictable. If your scraper sets a 5-second timeout per proxy, response time variance means numerous timeouts and retries, significantly reducing collection efficiency.

The impact of response time variance can be illustrated with a concrete scenario. Suppose your data collection system sends 1 million requests daily, each with a 5-second timeout. If response times are stable around 200ms, the entire task completes predictably. But if response times spike to 4 seconds intermittently, those slow requests become pipeline bottlenecks, dragging down overall progress and triggering cascading retries that further increase system load.

In our operations, we found users are far more sensitive to response time variance than to average response times. When users say "this proxy is getting slow," it is usually not because the average response time increased, but because variance grew. One 3-second stall leaves a lasting impression, while dozens of 100ms responses are forgotten. That is why we made response time consistency the core optimization target of 2023.

API 2.0 Architecture Design

API 2.0 was designed around three principles: low latency, high consistency, and scalability.

Full-chain optimization. A typical proxy IP allocation request in API 2.0 traverses: user request -> API gateway -> authentication service -> scheduling engine -> IP pool manager -> allocation result. We redesigned every stage.

At the API gateway layer, we replaced the previous Nginx+Lua solution with a high-performance Go-based gateway. Single-instance throughput improved roughly 5x, with P50 response time dropping from 15ms to 3ms. The gateway also introduced request deduplication and rate limiting -- duplicate IP allocation requests within a short window return cached results, avoiding redundant pool queries.

Asynchronous scheduling with real-time feedback. One of the core changes in API 2.0 was introducing asynchronous scheduling. In API 1.0, when a user requested an IP, the system queried the pool in real time and returned a result. This was straightforward but suffered from linear query time growth as the pool expanded. API 2.0 switched to a pre-allocation plus real-time feedback model -- the system maintains a pre-warmed IP cache queue, and user requests fetch IPs directly from this queue without querying the pool in real time. Meanwhile, the system continuously monitors pool status and replenishes the cache queue.

This model reduced average IP allocation response time from approximately 200ms (API 1.0) to approximately 50ms, with significantly tighter variance -- the P95/P50 ratio dropped from 5-8x to 2-3x.

Scheduling decision engine. The decision engine is the critical component of API 2.0. Instead of sequential allocation, it considers multiple dimensions: the user's historical request patterns, current load across IP pool regions, each IP's health score, and the target website's characteristics. The engine calculates the optimal IP allocation for each request, maximizing success rate while minimizing response time.

The engine is a hybrid of rule engine and real-time computation. The rule engine handles explicit policies ("prefer same-region IPs," "avoid high-load nodes"), while real-time computation handles dynamic data (node response times and availability). The outputs are combined through weighted scoring to produce a composite score for each allocatable IP, returning the highest-scoring one.

Scheduling Algorithm Evolution

In 2023 our scheduling algorithm progressed through several stages, each bringing measurable improvements.

Stage 1: Random allocation -- used in early API 1.0. Pick a random IP from the pool. Simple, but allocation was uneven -- some IPs became overloaded while others sat idle. Response time variance was high, with P95/P50 ratio at 5-8x.

Stage 2: Round-robin allocation -- assign IPs sequentially. More uniform than random, but did not consider real-time IP status -- an overloaded IP would still receive new requests. P95/P50 improved to 4-6x.

Stage 3: Weighted allocation -- score IPs by historical performance and real-time load. Better-performing, lower-loaded IPs received higher allocation weights. This significantly improved response time consistency, bringing P95/P50 down to 2-3x.

Stage 4: Intelligent scheduling (API 2.0) -- on top of weighted allocation, added multi-dimensional decision factors including user request patterns, IP regional distribution, and target website access characteristics. P95/P50 was further optimized to under 2x.

Algorithm StageP50 Response TimeP95 Response TimeP95/P50 Ratio
Random~180ms~1,440ms~8x
Round-robin~150ms~750ms~5x
Weighted~120ms~360ms~3x
Intelligent~80ms~160ms~2x

Each improvement brought significant gains in response time consistency. The lesson: scheduling optimization is not a one-time overhaul but a process of continuous iteration and refinement.

Response Time Optimization in Practice

Beyond the scheduling algorithm itself, API 2.0 made substantial system-level response time improvements.

Database query optimization. The scheduling system frequently queries IP pool status, user information, and quotas. In API 1.0, each allocation request required multiple database queries. API 2.0 moved critical data from relational databases to Redis -- IP pool real-time status, user quotas, and IP scoring data all use Redis sorted sets and hash structures. Query response time dropped from average 30-50ms to 1-3ms.

Connection pool optimization. API 2.0 introduced connection pool pre-warming. During system startup and runtime, a predefined number of database and cache connections are established ahead of time, avoiding connection creation on demand. Pool size adjusts dynamically based on historical traffic -- auto-scaling during peak hours, auto-shrinking during off-peak. This reduced connection establishment time from 10-20ms to near zero.

Request batching. When multiple users' IP allocation requests arrive within a short window, API 2.0 batches them into a single query, fetching results for multiple IPs at once then returning each to its respective user. Batching reduces internal I/O operations, boosting peak throughput by approximately 30%.

Asynchronous logging. Each IP allocation requires an operation log for billing and auditing. In API 1.0, logging was synchronous -- users waited for the log write to complete before receiving a response. API 2.0 switched to asynchronous logging: return the allocation result to the user first, then write the log to a Kafka message queue for backend consumption. This shaved approximately 20ms off each allocation request.

Understanding P50 and P95

In 2023 operations, we increasingly relied on P50 and P95 metrics to evaluate proxy response time quality.

P50 (median) reflects what most users experience. If P50 is 80ms, half of all requests complete within 80ms. P50 is a good indicator of "typical performance," but it can mask slow requests -- even with a low P50, if some requests are especially slow, P95 will be significantly elevated.

P95 reflects the experience of the slowest 5% of requests. If P95 is 300ms, 95% of requests complete within 300ms, and only 5% are slower. P95 helps uncover problems hidden by averages.

We use the P95/P50 ratio as a measure of response time consistency. The closer this ratio is to 1, the more stable the response times. In 2023, our optimization target was keeping P95/P50 within 2x.

Why averages are not enough. Many providers publish only average API response times. But averages can be severely distorted by outliers. Imagine 90 requests at 50ms and 10 at 500ms -- the average is 95ms. If you only look at the average, the system looks fine. But if you are one of the 10% experiencing 500ms responses, your experience is nothing like what the average suggests.

Enterprise User Scenarios

In 2023, enterprise users became our fastest-growing segment. Their access patterns differ fundamentally from individual developers.

Batch access is the norm. Enterprise users typically need proxy access for entire teams or systems, not just individual accounts. A typical enterprise user might have 10-50 concurrent sub-accounts, each corresponding to different business lines. API 2.0 supports unified multi-sub-account management -- administrators can bulk-create, configure, and monitor sub-account proxy usage through the API.

High-frequency API calls. Individual developers call the API every few minutes or hours to get a new proxy IP. Enterprise users run 7x24 collection tasks, calling the API dozens or hundreds of times per minute. In API 1.0, high-frequency calls degraded response times because the system had to query and update pool status frequently. API 2.0's cache queue mechanism was designed specifically for this.

Higher stability requirements. Individual developers may tolerate occasional interruptions, but enterprise users cannot. Every API delay or failure means interruptions or retries across large-scale collection tasks, directly impacting business efficiency. API 2.0 incorporated stability-specific design considerations: reasonable timeout settings, graceful degradation strategies, and complete response data validation.

How to Judge Proxy Stability (Part 7): Response Time Variance

We recommend monitoring two metrics:

  • P50 response time (the median)
  • P95 response time (95th percentile)

If P50 is 200ms but P95 is 3,000ms, response times are highly unstable. A healthy service keeps the P95/P50 ratio within 3x.

Common causes of response time variance:

IP pool hot spots. When a particular IP is assigned to multiple high-traffic users, its response time degrades rapidly. The scheduling system's job is to prevent these hot spots by distributing requests evenly across healthy nodes through weighted allocation.

Upstream resource jitter. Upstream resources -- datacenter bandwidth, residential broadband, cloud service APIs -- all experience intermittent performance jitter. These episodes are usually short (seconds to minutes), but their randomness significantly impacts response time consistency.

System queuing delay. When concurrent requests exceed system capacity, newly arriving requests must wait in queue, and queuing time directly adds to response time. Degraded response times during peak hours are often caused by queuing delay.

API Error Handling and Retry Strategy

API 2.0's design incorporated fault tolerance and retry mechanisms that directly affect the user's stability experience.

Idempotent IP allocation. The IP allocation interface is idempotent -- if a user does not receive a result due to timeout, they can safely retry the same request. The system returns the same IP allocation result (if the IP is still available) or allocates a new one. This avoids redundant applications caused by uncertainty about whether the previous allocation succeeded.

Progressive timeout. API 2.0 introduced tiered timeout handling. Under normal load, IP allocation completes within 100ms. If it does not, the system tries an alternative scheduling path -- allocating from the pre-cached IP pool instead of waiting for the main scheduling path's complex computation. If still unresolved after 500ms, the system returns a degraded result -- an available but possibly suboptimal IP -- ensuring the user is not left waiting.

Automatic retry with backoff. The client SDK implements automatic retry with exponential backoff: first retry after 100ms, second after 200ms, third after 400ms, up to 3 retries. This ensures high success rates while avoiding retry storms that could overwhelm the system.

API 2.0 Real-World Impact

After API 2.0 launched, we tracked several key metrics to measure the actual effect:

  • API response time P50 dropped from ~200ms to ~80ms, an improvement of approximately 60%
  • API response time P95 dropped from ~1,200ms to ~280ms, an improvement of approximately 77%
  • API availability increased from 99.2% to 99.7%
  • User onboarding time (from registration to first successful API call) dropped from 2 hours to 20 minutes
  • Enterprise user monthly active rate improved by approximately 25%

These numbers show that API efficiency improvements are not just technical metrics -- they directly translate into user satisfaction and business growth. The return on response time optimization investment far exceeded the purely technical improvements: it built user trust, reduced churn, and laid the foundation for subsequent scale growth.

Response Time Optimization Business Impact

The improvement in API response time had concrete business effects:

User churn rate declined. In post-launch analysis comparing API 2.0 to API 1.0, we found a significant correlation between API response time and user churn. Users whose API P95 exceeded 500ms had a monthly churn rate approximately 40% higher than users whose P95 was below 200ms. This directly demonstrated the long-term business value of response time optimization.

Collection task completion rates improved. For automated scraping users, faster API response times directly improved task completion rates. Under API 1.0, about 3% of collection tasks were interrupted due to IP allocation timeouts. Under API 2.0, that rate dropped to below 0.5%.

Technical support burden lightened. During periods of unstable API response times, "proxy is slow" related inquiries accounted for about 30% of support tickets. After API 2.0 launched, this dropped to under 10%, freeing the support team to focus on more valuable technical issues.

Lessons from the API 2.0 Deployment

The rollout of API 2.0 was not entirely smooth. Several lessons emerged that proved valuable for future system design.

The importance of gradual rollout. We did not switch all traffic at once. Instead, we ran the new system with a subset of users first, monitoring stability and response time. During this gray-release phase, we discovered that the new scheduling engine, with its additional decision dimensions, was taking about 50% longer to compute than expected. We restructured the scoring algorithm to evaluate high-weight dimensions first and skip low-weight dimensions when the score was already sufficient, bringing computation time back within targets.

The impact of cache invalidation. After the cache queue mechanism went live, we cleared the Redis cache during a maintenance window. This caused the scheduling engine to query the database directly during cache rebuild, spiking response times from an average of 50ms to over 500ms. The lesson: cache invalidation is not just about "the cache disappeared" but about "how the system behaves while the cache is being rebuilt." We added a cache pre-warming process in subsequent versions.

Degradation strategy testing. During the rollout we simulated a complete scheduling engine failure to test our degradation strategy. The result: while the system remained available by falling back to simple round-robin allocation, response times degraded from 80ms to approximately 400ms. This data prompted further optimization -- in degraded mode, prioritize locally cached IP allocation results rather than querying the database with round-robin.

What We Built That Year

  • API 2.0 launched with major improvements in scheduling efficiency and integration experience
  • Response time optimized: P50 from 200ms to 80ms, P95 from 1,000ms+ to under 300ms
  • Scheduling algorithm evolved from random to intelligent across four stages
  • Multi-language SDKs released (Python, Go, Java) -- enterprise users can integrate in 10 minutes
  • Asynchronous scheduling and cache queue mechanism supporting high-frequency calls during peak hours
  • Response time monitoring system established with P50/P95 in daily operations dashboard
  • Enterprise user base continued growing, API call volume up 40%+ month-over-month

Looking Ahead to 2024

With API 2.0 launched, 2023 brought significant progress in scheduling efficiency and response time consistency. But this is only one dimension of stability optimization. In 2024, our focus will shift to more proactive quality monitoring -- automatically detecting and resolving issues before users even notice them. If 2023 was about optimizing response speed, 2024 will be about optimizing problem discovery speed.

One Piece of Advice

Do not just look at average response times. Look at P95. Good averages do not mean a stable experience. If a provider only publishes average response times without P50 or P95, ask them: what is your P95? That single question reveals far more than any average number.

Need an enterprise proxy plan?

We can tailor architecture to your target domains, concurrency, and reliability goals.