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

[HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint #5060

Merged

Conversation

sekaiga
Copy link
Contributor

@sekaiga sekaiga commented Mar 17, 2022

Tips

What is the purpose of the pull request

(For example: This pull request adds quick-start document.)

Brief change log

(for example:)

  • Modify AnnotationLocation checkstyle rule in checkstyle.xml

Verify this pull request

(Please pick either of the following options)

This pull request is a trivial rework / code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end.
  • Added HoodieClientWriteTest to verify the change.
  • Manually verified the change by running a job locally.

Committer checklist

  • Has a corresponding JIRA in PR title & commit

  • Commit message is descriptive of the change

  • CI is green

  • Necessary doc changes done or have another open PR

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.

@alexeykudinkin
Copy link
Contributor

@sekaiga please format the description appropriately

@@ -92,6 +92,7 @@ public static long getObjectSize(Object obj) throws UnsupportedOperationExceptio
private final Set<Object> alreadyVisited = Collections.newSetFromMap(new IdentityHashMap<>());
private final Deque<Object> pending = new ArrayDeque<>(64);
private long size;
private static final ThreadLocal<ObjectSizeCalculator> objectSizeCalculator = ThreadLocal.withInitial(() -> new ObjectSizeCalculator(CurrentLayout.SPEC));
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's bubble this up to the top of the declarations list (where all the static members are)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@danny0405 danny0405 changed the title [HUDI-3652] use threadlocal to decrease ObjectSizeCalculator memory use [HUDI-3652] Make ObjectSizeCalculator threadlocal to reduce memory footprint Mar 18, 2022
@sekaiga sekaiga force-pushed the feature/threadlocal_ObjectSizeCalculator2 branch from 2ca6120 to 0528eca Compare March 18, 2022 06:31
@sekaiga
Copy link
Contributor Author

sekaiga commented Mar 18, 2022

@hudi-bot run azure

1 similar comment
@sekaiga
Copy link
Contributor Author

sekaiga commented Mar 18, 2022

@hudi-bot run azure

@danny0405
Copy link
Contributor

@hudi-bot run azure

@xushiyan
Copy link
Member

@sekaiga can you please rebase master ? this is a small fix we can land for 0.11

@nsivabalan nsivabalan added the priority:critical production down; pipelines stalled; Need help asap. label Mar 30, 2022
@sekaiga sekaiga force-pushed the feature/threadlocal_ObjectSizeCalculator2 branch from 0528eca to b4f8265 Compare April 3, 2022 11:50
@sekaiga sekaiga force-pushed the feature/threadlocal_ObjectSizeCalculator2 branch from b4f8265 to 421abaa Compare April 12, 2022 12:27
@apache apache deleted a comment from hudi-bot Apr 12, 2022
@sekaiga
Copy link
Contributor Author

sekaiga commented Apr 13, 2022

All checks have passed , please merge , thanks

@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Copy link
Contributor

@XuQianJin-Stars XuQianJin-Stars left a comment

Choose a reason for hiding this comment

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

LGTM

@xushiyan xushiyan merged commit f0ab4a6 into apache:master Apr 14, 2022
xushiyan pushed a commit that referenced this pull request Apr 14, 2022
@xushiyan
Copy link
Member

hey @sekaiga this patch seems to break in CI environment. https://dev.azure.com/apache-hudi-ci-org/apache-hudi-ci/_build/results?buildId=8070&view=results
would you be able to look into it and put up any applicable fix? otherwise, we'll just revert it soon. thanks.

xushiyan added a commit that referenced this pull request Apr 14, 2022
xushiyan added a commit that referenced this pull request Apr 14, 2022
@sekaiga sekaiga deleted the feature/threadlocal_ObjectSizeCalculator2 branch May 1, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:critical production down; pipelines stalled; Need help asap.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants