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

[FLINK-14936][runtime] Introduce MemoryManager#computeMemorySize to calculate managed memory size from a fraction #10398

Merged
merged 1 commit into from Dec 3, 2019

Conversation

@zhuzhurk
Copy link
Contributor

zhuzhurk commented Dec 3, 2019

What is the purpose of the change

A MemoryManager#computeMemorySize(double fraction) is needed to calculate managed memory bytes from a fraction.
It can be helpful for operators to get the memory size it can reserve and for further #reserveMemory. (Similar to #computeNumberOfPages).

Here are two cases that may need this method in near future:

  1. Python operator memory management
  2. Statebackend memory management

Brief change log

  • Added MemoryManager#computeMemorySize

Verifying this change

This change added tests and can be verified as follows:

  • Added unit tests for MemoryManager#computeMemorySize

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
@flinkbot

This comment has been minimized.

Copy link

flinkbot commented Dec 3, 2019

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit c9ee2a8 (Wed Dec 04 15:57:04 UTC 2019)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • 1. The [description] looks good.
  • 2. There is [consensus] that the contribution should go into to Flink.
  • 3. Needs [attention] from.
  • 4. The change fits into the overall [architecture].
  • 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier
@flinkbot

This comment has been minimized.

Copy link

flinkbot commented Dec 3, 2019

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
@Test
public void testComputeMemorySizeInvalidFraction() {
try {
memoryManager.computeMemorySize(0.0);

This comment has been minimized.

Copy link
@azagrebin

azagrebin Dec 3, 2019

Contributor

Could we do like this instead for each case?

@Test(Expected = IllegalArgumentException.class)
public void testComputeMemorySizeFailForZeroFraction() {
    memoryManager.computeMemorySize(0.0);
}

This comment has been minimized.

Copy link
@zhuzhurk

zhuzhurk Dec 3, 2019

Author Contributor

Sure.

This comment has been minimized.

Copy link
@zhuzhurk

zhuzhurk Dec 3, 2019

Author Contributor

done.

…alculate managed memory size from a fraction
@zhuzhurk zhuzhurk force-pushed the zhuzhurk:FLINK-14936_computeMemorySize branch from 645d82d to c9ee2a8 Dec 3, 2019
Copy link
Contributor

azagrebin left a comment

Thanks @zhuzhurk , LGTM, merging this, once travis is green

@azagrebin azagrebin merged commit 60b3f2f into apache:master Dec 3, 2019
@azagrebin

This comment has been minimized.

Copy link
Contributor

azagrebin commented Dec 3, 2019

merged into master by 60b3f2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.