Skip to content

crimson/os/seastore: implement generational GC - #46436

Merged
athanatos merged 5 commits into
ceph:mainfrom
cyx1231st:wip-seastore-generational-cleanning
Jun 30, 2022
Merged

athanatos merged 5 commits into
ceph:mainfrom
cyx1231st:wip-seastore-generational-cleanning

Conversation

@cyx1231st

@cyx1231st cyx1231st commented May 31, 2022 •

Copy link
Copy Markdown
Member

This PR has 2 parts: generational-GC and policy-improvements.

I. Generational GC

Classify segments into 2 dimensions --- data category (data, metadata) and generation (0, 1, 2), totally 6 types of segments --- to improve the locality of block placements. This is the foundation to form a desired bimodal distribution of
segment utilizations for more efficient GC.

The profiling with rbd-fio (zipf-0.6) proves that the desired bimodal distribution has been formed. Note that reclaiming has been delayed as late as possible (see #46437), so that the first ~1500 seconds won't involve reclaiming, and the utility distribution below is accurate before 1500s:

  • Before1: all the blocks are mixed together so segment utilities are around 20~30%, which is not bimodal.
  • After2: nearly 55% of the segments have utilities below 10%, and another half have utilities around 55%, which is bimodal.

II. Policy improvements

  • record_header_t to store the average modify time instead of the commit time to consider dirty extents.
  • Drop tracking rewrite-time, consider rewriting seems to have negative impacts: 0.55 WAF from reclaiming that considers rewrite-time or modify-time, and 0.33 WAF that only considers modify-time, in rbd-fio(zipf-0.6, 5400s).
  • Drop the last-modify field in extent_info_t, which seems unnecessary right now.
  • Make sure the information of modify-time won't be lost during rewriting.
  • Introduce 3 GC policies to select from: greedy, benefit, and cost-benefit.

Final performance improvements with rbd-fio, zipf-0.6, 5400s

  • WAF from trimming is reduced from 2.03 to 1.32.
  • WAF from reclaiming is reduced from 0.90 to 0.33.
  • Overall conflict ratio are reduced, see before3 and after4.
  • Overall throughput in the steady state is improved 11%.

Policy selection

There are 3 GC policies available:

  • GREEDY: always select the least utilized segment to reclaim.
  • COST_BENEFIT: revise base on sprite-lfs's cost-benefit formula, and revise from the original version.
  • BENEFIT: a revised version of GREEDY policy that considers the age factor, so that the aged segment has larger benefit:
    benefit-formula

In theory, GREEDY policy should be the least efficient as it only considers segment utility. The result reclaim WAFs in rbd-fio(zipf-0.6, 5400s) are:

  • GREEDY: 0.586
  • COSY_BENEFIT: 0.328
  • BENEFIT: 0.372

For reference, the original reclaim WAFs were:

  • Before generational GC: 0.896
  • After generational GC, before policy improvements: 0.553

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

Footnotes

  1. before-gen-dist ↩

  2. after-gen-dist ↩

  3. before-gen-conflicts ↩

  4. after-gen-conflicts ↩

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cyx1231st
cyx1231st force-pushed the wip-seastore-generational-cleanning branch from 604eb24 to fedad75 Compare June 6, 2022 07:18
@cyx1231st
cyx1231st force-pushed the wip-seastore-generational-cleanning branch 3 times, most recently from ea760ba to 4aa9fb3 Compare June 16, 2022 06:56
@xxhdx1985126

xxhdx1985126 commented Jun 22, 2022 •

Copy link
Copy Markdown
Member
  • After2: nearly 55% of the segments have utilities below 10%, and another half have utilities around 55%, which is bimodal.

It seems that, after the first 1500 secs, the number of segments whose utilization is under dropping, could you allow the test to keep running longer so that the stable segment usage distribution can emerge?

And could you elaborate a little bit about the test environment and the segment usage distribution graph? like how large the seastore disk space and the rbd image is, what the curves in the graphs represent. It seems that the total number of segments in you seastore disk is about 5000~6000, so I guess you are not using the default seastore configuration, right?

@xxhdx1985126

xxhdx1985126 commented Jun 22, 2022 •

Copy link
Copy Markdown
Member

so that the first ~1500 seconds won't involve reclaiming, and the utility distribution below is accurate before 1500s:

Do you mean that the bimodel distribution in the second graph is done by rewrites caused by journal trimming?

@cyx1231st

Copy link
Copy Markdown
Member Author

Do you mean that the bimodel distribution in the second graph is done by rewrites caused by journal trimming?

No, I mean metadata and data, or generation 0, 1, 2 have different probabilities/rates to become invalid. If we split write them into different segments, the ideal bimodel distribution can be formed automatically.

@cyx1231st

cyx1231st commented Jun 22, 2022 •

Copy link
Copy Markdown
Member Author

could you allow the test to keep running longer so that the stable segment usage distribution can emerge?

I wanted to show the bimodel utilility distribution before the involvements of reclaming, otherwise, the distribution can be affected by the specific GC policy.

Anyway, this is the complete graph with different GC policies.
Before:
before

After:
after

@cyx1231st

cyx1231st commented Jun 22, 2022 •

Copy link
Copy Markdown
Member Author

And could you elaborate a little bit about the test environment.

The disk and rbd image sizes are all 50G, the graph also shows the total number of segments is 800.

the segment usage distribution graph?

See

/*
* 10 buckets for the number of closed segments by usage
* 2 extra buckets for the number of open and empty segments
*/
static constexpr double UTIL_STATE_OPEN = 1.05;
static constexpr double UTIL_STATE_EMPTY = 1.15;
static constexpr std::size_t UTIL_BUCKETS = 12;
static std::size_t get_bucket_index(double util) {
auto index = std::floor(util * 10);
assert(index < UTIL_BUCKETS);
return index;
}
double calc_utilization(segment_id_t id) const {
auto& info = segments[id];
if (info.is_open()) {
return UTIL_STATE_OPEN;
} else if (info.is_empty()) {
return UTIL_STATE_EMPTY;
} else {
auto ret = space_tracker->calc_utilization(id);
assert(ret >= 0 && ret < 1);
return ret;
}
}

The graph lines are stacked, so that the space between the two lines is the actual number of segments that falls in the according bucket.

@xxhdx1985126

Copy link
Copy Markdown
Member

And could you elaborate a little bit about the test environment.

The disk and rbd image sizes are all 50G, the graph also shows the total number of segments is 800.

the segment usage distribution graph?

See

/*
* 10 buckets for the number of closed segments by usage
* 2 extra buckets for the number of open and empty segments
*/
static constexpr double UTIL_STATE_OPEN = 1.05;
static constexpr double UTIL_STATE_EMPTY = 1.15;
static constexpr std::size_t UTIL_BUCKETS = 12;
static std::size_t get_bucket_index(double util) {
auto index = std::floor(util * 10);
assert(index < UTIL_BUCKETS);
return index;
}
double calc_utilization(segment_id_t id) const {
auto& info = segments[id];
if (info.is_open()) {
return UTIL_STATE_OPEN;
} else if (info.is_empty()) {
return UTIL_STATE_EMPTY;
} else {
auto ret = space_tracker->calc_utilization(id);
assert(ret >= 0 && ret < 1);
return ret;
}
}

The graph lines are stacked, so that the space between the two lines is the actual number of segments that falls in the according bucket.

Ah, so the segment usage distribution is showing the number of segments whose utilization is under a specific percentage, right?

@cyx1231st

Copy link
Copy Markdown
Member Author

Ah, so the segment usage distribution is showing the number of segments whose utilization is under a specific percentage, right?

Yes, and how they were evolved by time.

@cyx1231st
cyx1231st force-pushed the wip-seastore-generational-cleanning branch 2 times, most recently from 31469d8 to 8c3a638 Compare June 24, 2022 07:45
@cyx1231st cyx1231st changed the title [WIP, RFC] crimson/os/seastore: implement generational GC crimson/os/seastore: implement generational GC Jun 24, 2022
@cyx1231st
cyx1231st marked this pull request as ready for review June 24, 2022 08:47
@cyx1231st
cyx1231st requested a review from a team as a code owner June 24, 2022 08:47
@cyx1231st

Copy link
Copy Markdown
Member Author

ready for review

@cyx1231st
cyx1231st force-pushed the wip-seastore-generational-cleanning branch from 8c3a638 to a1ec396 Compare June 27, 2022 05:46
@cyx1231st

Copy link
Copy Markdown
Member Author

jenkins test api

1 similar comment
@cyx1231st

Copy link
Copy Markdown
Member Author

jenkins test api

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Place extents into the dedicated RecordSubmitter by their data-category
and reclaimed-count. Segments of different data-category or
reclaimed-count should have different locality in the access patterns,
which is the foundation to form a desired bimodal distribution of
segment utilizations, so that GC can be more efficient.

Signed-off-by: Yingxin Cheng <[email protected]>
* record_header_t to store the average modify time for dirty extents.
* Drop tracking rewrite-time.
* Drop the last-modify field in extent_info_t.
* Maintain modify-time during rewriting.
* Introduce 3 GC policies: greedy, benefit, and cost-benefit.

Signed-off-by: Yingxin Cheng <[email protected]>
Journal trimming may consume unexpected number of segments when the
available ratio limit is reached with user transactions blocked, causing
ceph_abort(). So increase the limit as a simple workaround.

Signed-off-by: Yingxin Cheng <[email protected]>
@cyx1231st
cyx1231st force-pushed the wip-seastore-generational-cleanning branch from a1ec396 to f150c20 Compare June 29, 2022 07:02
@cyx1231st

Copy link
Copy Markdown
Member Author
The following tests FAILED:
	227 - unittest_rgw_lua (Failed)

@cyx1231st

Copy link
Copy Markdown
Member Author

jenkins test make check

@athanatos athanatos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@athanatos
athanatos merged commit f3d63b2 into ceph:main Jun 30, 2022
@cyx1231st
cyx1231st deleted the wip-seastore-generational-cleanning branch June 30, 2022 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants