Code Monkey home page Code Monkey logo

Comments (6)

skyzh avatar skyzh commented on July 17, 2024

Seems that this is how thread pool is expected to work. It's more appropriate to use std::thread in agatedb, as we need long running threads instead of spawning short-running tasks.

from agatedb.

BusyJay avatar BusyJay commented on July 17, 2024

Can you explain more about "how thread pool is expected to work"? AgateDB should allow sharing global thread pool with other system.

from agatedb.

skyzh avatar skyzh commented on July 17, 2024

From yatp source code, it by default spawns a maximum of num_cpu threads. https://github.com/tikv/yatp/blob/master/src/pool/builder.rs#L37 Therefore, (from my understanding, if threads in thread pool won't be preempted), there would have at most num_cpu concurrently running threads in the background.

In agatedb with default configuration, we would have at least 5 concurrent tasks running in the background. If other systems have their thread pool misconfigured (like using num_cpus as maximum thread, for GitHub Action, it should be 2), then the database would easily go into stall state (e.g. compaction is never run).

from agatedb.

BusyJay avatar BusyJay commented on July 17, 2024

How about setting a larger capacity?

from agatedb.

skyzh avatar skyzh commented on July 17, 2024

How about setting a larger capacity?

If we have 5 threads, and the thread pool always has these 5 threads running, there seems no difference with std::thread :(

Anyway, I have put all threads back into yatp, and set max_threads for the pool. adf14f7

from agatedb.

BusyJay avatar BusyJay commented on July 17, 2024

Setting a larger capacity is to get around the CI issues. In fact, the thread pool should not be created by the library, it should be a builder parameter given by users. It is critical in resource limited environment to have more precise control on threads.

from agatedb.

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.