Git Product home page Git Product logo

Comments (5)

sdhull avatar sdhull commented on May 13, 2024 4

Being able to run candidates in a non-blocking, out-of-band way would be a really really cool feature that would increase the usefulness of scientist A LOT.

I'm currently working on an experiment that makes a very basic change to how data is fetched in various places in our app. It really needs to be evaluated at the controller action level, but we cannot at least double those request response times. So I'm looking at ways we can support such experiments.

from scientist.

leostera avatar leostera commented on May 13, 2024

So! After having a look around and testing a most naive way of doing this, most of the raised-exception-expecting tests fail (besides some processes hanging and whatnot) – this made evident that in order to be able to use scientist also on tests without having to rewrite any of them, it should be possible to escalate exceptions.

Naturally, this requirement makes it rather complex to run candidates in isolation and in parallel, given that in any β€œtest mode” it’d be needed to pass around (from candidates to the control process) the results or exceptions, and wait for everything to be finished before either returning the appropriate results, or escalating any exceptions.

So yeah, I can see the why now! πŸ˜„

from scientist.

lukeasrodgers avatar lukeasrodgers commented on May 13, 2024

@Ostera I took a crack at something like this a while ago, except not using fork (fork is probably not the best choice here). https://github.com/Headlinerfm/scientist/tree/concurrent-ruby

Tests pass, but this one

it "shuffles behaviors before running" do
    last = nil
    runs = []

    @ex.use { last = "control" }
    @ex.try { last = "candidate" }

    10000.times do
      @ex.run
      runs << last
    end

    assert runs.uniq.size > 1
  end

runs very slowly, ~2s. Without this test, the concurrent-ruby full test suite runs at the same rate as master. I don't have in-depth knowledge of concurrent-ruby but my guess is it's slow here because of mutex locking and thread generation/waiting on free threads -- apparently futures use a global (global to concurrent-ruby?) thread pool, but I'm not sure how large that is, likely much less than 10000. In a real-world scenario, that time is likely to be rendered negligible by whatever you're doing in the scientist experiment/control blocks, especially if that is IO.

My implementation here is half-baked, it was just a proof of concept. I may revisit it. Feel free to copy/hack on it and improve it if you're still interested.

from scientist.

jbarnette avatar jbarnette commented on May 13, 2024

Scientist itself avoids running things at the same time because there are so many ways to do it. 😁 It's limiting for sure, since it means Scientist is only really useful when it's OK for an operation to sometimes be (at least) twice as slow.

I'm closing this since it's been dormant for a while, but it'd be cool to figure out some way to plug in other ways to run all the candidates.

from scientist.

leostera avatar leostera commented on May 13, 2024

Understood πŸ‘Œ

from scientist.

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.