Giter Site home page Giter Site logo

Comments (2)

madkote avatar madkote commented on June 9, 2024

an add - sometimes it is just ONE thread for all connections

[vibe-10(nijw) INF] WORKER :: thread-id=Tid(7fdcc4e82c60) caller=7FDCC4E6D400:2 channel-id=2-fibonacci THREAD=vibe-10
[vibe-10(oxzy) INF] WORKER :: thread-id=Tid(7fdcc4e82dc0) caller=7FDCC4E5F800:2 channel-id=3-fibonacci THREAD=vibe-10
[vibe-10(orNI) INF] WORKER :: thread-id=Tid(7fdcc4e82e70) caller=7FDCC4E6D200:2 channel-id=1-fibonacci THREAD=vibe-10
[vibe-10(ofz5) INF] WORKER :: thread-id=Tid(7fdcc4e82f20) caller=7FDCC4E5FA00:29 channel-id=0-fibonacci THREAD=vibe-10

from vibe.d.

s-ludwig avatar s-ludwig commented on June 9, 2024

Worker tasks are processed by a fixed set of threads on a first-come-first-serve basis. By default, the number of threads matches the number of logical CPU cores of the system, but this can be customized at startup using vibe.core.core.setupWorkerThreads.

This is generally the most efficient way to handle such workloads, since it avoids the thread creation and resource overhead for a one-task-to-one-thread mapping. But especially if the workloads have a very different duration, this can indeed have the drawback of a non-optimal distribution across threads - and you also need to call vibe.core.core.yield periodically to ensure quasi-parallel processing of tasks within the same thread.

But if you really need one thread per task, instead of runWorkerTask, you can simply create a new Thread and perform the work directly, without any task involved. vibe.core.channel.Channel!T together with a free-list could be used to reuse threads and avoid the creation overhead.

from vibe.d.

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.