Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-9091 Determine available CPUs taking CGroup quotas into account #5929

Merged

Conversation

tristantarrant
Copy link
Member

@tristantarrant
Copy link
Member Author

This is wrong. Closing temporarily

@tristantarrant
Copy link
Member Author

This now uses the same logic adopted by Java 10+ taking into account:

  • a system property (infinispan.activeprocessorcount)
  • available CPUs as set by taskset
  • CGroup CPU shares
  • CGroup quota/period allocation

@tristantarrant
Copy link
Member Author

Hints for testing:
Run a docker container with the some quota/period configuration and each of the JDKs:
e.g.
docker run -it --cpu-quota=120000 --cpu-period=10000 [openjdk:8-jdk|openjdk:10-jdk|openjdk:11-jdk]
copy infinispan-commons.jar to the container:
docker cp commons/target/infinispan-commons-9.3.0-SNAPSHOT.jar inspiring_mestorf:/infinispan-commons.jar
From inside the container, run the following:
java -classpath infinispan-commons.jar org.infinispan.commons.util.ProcessorInfo
Try different combinations of cpu-quota/cpu-period

@ryanemerson
Copy link
Contributor

@tristantarrant It appears to be working as expected 👍. On Jdk >= 10 should we not just return Runtime.getRuntime().availableProcessors(); in ProcessorInfo::determineProcessors()?

@tristantarrant
Copy link
Member Author

Yes, but the multi-release jar work is going into my JDK 10+ PR. Once this is in I will adapt #5940 to do just that

@ryanemerson ryanemerson merged commit bc8aced into infinispan:master May 4, 2018

private static int determineProcessors() {
int javaProcs = Runtime.getRuntime().availableProcessors();
int userProcs = Integer.getInteger("infinispan.activeprocessorcount", javaProcs);
Copy link
Member

@wburns wburns Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we always use the value returned from the setting "infinispan.activeprocessorcount" if it is set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does so only if it is less than the available processors.

Copy link
Member

@wburns wburns Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, from the name I assumed it would be use this setting always type of thing. Just side note but with non linux would always use this value if it is set btw.

@tristantarrant tristantarrant deleted the ISPN-9091/processor_quota branch January 21, 2020 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants