Giter VIP home page Giter VIP logo

aimd's Introduction

AIMD - Additive increase/multiplicative decrease

AIMD is a congestion control algorithm used in TCP. It is a simple algorithm that increases the congestion window size by 1 MSS (Maximum Segment Size) every RTT (Round Trip Time) until a packet loss is detected. When a packet loss is detected, the congestion window size is halved. The congestion window size is then increased by 1 MSS every RTT until another packet loss is detected. This process is repeated until the congestion window size reaches the maximum value.

See https://en.wikipedia.org/wiki/Additive_increase/multiplicative_decrease

Notes

The Limiter implements both slow start and congestion avoidance. Slow start increases the concurrency exponentially by adding maximum weight on every success. Congestion avoidance increases linearly by adding a fraction of the congestion window on every success.

Simulation

The example directory contains a simulation of multiple concurrent workers along with a CSV of a run using the default parameters. Each worker has its own limiter and attempts to run a number of concurrent operations.

Run 1 - Exponential

The following chart shows the maximum concurrency limit of each worker on a 1 second interval. The simulation was run with 10 workers each with a concurrency of 1,000 each for 10,000 iterations per concurrent operation. The underlying resource has a concurrency of 1,000.

Chart of worker concurrency limits

Run 2 - Exponential

The following chart shows the maximum concurrency limit of each worker (i.e. client). The simulation was run with 10 workers each with a concurrency of 100 each for 100 iterations per concurrent operation. The underlying resource has a concurrency of 100.

The following chart shows the client's utilization of the server. The values don't perfectly match the server's utilization due to the grouping used for client utilization values. Chart of worker concurrency limits

The following chart shows the server's utilization. Chart of server utilization

Run 3 - Linear

The following chart shows the maximum concurrency limit of each worker (i.e. client). The simulation was run with 10 workers each with a concurrency of 100 each for 100 iterations per concurrent operation. The underlying resource has a concurrency of 100. The limiters were incremented only when they were not denied access by the server in RTT window.

The following chart shows the server's utilization. Chart of server utilization

Acknowledgement

This code is based a fork of golang.org/x/sync/semaphore#Weighted. All code from the original implementation maintains its original license. The semaphore implementation is extended to support AIMD.

aimd's People

Contributors

misalcedo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.