[ https://issues.apache.org/jira/browse/CURATOR-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16308671#comment-16308671 ]
ASF GitHub Bot commented on CURATOR-447: ---------------------------------------- GitHub user njhill opened a pull request: https://github.com/apache/curator/pull/250 [CURATOR-447] TreeCache: Improve memory usage and thread safety Jira https://issues.apache.org/jira/browse/CURATOR-374 reduced per-node memory usage in `TreeCache`. It can be improved further via removal of the `nodeState` field - its `LIVE` state corresponds exactly to the adjacent `childData` field being non-null, and a sentinel `ChildData` value can be used for the `DEAD` state. This simplification also reduces the room for bugs and state inconsistencies. Other improvements included: * A further simplification to have `TreeNode` extend `AtomicReference`, which obviates the need for an explicit `childData` field * More robust cache update logic (in get-children and get-data event callbacks) * Avoid overhead of incrementing/decrementing the `outstandingOps` atomic integer post-initialization See corresponding JIRA: [CURATOR-447](https://issues.apache.org/jira/browse/CURATOR-447) You can merge this pull request into a Git repository by running: $ git pull https://github.com/njhill/curator CURATOR-447 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/curator/pull/250.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #250 ---- commit 1c7be856fb514015286855f1ad9fd89069c32906 Author: nickhill <nickhill@...> Date: 2017-03-26T20:19:40Z remove nodeState field, improve thread safety of cache updates also simplify by having TreeNode extend AtomicReference<ChildData> commit 67210556919d7f822c431597245c4fa7246901dd Author: nickhill <nickhill@...> Date: 2017-03-26T20:20:32Z avoid incrementing/decrementing outstandingOps post-initialization no need to incur the synchronization overhead commit a5a680d50e50a0a804caa875a53e2ee8d9a268f9 Author: nickhill <nickhill@...> Date: 2018-01-02T16:36:20Z remove superfluous braces ---- > TreeCache: Improve memory usage and thread safety > ------------------------------------------------- > > Key: CURATOR-447 > URL: https://issues.apache.org/jira/browse/CURATOR-447 > Project: Apache Curator > Issue Type: Improvement > Components: Recipes > Affects Versions: 3.3.0, 2.12.0 > Reporter: Nick Hill > Priority: Minor > Labels: performance > > Jira https://issues.apache.org/jira/browse/CURATOR-374 reduced per-node > memory usage in {{TreeCache}}. It can be improved further via removal of the > {{nodeState}} field - its {{LIVE}} state corresponds exactly to the adjacent > {{childData}} field being non-null, and a sentinel {{ChildData}} value can be > used for the {{DEAD}} state. This simplification also reduces the room for > bugs and state inconsistencies. > Other improvements included: > * A further simplification to have {{TreeNode}} extend {{AtomicReference}}, > which obviates the need for an explicit {{childData}} field > * More robust cache update logic (in get-children and get-data event > callbacks) > * Avoid overhead of incrementing/decrementing the {{outstandingOps}} atomic > integer post-initialization -- This message was sent by Atlassian JIRA (v6.4.14#64029)