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

Set cache dir to user's home directory #2862

Merged
merged 1 commit into from
Oct 9, 2018

Conversation

hangshao0
Copy link
Contributor

@hangshao0 hangshao0 commented Sep 13, 2018

  1. Set cache dir to user's home directory if groupAccess does not
    presents on Java 11
  2. Add options bootClassesOnly and fatal
  3. Set J9SHR_RUNTIMEFLAG_ENABLE_CACHE_NON_BOOT_CLASSES by default,
    remove this flag if option bootClassesOnly presents
  4. Change the second parameter of j9shmem_getDir().
  5. Change the first parameter of getCacheDir().

Doc change eclipse-openj9/openj9-docs#103.

Signed-off-by: hangshao [email protected]

@pshipton
Copy link
Member

For consistency, I expect the shared cache location should always default to the home directory. If we can agree on this, we should also discuss a migration strategy since existing VMs use the temp directory.

@hangshao0
Copy link
Contributor Author

I expect the shared cache location should always default to the home directory.

The home directory might not be accessible to other users. This might break users using "groupAccess". Probably we can use home directory if "groupAccess" is not in use.

@hangshao0
Copy link
Contributor Author

@pshipton, Do you agree to set cache directory to user's home only when "groupAccess" is not in use ?

@pshipton
Copy link
Member

Do you agree to set cache directory to user's home only when "groupAccess" is not in use ?

Yes, for compatibility it seems necessary.

I think what we need is a list of scenarios and what will occur in each. This will help ensure everything is covered properly, and the documentation is updated appropriately.

Here is a starter list.

  • what happens when there is an existing cache in /tmp and you get a new JVM which puts the cache in the home directory? How do caches in /tmp get cleaned up?
  • do bootstrap caches and caches created via -Xshareclasses use the same file name?
  • how do you delete a bootstrap cache?
  • what happens if one JVM creates and uses a bootstrap cache, and another JVM enables -Xshareclasses using the default name?

@hangshao0
Copy link
Contributor Author

  • what happens when there is an existing cache in /tmp and you get a new JVM which puts the cache in the home directory? How do caches in /tmp get cleaned up?

Then the new JVM will use the cache in the home directory. Users can always delete the caches in /tmp using "cacheDir=/tmp,destroy".

  • do bootstrap caches and caches created via -Xshareclasses use the same file name?

Currently yes.

  • how do you delete a bootstrap cache?

We can use -Xshareclasses:destroy.

  • what happens if one JVM creates and uses a bootstrap cache, and another JVM enables -Xshareclasses using the default name?

They will share the same cache.

@pshipton
Copy link
Member

They will share the same cache.

Will JVMs which haven't enabled -Xshareclasses load non-bootstrap classes from the cache?

  • what is the default size of a bootstrap cache?

@pshipton
Copy link
Member

pshipton commented Sep 21, 2018

  • how do you change the default location of a bootstrap cache, or apply other options
  • seems nonfatal or the equivalent should automatically be in effect for bootstrap caches, how does this interact with the above
  • how do you turn off the bootstrap cache
  • I assume changing the location of the cache affects the location of snapshots

@hangshao0
Copy link
Contributor Author

hangshao0 commented Sep 21, 2018

Will JVMs which haven't enabled -Xshareclasses load non-bootstrap classes from the cache?

No

what is the default size of a bootstrap cache?

It is the same as the default cache size. 300MB with 64softmx on 64-bit platforms and 16MB on 32 bit platforms.

how do you change the default location of a bootstrap cache, or apply other options

By changing the setting of user home, or environment variable "HOME". (There is another way to do this , by using -Xshareclasses:CacheDir=/dir/,bootClassesOnly.)

how do you turn off the bootstrap cache

By using -Xshareclasses:none

seems nonfatal or the equivalent should automatically be in effect for bootstrap caches, how does this interact with the above

The default class sharing is equivalent to -Xshareclasses:cacheDir=userhome,nonfatal,bootClassesOnly. Nonfatal can be turn on by using -Xshareclasses:cacheDir=userhome,bootClassesOnly.

I assume changing the location of the cache affects the location of snapshots

Yes.

There will be a trace point if the default shared cache failed to start up. And the size of the default shared cache can be set by -XX:SharedCacheHardLimit= and -Xscmx

@hangshao0
Copy link
Contributor Author

Discussed with Peter, I will try on some real applications with -Xshareclasses:bootClassesOnly to see if the bootstrap shared cache gradually grows in size.

@pshipton
Copy link
Member

I suggest bootClassesOnly implies nonfatal. A new "fatal" option (although I don't like this name) can be added so -Xshareclasses:bootClassesOnly is equivalent to the default, and -Xshareclasses:bootClassesOnly,fatal can disable it if desired.

@pshipton
Copy link
Member

Another point we discussed

  • what happens if the shared cache cannot be created in the home directory, due to it being on a network drive, or home doesn't exist, or there isn't enough disk space.

Default bootClassesOnly is disabled.

@hangshao0 hangshao0 changed the title Add a new debug option -Xshareclasses:bootClassesOnly Set cache dir to user's home directory Oct 1, 2018
@hangshao0
Copy link
Contributor Author

The change is ready to be reviewed again.

@pshipton
Copy link
Member

pshipton commented Oct 3, 2018

Please open the doc issue, this change cannot be merged without the documentation being ready to go as well.

runtime/port/sysvipc/j9shmem.c Outdated Show resolved Hide resolved
Assert_PRT_true(TRUE == appendBaseDir);
uintptr_t baseDirLen = strlen(J9SH_BASEDIR);
/* From https://linux.die.net/man/3/getpwuid:
* "An application that wants to determine its user's home directory should inspect the value of HOME (rather than the value getpwuid(getuid())->pw_dir)
Copy link
Member

Choose a reason for hiding this comment

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

Please don't copy the text from the Linux man pages. You can paraphrase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@hangshao0
Copy link
Contributor Author

OpenJ9 doc issue created: eclipse-openj9/openj9-docs#103.

We never documented the debug options from -Xshareclasses:morehelp, I guess we do not need to document -Xshareclasses:bootClassesOnly and -Xshareclasses:fatal either ? (Though "bootClassesOnly" and "fatal" are in the doc change request for now)

@pshipton
Copy link
Member

pshipton commented Oct 4, 2018

bootClassesOnly and fatal should be first class options shown via -Xshareclasses:help

1. Set cache dir to user's home directory if groupAccess is not
presents on Java 11
2. Add a new debug option bootClassesOnly
3. Set J9SHR_RUNTIMEFLAG_ENABLE_CACHE_NON_BOOT_CLASSES by default,
remove this flag if option bootClassesOnly presents
4. Change the second parameter of j9shmem_getDir().
5. Change the first parameter of getCacheDir().

Signed-off-by: hangshao <[email protected]>
@hangshao0
Copy link
Contributor Author

Moved bootClassesOnly and fatal to -Xshareclasses:help

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins test all plinux jdk11

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins test sanity plinux jdk11

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins test extended plinux jdk11

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins test sanity plinux jdk11

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile win,zlinux jdk8

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile aix jdk8

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

The compile failures are a result of #3158 and can be ignored.

@pshipton pshipton requested a review from SueChaplain October 5, 2018 19:26
@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

@SueChaplain I've added a review on this for you so you can indicate when the doc changes are ready to go.

Copy link
Member

@pshipton pshipton left a comment

Choose a reason for hiding this comment

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

Do not merge before doc changes are ready.

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile aix,zlinux jdk8

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile xlinux,plinux jdk8

1 similar comment
@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile xlinux,plinux jdk8

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile plinux jdk8

1 similar comment
@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins compile plinux jdk8

@pshipton
Copy link
Member

pshipton commented Oct 5, 2018

jenkins test sanity plinux jdk8

@pshipton pshipton dismissed their stale review October 9, 2018 19:11

Doc changes can come later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants