NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Modelling API rate limits as diophantine inequalities (vivekn.dev)
pkoird 5 days ago [-]
If they do not know about it already, the OP would benefit from knowing more about Linear Programming and Mixed Integer Linear Programming. Many optimization problems can be naturally modeled into LPs or MILPs and there are POWERFUL solvers with decades of theory and optimization behind them already developed to solve them.
comex 5 days ago [-]
> The retry times are integers.

There's no reason the retry times have to be integers. But the number of retries has to be an integer.

klysm 5 days ago [-]
The whole diophantine aspect of this seems contrived - where is the integer restriction coming from? Does that make the problem more tractable or more difficult?
ctenb 5 days ago [-]
Indeed, and to answer your question: more difficult
AdieuToLogic 5 days ago [-]
This is an interesting approach, but a simpler one is to add a level of indirection by having a supervisor meter requests, including retries, and provide back-pressure as applicable.

Doing so allows other decisions to be made beyond rate limiting, such as prioritization, deferring invocations, memoization, etc.

viveknathani_ 8 days ago [-]
Wrote something about applying math in modelling a rate-limiting scenario for API clients. Felt like posting it here. Happy to hear your thoughts, HN!
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 05:47:32 GMT+0000 (UTC) with Wasmer Edge.