Skip to content

Conversation

@ahgittin
Copy link
Contributor

@ahgittin ahgittin commented Nov 7, 2016

No description provided.

If things are happy usage should return to a small level. This is quite disruptive
to the system however so use with care.

The above method can also be configured to run automatically when memory usage
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd go further and say that we discourage this for any production use-case (because it has not had expensive testing).

A better solution for production use-cases is to use-XX:SoftRefLRUPolicyMSPerMB=1. See the discussion in https://issues.apache.org/jira/browse/BROOKLYN-375.

We should also describe the symptoms of BROOKLYN-375 - that the CPU usage goes very high, with almost all of that time being taken up by garbage collection.

We need to do more on BROOKLYN-375 - e.g. implement the cache, to stop using soft references!

You should also note the task counts in the `brooklyn gc` messages described above,
and if there are an exceptional number of tasks or tasks are not clearing,
other log messages will describe what is happening, and the in-product task
view can indicate issues. `jstack` can also be useful if it is a task problem.
Copy link
Contributor

Choose a reason for hiding this comment

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

Also worth recommending the use of jmap -histo:live <pid> to see how many live instances of each type there are.

toc: /guide/toc.json
---

## Memory Usage
Copy link
Contributor

Choose a reason for hiding this comment

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

@aledsage
Copy link
Contributor

aledsage commented Nov 7, 2016

Perhaps worth adding links to generic resources, so it's clearer we're telling people to use "normal" tools/approaches - e.g. https://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-VM/html/memleaks.html

@aledsage
Copy link
Contributor

aledsage commented Nov 7, 2016

@ahgittin useful tips for the docs - thanks. A few comments.

@ahgittin
Copy link
Contributor Author

ahgittin commented Nov 7, 2016

addressed comments & merging

@asfgit asfgit merged commit 561ac2a into apache:master Nov 7, 2016
asfgit pushed a commit that referenced this pull request Nov 7, 2016

* Note the log lines about `brooklyn gc`, including memory and tasks
* Do not assume high memory usage alone is an error, as soft reference caches are deliberate;
use `forceClearSoftReferences()` to clear these
Copy link
Contributor

Choose a reason for hiding this comment

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

@ahgittin (cc @neykov) I thought we were not going to recommend using forceClearSoftReferences() this in any kind of production environment. Can we put in a caveat here about not using it in production. I'd be extremely caution about encouraging real users to call this until devs have been using it in anger themselves a lot.

With the use of the (much safer) -XX:SoftRefLRUPolicyMSPerMB=1, I'd expect the need for calling this would be greatly reduced.

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

@ahgittin ahgittin Nov 14, 2016

Choose a reason for hiding this comment

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

we say

This call can be disruptive to the system however so use with care.

and

Many JVM authorities discourage interfering with its garbage collector, however,
so use with care and study the particular JVM you are using.

this felt sufficient but if you still want i'll add more caveats.

note the code fails because it tries to allocate a huge block of memory: any parallel code trying to allocate a non-huge amount of memory should be unaffected.

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.

4 participants