GithubHelp home page GithubHelp logo

Comments (3)

pipermerriam avatar pipermerriam commented on August 31, 2024 1

I think we would get rid of the KEYS_PER_PERIOD concept and probably handle each strategy different.

  • all strategies would be "throttled" by their mpsc::Channel being "full" so they would select as fast as they can and then block once their channel is full.
  • random can just select as fast as possible, probably in some kind of batch size since we probably don't want to hammer the database with single row lookups.
  • latest should probably get "smarter" and work backwards from the front of the chain stopping either once it hits the previous latest or some other maximum batch size.
  • oldest un-audited can probably select as fast as it wants as long as it has protection from filling the queue with duplicates.

from glados.

pipermerriam avatar pipermerriam commented on August 31, 2024

I have an alternate suggestion that I believe gives us both of the following.

  • ability to control overall audit rate
  • ability to throttle each source/strategy in relation to each other (e.g. 50% towards latest, 30% towards random, 20% towards oldest-unaudited

I suggest the --concurrency flag remains to determine how many lookups should happen in parallel.

I suggest the following flags where N is a positive integer argument:

  • --latest-strategy-weight=N
  • --random-strategy-weight=N
  • ... (etc)

We then interpret these as the respective weights for how many jobs we pull from each source.

Implementation detail: This would also imply that we give each strategy its own mpsc::Channel to enable the logic for spreading the audits across the different sources.

Each strategy can then produce audit candidates at maximum rate all of the time and will self-throttle when the channel is full.

from glados.

perama-v avatar perama-v commented on August 31, 2024

Ok that sounds good. So to check:

If there are two strategies (A weight=1, B weight=2), with KEYS_PER_PERIOD=10. Then:

  • Total weight = 1 + 2 = 3
  • A = 10 * 1//3 = 3 keys per period
  • B = 10 * 2//3 = 7 keys per period

Or you could pass 10 and 20 for weights respectively to get 30 and 70 keys per period respectively

from glados.

Related Issues (20)

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.