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

http_status: add the http api for ballast object #26579

Merged
merged 3 commits into from
Jul 28, 2021

Conversation

hnes
Copy link
Contributor

@hnes hnes commented Jul 26, 2021

What problem does this PR solve?

Problem Summary:

Try to reduce the GC frequency on some occasions.

What is changed and how it works?

What's Changed:

Add a ballast object.

How it Works:

Here are some articles and documentation.

SetGCPercent

Go memory ballast: How I learnt to stop worrying and love the heap

proposal: runtime: add a mechanism for specifying a minimum target heap size

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code
# get current size of the ballast object
curl -v 127.0.0.1:10080/debug/ballast-object-sz
# reset the size of the ballast object (2GB in this example)
curl -v -d "2147483648" -X POST 127.0.0.1:10080/debug/ballast-object-sz

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Add http api for the ballast object.

Signed-off-by: Sen Han <00hnes@gmail.com>
@ti-chi-bot ti-chi-bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 26, 2021
@CLAassistant
Copy link

CLAassistant commented Jul 26, 2021

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 26, 2021
@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Jul 26, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 26, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • coocood
  • tiancaiamao

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 26, 2021
@tiancaiamao
Copy link
Contributor

It seems the CI environment is not using go 1.16

@purelind
Copy link
Contributor

/rebuild

1 similar comment
@purelind
Copy link
Contributor

/rebuild

Copy link
Contributor

@youjiali1995 youjiali1995 left a comment

Choose a reason for hiding this comment

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

What if the heap size reaches the two times of the ballast size? Can the GC affect performance a lot?

server/http_status.go Show resolved Hide resolved
server/http_status.go Outdated Show resolved Hide resolved
server/http_status.go Show resolved Hide resolved
A better error description when the input ballast-object-sz from the POST body is negative.

Co-authored-by: Lei Zhao <zlwgx1023@gmail.com>
@coocood
Copy link
Member

coocood commented Jul 27, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 05e6ac5

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 27, 2021
@youjiali1995 youjiali1995 merged commit 34e840d into pingcap:hz-poc Jul 28, 2021
@hnes
Copy link
Contributor Author

hnes commented Jul 28, 2021

What if the heap size reaches the two times of the ballast size? Can the GC affect performance a lot?

Basically, Golang's GC has two phases: mark and sweep.

C1: Sweep is a very fast operation, and the time cost of GC is largely dominated by the mark phase, not the sweep.

C2: The time cost of the mark phase in GC is mainly depending on the amount of the living objects and has very little to do with the amount of unused objects.

So above all, when the heap size reaches the two times of the ballast size:

  • It would not influence the time cost of GC's mark phase very much because of C2.

  • It would bring more pressure to the weep phase, but it would be acceptable because of C1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/sql-infra SIG: SQL Infra size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants