Skip to content

crimson/os/seastore: increase journal size and decrease rewrite-dirty size - #46310

Merged
athanatos merged 1 commit into
ceph:masterfrom
cyx1231st:wip-seastore-tune-cleaner
May 20, 2022
Merged

athanatos merged 1 commit into
ceph:masterfrom
cyx1231st:wip-seastore-tune-cleaner

Conversation

@cyx1231st

Copy link
Copy Markdown
Member

In short, by increasing the journal size:

  • The conflicts between user and trim transactions drop from 4x to only 0.15x;
  • The invalid write from trim decreases from 2x to 0.25x due to less conflicts;
  • The data required to trim also decreases from 3x to 1.75x due to longer buffer;
  • The overall internal write amplification drops from 7x to 4x (note: reclaim was not involved yet);
  • Trimming become faster, no more IO throttling due to trimming;
  • The end performance become more stable and better -- 13.5% better in the first 600 seconds;

By decreasing the rewrite-dirty size (with pros and cons):

  • Pros: invalid write from trim further decreases from 0.25x to nearly 0;
  • Cons: trimming become slower and can cause IO throttling;

600s RADOS random write performance results

A. Original

Total time run:         600.042
Total writes made:      1421290
Write size:             4096
Object size:            4096
Bandwidth (MB/sec):     9.25255
Stddev Bandwidth:       1.98603
Max bandwidth (MB/sec): 15.5469
Min bandwidth (MB/sec): 0.460938
Average IOPS:           2368
Stddev IOPS:            508.424
Max IOPS:               3980
Min IOPS:               118
Average Latency(s):     0.0270172
Stddev Latency(s):      0.0278056
Max latency(s):         1.10713
Min latency(s):         0.000898385

B. Increase the number of journal segments

Total time run:         600.045
Total writes made:      1613820
Write size:             4096
Object size:            4096
Bandwidth (MB/sec):     10.5059
Stddev Bandwidth:       1.21455
Max bandwidth (MB/sec): 15.332
Min bandwidth (MB/sec): 7.90625
Average IOPS:           2689
Stddev IOPS:            310.925
Max IOPS:               3925
Min IOPS:               2024
Average Latency(s):     0.0237941
Stddev Latency(s):      0.0165314
Max latency(s):         0.224455
Min latency(s):         0.000851744

C. Then decrease rewrite-dirty size

Total time run:         600.042
Total writes made:      1603626
Write size:             4096
Object size:            4096
Bandwidth (MB/sec):     10.4395
Stddev Bandwidth:       1.30485
Max bandwidth (MB/sec): 15.0664
Min bandwidth (MB/sec): 7.86719
Average IOPS:           2672
Stddev IOPS:            334.04
Max IOPS:               3857
Min IOPS:               2014
Average Latency(s):     0.0239452
Stddev Latency(s):      0.0170661
Max latency(s):         0.248981
Min latency(s):         0.000616932

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

@cyx1231st
cyx1231st requested a review from a team as a code owner May 18, 2022 02:50
@cyx1231st

Copy link
Copy Markdown
Member Author

Impacts to transaction conflicts (A, B, C):
1-A
1-B
1-C

@cyx1231st

Copy link
Copy Markdown
Member Author

Impacts to write amplification (A, B, C):
2-A
2-B
2-C

@cyx1231st

Copy link
Copy Markdown
Member Author

Impacts to Cleaner throttling (A, B, C):
3-A
3-B
3-C

@cyx1231st

Copy link
Copy Markdown
Member Author

TODO: perserve the original settings for tests.

@cyx1231st

cyx1231st commented May 18, 2022 •

Copy link
Copy Markdown
Member Author

@xxhdx1985126 after the configuration changes, the conflicts due to onode extents are much lower now, see
4

@xxhdx1985126 xxhdx1985126 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with this pr.

But I think we still need a machinery to deal with conflicts. The reason is as follows:

  1. We can't prove the this configuration works for all scenarios, when put into production environments, io workloads and other runtime environment factors may change from time to time and we can't manually change the configurations all the time, so, if we can implement some mechinary to solve this problem once and for all, wouldn't that be much better?
  2. In this pr, although we see much improvement on the transaction conflict part, we don't see proportional perf improvement, and according the previous tests, if we can reduce the transaction conflicts and not involve other perf bottleneck, we should see an according perf improvement, so I think changing these configurations can be actually reducing the transaction conflicts at the cost of introducing other bottlenecks, although I can't tell specifically what kind of bottlenecks for now.

Generally speaking, I think we should rely on foundamental architecture functions to avoid the conflicts when it's worth it. What do you think? @athanatos

@xxhdx1985126

Copy link
Copy Markdown
Member

@cyx1231st I think the reason that increasing the journal size can reduce the conflicts between gc transactions and io transactions is because the longer the journal is, the less possible that extents at the journal tail get modified by io transactions, am I right?

@cyx1231st

Copy link
Copy Markdown
Member Author

Adding my thoughts:

  • I think it is generally a good choice to increase the journal segment size if memory is enough, under the cost of a longer starting time;
  • These configurations can be exposed to ceph.conf for users to decide, and the best solution might be to decide and adjust them dynamically, but that can be trivial to implement;
  • The current SeaStore is bounded by CPU, not I/O, this is why the improvements to the write-amp is not proportional to the end-performance;

@cyx1231st

Copy link
Copy Markdown
Member Author

I think the reason that increasing the journal size can reduce the conflicts between gc transactions and io transactions is because the longer the journal is, the less possible that extents at the journal tail get modified by io transactions, am I right?

Yes, longer dirty buffer between trim and user transactions can decrease the changes of conflicts.

@xxhdx1985126

Copy link
Copy Markdown
Member

I think the rados bench test keep creating new rados objects, am I right?

@cyx1231st

Copy link
Copy Markdown
Member Author

What if users keep modifying a limited number of objects, which means the journal gets longer and longer, while the Cache::dirty_list is not? Every modification to the rados objects touches the OI_ATTR stored in onode entries.

Under this scenario, longer journal means each dirty extent can stash more mutations before rewrite. IIUC the overall trim efforts are decreased, so does the conflict.

@xxhdx1985126

Copy link
Copy Markdown
Member
  • These configurations can be exposed to ceph.conf for users to decide, and the best solution might be to decide and adjust them dynamically, but that can be trivial to implement;

I really doubt this, many people involve ML to do this kind of work, like SageDB.

@cyx1231st

cyx1231st commented May 18, 2022 •

Copy link
Copy Markdown
Member Author

I really doubt this, many people involve ML to do this kind of work, like SageDB.

Yeah, like I said, the automation work is trivial, but the configurations can still be exposed.

@xxhdx1985126

xxhdx1985126 commented May 18, 2022 •

Copy link
Copy Markdown
Member

Yeah, like I said, the automation work is trivial, but the configurations can still be exposed.

Yes, but that means, if any factor affecting the perf changes at the runtime, system administrators have to manually change the configurations. Chances are that this kind of change may happen frequently.

@xxhdx1985126

xxhdx1985126 commented May 18, 2022 •

Copy link
Copy Markdown
Member

Under this scenario, longer journal means each dirty extent can stash more mutations before rewrite. IIUC the overall trim efforts are decreased, so does the conflict.

No, I think, under this scenario, journal gets longer while the length of the dirty list stays still, so no matter how many mutations it holds before rewrite, the amount of the trim work stays the same.

I mean, although we change the target_journal_segments from 2 to 12, chances are that the dirty list in cache stays the same as when target_journal_segments is 2. Whether this happens is really user workload dependent. The trim workload depends on the length of the Cache's dirty list, am I right?

@cyx1231st

Copy link
Copy Markdown
Member Author

I mean, although we change the target_journal_segments from 2 to 12, chances are that the dirty list in cache stays the same as when target_journal_segments is 2.

If the target_journal_segments is changed from 2 to 12, trimming will not be started until the journal segments reaches 12 segments. Even if we only write to a limited number of extents, 12 journal segments can stash much more deltas than 2 journal segments. This means that each extent in the dirty list can bear more mutations before it is rewritten, in other words, there will be higher ratio of MUTATE to CLEANER_TRIM transactions, implying less overall CLEANER_TRIM efforts. Is that correct?

@cyx1231st

cyx1231st commented May 18, 2022 •

Copy link
Copy Markdown
Member Author

@xxhdx1985126 if I understand you correctly, you are referring to the following case:
Assume there is a kind of workload that causes OSD to only update a limited set of extents, say extent 1~100. So that the journal segments are filled with deltas to these 100 extents. And if these updates are uniform, journal trimming will always try to rewrite a certain number of dirty extents, no matter how long the journal segments are. So the conflicts won't be reduced by adding more journal segments.

But I'm not sure if this is a common or realistic workload in SeaStore. Even updating a limited range of object data will involve a considerable number of fresh data extents, and updating a limited range of object metadata will involve undeterministic side-affects about omap tree node split and merge, right?

Even if that case is possible, we can always mitigate the issue by decreasing the config rewrite_dirty_bytes_per_cycle, seems to me it is also effective to reduce conflicts between MUTATE and CLEANER_TRIM transactions referring to the above analysis, correct?

@xxhdx1985126

xxhdx1985126 commented May 18, 2022 •

Copy link
Copy Markdown
Member

But I'm not sure if this is a common or realistic workload in SeaStore. Even updating a limited range of object data will involve a considerable number of fresh data extents, and updating a limited range of object metadata will involve undeterministic side-affects about omap tree node split and merge, right?

I actually think this is a very common case, there are always hot zones on disk where user modifications targets right? I think few user would create a workload that access the whole disk space with uniformal probability. Am I right? The hotter those zones are, the less this configuration change would work, am I right?

And even if users access their disk space uniformally, if user data only fills a relative small part of the seastore disk space, we can still see the same effect.

Even if that case is possible, we can always mitigate the issue by decreasing the config rewrite_dirty_bytes_per_cycle, seems to me it is also effective to reduce conflicts between MUTATE and CLEANER_TRIM transactions referring to the above analysis, correct?

Yes, I actually think increasing journal size also have its advantage in the most strict scenario, but we need to test it to see how far it can go. I'm working on that part now, to see how well this kind of configuration adjustment can work in the above cases.

@cyx1231st

Copy link
Copy Markdown
Member Author

Real test results are more convincing than just debates.

BTW, @xxhdx1985126 do you have quick scripts to test the scenario "users keep modifying a limited number of objects"? I can also test it locally.

@xxhdx1985126

xxhdx1985126 commented May 18, 2022 •

Copy link
Copy Markdown
Member

BTW, @xxhdx1985126 do you have quick scripts to test the scenario "users keep modifying a limited number of objects"? I can also test it locally.

I don't have much scripts since the test is relative simple. I'm using the rbd interface, create a rbd image, and use fio to issue uniformal random writes to it. That's pretty much of it:-)

@athanatos

Copy link
Copy Markdown
Contributor

I actually think this is a very common case, there are always hot zones on disk where user modifications targets right? I think few user would create a workload that access the whole disk space with uniformal probability. Am I right? The hotter those zones are, the less this configuration change would work, am I right?

Hot rbd lba ranges for rbd images would indeed be common (though time varying). This does not at all mean that rbd lba ranges will on average be accessed with uniform probability. It certainly does not mean that all sesatore lba will be accessed with uniform probability.

Increasing the journal length should proportionately reduce journal rewrite work independently of workload since each extent rewritten would have seen a proportionately larger number of updates since the last rewrite.

I don't think there are any scenarios where this wouldn't help.

@athanatos

Copy link
Copy Markdown
Contributor

@xxhdx1985126 If decreasing conflict rate doesn't improve throughput, I think it suggests that the conflicts probably weren't the bottleneck. In general, it's a lot better to reduce the instance of conflicts as here than is it to reduce the cost of conflicts. Regardless of how we deal with them -- whether via locking or via retry -- it'll always be better for transactions to, on average, access disjoint extents.

@cyx1231st Can we update the unit tests to keep the super low values? We want the unit tests to do at least some journal rewriting.

@athanatos

Copy link
Copy Markdown
Contributor

@xxhdx1985126 if I understand you correctly, you are referring to the following case: Assume there is a kind of workload that causes OSD to only update a limited set of extents, say extent 1~100. So that the journal segments are filled with deltas to these 100 extents. And if these updates are uniform, journal trimming will always try to rewrite a certain number of dirty extents, no matter how long the journal segments are. So the conflicts won't be reduced by adding more journal segments.

Making the journal longer does help in this case. Because the journal is longer, each rewritten extent required a larger number of mutations (proportional to the longer journal length) before it's rewritten. Thus, each rewrite represents a proportionately smaller share of overall work per IO.

@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 except for keeping the old values for unit tests.

@xxhdx1985126

xxhdx1985126 commented May 18, 2022 •

Copy link
Copy Markdown
Member

Making the journal longer does help in this case. Because the journal is longer, each rewritten extent required a larger number of mutations (proportional to the longer journal length) before it's rewritten. Thus, each rewrite represents a proportionately smaller share of overall work per IO.

Yeah, I understand that, my point is that it may not help so much that we don't need to do anything else. According to my tests, increasing the journal size can reduce about half of the conflicts in the rbd use cases, but we still see a relatively high conflict rate. And increasing it further actually made things worse. I'll share my analysis once I confirm that the test results are correct.

On the other hand, besides the journal trimming, space reclamation also gets invalidated 2~3 times per reclaim cycle before the available disk space runs out, and according to my analysis: https://gist.github.com/xxhdx1985126/1c49d0de2a8590aed5d62e611cbc63cd#duration-of-space-reclamation, we should be able to benefit a lot from avoiding those conflicts. And this configuration change doesn't seem to help space reclamation.

So, my whole point is that we still need to implement some machinery to avoid invalidations.

@xxhdx1985126

Copy link
Copy Markdown
Member

Hot rbd lba ranges for rbd images would indeed be common (though time varying). This does not at all mean that rbd lba ranges will on average be accessed with uniform probability. It certainly does not mean that all sesatore lba will be accessed with uniform probability.

I think that's exactly what I meant, "few users would generate a workload that access the whole disk space with uniformal probability"

@athanatos

Copy link
Copy Markdown
Contributor

Hot rbd lba ranges for rbd images would indeed be common (though time varying). This does not at all mean that rbd lba ranges will on average be accessed with uniform probability. It certainly does not mean that all sesatore lba will be accessed with uniform probability.

I think that's exactly what I meant, "few users would generate a workload that access the whole disk space with uniformal probability"

Ah, right!

@cyx1231st

Copy link
Copy Markdown
Member Author

@cyx1231st Can we update the unit tests to keep the super low values? We want the unit tests to do at least some journal rewriting.

Sure, I plan to implement this in this PR.

Hot rbd lba ranges for rbd images would indeed be common (though time varying).

I'll also test this case myself, here is what I thought about the scenario:

  • Our configuration set the disk size to 50G, so I'll create a rbd image of 1G and generate random write into this image;
  • Before that, I'll do warm up to make sure the tree depth of onode-tree and lba-tree is above 3;

@athanatos

Copy link
Copy Markdown
Contributor

More direct way to do it would be for fio to do random writes to a 1gb portion of a pre-populated 50gb image.

@xxhdx1985126

xxhdx1985126 commented May 19, 2022 •

Copy link
Copy Markdown
Member

More direct way to do it would be for fio to do random writes to a 1gb portion of a pre-populated 50gb image.

I'm testing this case, but it seems that this triggers a drawback in the backref batch insert process that leads to reclaim transactions exceeding the 64MB(segment size) threshold. I'm trying to fix it, right now.

@cyx1231st
cyx1231st force-pushed the wip-seastore-tune-cleaner branch from bab6416 to 7749278 Compare May 19, 2022 02:45
@github-actions github-actions Bot added the tests label May 19, 2022
@xxhdx1985126

Copy link
Copy Markdown
Member

On the other hand, besides the journal trimming, space reclamation also gets invalidated 2~3 times per reclaim cycle before the available disk space runs out, and according to my analysis: https://gist.github.com/xxhdx1985126/1c49d0de2a8590aed5d62e611cbc63cd#duration-of-space-reclamation, we should be able to benefit a lot from avoiding those conflicts. And this configuration change doesn't seem to help space reclamation.

@athanatos Hi, sam, I wonder what you think about my comment above, am I right about that? Thanks.

@cyx1231st

Copy link
Copy Markdown
Member Author

@cyx1231st Can we update the unit tests to keep the super low values? We want the unit tests to do at least some journal rewriting.

Done.

@athanatos

Copy link
Copy Markdown
Contributor

On the other hand, besides the journal trimming, space reclamation also gets invalidated 2~3 times per reclaim cycle before the available disk space runs out, and according to my analysis: https://gist.github.com/xxhdx1985126/1c49d0de2a8590aed5d62e611cbc63cd#duration-of-space-reclamation, we should be able to benefit a lot from avoiding those conflicts. And this configuration change doesn't seem to help space reclamation.

@athanatos Hi, sam, I wonder what you think about my comment above, am I right about that? Thanks.

Yes, this change will not affect that. Identifying precisely what impacts that conflict rate is probably the next step.

@athanatos

Copy link
Copy Markdown
Contributor

Just merged the CBJournal PR, needs to be rebased.

@xxhdx1985126

xxhdx1985126 commented May 19, 2022 •

Copy link
Copy Markdown
Member

Yeah, I understand that, my point is that it may not help so much that we don't need to do anything else. According to my tests, increasing the journal size can reduce about half of the conflicts in the rbd use cases, but we still see a relatively high conflict rate. And increasing it further actually made things worse. I'll share my analysis once I confirm that the test results are correct.

@cyx1231st @athanatos I think I have to admit that this pr works well in case of rbd, it turns out that I was measuring conflicts per journal trim cycle and saw that we still have about 6~8 conficts per trim cycle, which led me to the above conclusion. However, the avg trim cycles per second drops from 133.3250 to 1.6187, and the time it takes to fill the disk space is increased from about 880 seconds to about 1800 seconds. And conflicts on onode extents are also reduced dramatically.

2 target journal segments
image

24 target journal segments
image

So if you are testing this pr just to see if it works well in cases of rbd, don't bother. I'm really sorry for causing these extra work.

BTW, since prefilling data isn't available on my testbed, I'm showing the non-data-prefilled test result after both the lba and onode trees' depth reaches 3.

@athanatos

Copy link
Copy Markdown
Contributor

@xxhdx1985126 No worries from my side at least! FWIW, I agree that we likely do have more work to do with 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

Copy link
Copy Markdown
Member Author

No worries @xxhdx1985126, I'll still need this workload to work on the generational GC.

@cyx1231st

Copy link
Copy Markdown
Member Author

Just merged the CBJournal PR, needs to be rebased.

Will rebase after #46334 is merged.

@cyx1231st

Copy link
Copy Markdown
Member Author

and the time it takes to fill the disk space is increased from about 880 seconds to about 1800 seconds

@xxhdx1985126 do you mean that the end performance becomes worse in your test result?

@xxhdx1985126

Copy link
Copy Markdown
Member

@xxhdx1985126 do you mean that the end performance becomes worse in your test result?

Oh, no, I meant the gc performance is better, so the disk space runs out slower.

@cyx1231st
cyx1231st force-pushed the wip-seastore-tune-cleaner branch from 7749278 to 6a4f0e3 Compare May 19, 2022 09:04
@cyx1231st

Copy link
Copy Markdown
Member Author

rebased

@athanatos
athanatos merged commit 449a1e1 into ceph:master May 20, 2022
@cyx1231st
cyx1231st deleted the wip-seastore-tune-cleaner branch May 20, 2022 02:20
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