Code Monkey home page Code Monkey logo

Comments (11)

addaleax avatar addaleax commented on June 14, 2024 1

It’s going to pick the Worker that has the least amount of tasks currently being processed, i.e. yes, it picks “breadth first”. In your example, task 3 may end up being picked up by either worker, depending on which Worker finishes its task first.

from piscina.

addaleax avatar addaleax commented on June 14, 2024

Since Worker pools aren’t graphs: What would breadth-first or depth-first even mean here?

from piscina.

ronag avatar ronag commented on June 14, 2024

As I understand concurrentTasksPerWorker is how many tasks a worker can run concurrently.

So if I have concurrentTasksPerWorker = 2 and maxThreads = 2. How will the tasks be scheduled?

Let's say I have 3 tasks.

Breadth first:

Worker1: task 1
Worker2: task 2 (reached maxThreads start over)
Worker1: task 3

Depth first:

Worker1: task 1
Worker1: task 2 (reached concurrentTasksPerWorker switch to next worker)
Worker2: task 3

from piscina.

jasnell avatar jasnell commented on June 14, 2024

It likely would be a good idea to document that :-)

from piscina.

ronag avatar ronag commented on June 14, 2024

Would be nice to be able to implement a custom scheduler, i.e. I might want to consider cpu utilization instead of queue size. Or maybe even want to have it depth first if I have a IO mixed workload.

from piscina.

addaleax avatar addaleax commented on June 14, 2024

if I have a IO mixed workload.

I mean, in that case, don’t use Workers.

from piscina.

ronag avatar ronag commented on June 14, 2024

I mean, in that case, don’t use Workers.

There is a lot of computation mixed with IO. I could do the IO in master and then transfer to worker but that just adds lots of complexity.

from piscina.

addaleax avatar addaleax commented on June 14, 2024

I mean, in that case, don’t use Workers.

There is a lot of computation mixed with IO. I could do the IO in master and then transfer to worker but that just adds lots of complexity.

That’s generally the idea behind this library, though. From what it sounds like, piscina might not be the right fit for you, if you do I/O in the Worker pool anyway.

from piscina.

ronag avatar ronag commented on June 14, 2024

piscina might not be the right fit for you

It fits just fine even if not perfect. I'm moving low priority work with lot's cpu utilization off my main thread with almost no added complexity. Just could be even better with more fine grained scheduling.

from piscina.

jasnell avatar jasnell commented on June 14, 2024

I'm not convinced that changing the scheduling model would yield any significant benefit, regardless of the workload type.

@ronag, do you see a possible performance benefit?

from piscina.

ronag avatar ronag commented on June 14, 2024

Maybe. But it's a bit unclear to me as well. I think we can keep things simple as is.

from piscina.

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.