Git Product home page Git Product logo

Comments (2)

durban avatar durban commented on June 1, 2024 1

I'm nitpicking, but I don't think the VPA actually dynamically changes container resources. Based on the documentation, it seems to recreate pods with the changed resources.

However, it is possible to dynamically change CPU requests/limits (see here), so this issue is definitely relevant. This k8s feature is somewhat new, and behind a feature gate, but it works. (I did try it, and observed the return value of availableProcessors() changing in a single JVM.)

(I assume the VPA will also use this feature in the future, see here.)

Interestingly, the ForkJoinPool doesn't seem to follow the recommendation in the availableProcessors() javadoc (it only calls it once).

from cats-effect.

djspiewak avatar djspiewak commented on June 1, 2024

Interestingly, the ForkJoinPool doesn't seem to follow the recommendation in the availableProcessors() javadoc (it only calls it once).

This is fascinating. I've never seen this note before. For posterity:

This value may change during a particular invocation of the virtual machine. Applications that are sensitive to the number of available processors should therefore occasionally poll this property and adjust their resource usage appropriately.

So the problem is that actually using this information is somewhat difficult. Resizing the number of worker threads is kinda possible in theory, but I can see a whole host of objections very quickly:

  • There are a number of places where we are almost certainly getting higher performance because the worker count is fixed for the lifetime of the application
  • The number of race conditions we would have to think through on this bit of state is dizzying. Also have to think carefully about publication of writes, since right now we just write it once before the threads start and then go to town, meaning it's always visible
  • Resizing upward is comparatively easy, since we're just adding workers which can then steal and take from the external and what not. Tasks would rebalance relatively quickly and life would be good. Resizing down is much harder, since we would need to first take workers out of rotation, then spill all their work, then wait for the worker to quiesce (while attempting to aggressively spill any excess work on each iteration), with the understanding that quiescence isn't guaranteed.
    • We could also put the worker into a state where, at the next suspension, it simply refuses to continue working and forcibly spills whatever is left. That might be better, though it would cause noticeable latency spikes
  • How will this interact with blocking?

from cats-effect.

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.