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

Router - Add to queue briefly when exceeding target requests per instance #171

Open
huntharo opened this issue Apr 19, 2024 · 0 comments
Open
Labels
area-router Router portion of the app enhancement New feature or request

Comments

@huntharo
Copy link
Contributor

huntharo commented Apr 19, 2024

Motivations

  • Observed Impacts
    • When a new router starts, if it is under initial and continuous load, the response times will be much longer than they should be
    • For example, a nominal 800 ms response time will take 2-8 seconds for a minute or more
    • The response times will start dropping towards the nominal response time
    • If the load is removed, briefly stopped, then restored, the response time immediately drops to the nominal response time
  • Scenario
    • A request arrives but an instance has just disconnected
    • The average requests per instance is exactly equal to the targeted number of requests per instance
    • Instead of waiting a few milliseconds for an instance to connect, the request is immediately pushed into an over-busy instance, negatively impacting the response time more than waiting for a new instance to connect would be
  • Challenge
    • As requests on the overloaded instances complete, will they grab the queued request is trying to wait for a new instance?

Setup

  • MaxConcurrentRequests: 10
  • InstanceCountMultiplier: 5
  • TargetRequestsPerLambda: 2
  • NominalResponseTime: 800 ms
  • ColdStartTime: 12,000 ms

Example

  • T0: 2 requests arrive every second
  • No instances available for 12 seconds ( oha -z 10m -q 2)
  • T12: 24 requests pile up, 1st instance connects, 10 requests are sent to 1st instance, leaving 14 pending
  • T13: 2 more requests arrive, 16 pending, 2nd instance connects, 10 requests are sent to 2nd instance, leaving 6 pending
  • T14: 2 more requests arrive, 8 pending, 3rd instance connects, 8 requests are sent to 3rd instance, leaving 0 pending
  • T15: 2 more requests arrive, 4th instance connects, 2 requests sent to 4th instance, leaving 0 pending
  • T16: 2 more requests arrive, 5th instance connects, 2 requests sent to 5th instance, leaving 0 pending
  • ...
  • T20: 10 requests from 1st instance finish
  • This explains slow response times until ~30 seconds
@huntharo huntharo added enhancement New feature or request area-router Router portion of the app labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-router Router portion of the app enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant