Ceph blog stories provide high-level spotlights on our customers all over the world
Ceph’s use of mClock was primarily experimental and approached with an exploratory mindset. This is still true with other organizations and individuals continuing to either use the code base or modifying it according to their needs.
DmClock exists in its own repository. Prior to the Ceph Pacific release, mClock could be enabled by setting the
osd_op_queue Ceph option to “mclock_scheduler”. Additional parameters like reservation, weight and limit for each service type could be set using Ceph options. For example,
osd_mclock_scheduler_client_[res,wgt,lim] is one such option. See the OSD config reference for more details. Even with all the mClock options set, the full capability of mClock could not be realized due to,
To resolve the above, refinements were made to the mClock scheduler in the Ceph code base. See mClock config reference. With the refinements, the usage of mClock is a bit more user friendly and intuitive. This is one step of many to refine and optimize the way mClock is used in Ceph.
A comparison study was performed as part of efforts to refine the mClock scheduler. The study involved running tests with client ops and background recovery operations in parallel with the two schedulers. The results were collated and then compared. The following statistics were compared between the schedulers from the test results:
Ceph cbt was used to test the recovery scenarios. A new recovery test to generate background recoveries with client I/Os in parallel was created. See the next section for the detailed test steps. For comparison purposes, the test was executed 3 times with the default Weighted Priority Queue (WPQ) scheduler. This was done to establish a credible mean value to compare the results with the mClock scheduler at a later point.
Post this, the same test was executed with mClock scheduler and with different mClock profiles i.e. high_client_ops, balanced and high_recovery_ops and the results collated for comparison. With each profile, the test was executed 3 times and the average of those runs are reported in this study.
Tests with HDDs was performed with and without the bluestore WAL and dB configured. The charts discussed further below help bring out the comparison across the schedulers and their configurations.
Before the actual recovery tests, the baseline throughput was established for both the SSDs and the HDDs on the test machine by following the steps mentioned in the mClock config reference document under “Benchmarking Test Steps Using CBT” section. For this study, the following baseline throughput for each device type was determined:
|Device Type||Baseline Throughput(@4KiB Random Writes)|
|NVMe SSD||21500 IOPS (84 MiB/s)|
|HDD (with bluestore WAL & dB)||340 IOPS (1.33 MiB/s)|
|HDD (without bluestore WAL & dB)||315 IOPS (1.23 MiB/s)|
bluestore_throttle_deferred_bytes for SSDs was determined to be 256 KiB. For HDDs, it was 40MiB. The above throughput was obtained by running 4 KiB random writes at a queue depth of 64 for 300 secs.
The services using mClock have a cost associated with them. The cost can be different for each service type. The mClock scheduler factors in the cost during tag calculations for parameters like reservation, weight and limit. The tag calculations determine when the next op for the service type can be dequeued from the operation queue. In general, the higher the cost, the longer an op remains in the operation queue.
A cost modelling study was performed to determine the cost per I/O and the cost per byte for SSD and HDD device types. These are set as Ceph options and used under the hood by mClock,
See mClock config reference for more details on the values set for each of the above options.
The low-level mClock shares per profile are shown in the tables below. For parameters like reservation and limit, the shares are represented as a percentage of the total OSD capacity. For the high_client_ops profile, the reservation parameter is set to 50% of the total OSD capacity. Therefore, for the NVMe(baseline 21500 IOPS) device a minimum of 10750 IOPS is reserved for client operations. These allocations are made under the hood once a profile is enabled.
The weight parameter is unitless. See OSD config reference.
This profile allocates more reservation and limit to external clients ops when compared to background recoveries and other internal clients within Ceph. This profile is enabled by default.
|background best effort||25%||1||MAX|
This profile allocates equal reservations to client ops and background recovery ops. The internal best effort client get a lower reservation but a very high limit so that they can complete quickly if there are no competing services.
|background best effort||20%||1||MAX|
This profile allocates more reservation to background recoveries when compared to external clients and other internal clients within Ceph. For example, an admin may enable this profile temporarily to speed-up background recoveries during non-peak hours.
|background best effort||1 (MIN)||1||MAX|
The custom profile allows the user to have complete control of the mClock and Ceph config parameters. To use this profile, the user must have a deep understanding of the workings of Ceph and the mClock scheduler. All the reservation, weight and limit parameters of the different service types must be set manually along with any Ceph option(s). This profile may be used for experimental and exploratory purposes or if the built-in profiles do not meet the requirements. In such cases, adequate testing must be performed prior to enabling this profile.
Before bringing up the Ceph cluster, the following mClock configuration parameters were set appropriately based on the obtained baseline throughput from the previous section:
To summarize, the steps above creates 2 pools during the test. Recovery is triggered on one pool and client I/O is triggered on the other simultaneously. Statistics captured during the tests are discussed below.
Apart from the non-default bluestore throttle already mentioned above, the following set of Ceph recovery related options were modified for tests with both the WPQ and mClock schedulers.
The above options puts a high limit on the number of concurrent local and remote backfill operations per OSD. It is under these conditions that the capabilities of the mClock scheduler is tested and discussed below.
Fig 1 shows the average client throughput comparison across the schedulers and their respective configurations.
WPQ(def) in the chart shows the average client throughput obtained using the WPQ scheduler with all other Ceph configuration settings set to default values. The default setting for
osd_max_backfills limits the number of concurrent local and remote backfills or recoveries per OSD to 1. As a result, the average client throughput obtained is impressive at just over 18000 IOPS when compared to the baseline value which is 21500 IOPS.
However, with WPQ scheduler along with non-default options mentioned above, things are quite different as shown in the chart for WPQ(BST). In this case, the average client throughput obtained drops dramatically to only 2544 IOPS. The non-default recovery options clearly had a significant impact on the client throughput. In other words, recovery operations overwhelm the client operations. Sections further below discuss the recovery rates under these conditions.
With the non-default options, the same test was executed with mClock and with the default profile(high_client_ops) enabled. As per the profile allocation, the reservation goal of 50% (10750 IOPS) is being met with an average throughput of 11209 IOPS during the course of recovery operations. This is more than 4x times the throughput obtained with WPQ(BST).
Similar throughput with the balanced(11017 IOPS) and high_recovery_ops (11153 IOPS) profile was obtained as seen in the chart above. This clearly demonstrates that mClock is able to provide the desired QoS for the client with multiple concurrent backfill/recovery operations in progress.
Fig 2 shows the average completion latency (clat) along with the average 95th, 99th and 99.5th percentiles across the schedulers and their respective configurations.
The average clat latency obtained with WPQ(Def) was 3.535 msec. But in this case the number of concurrent recoveries was very much limited at an average of around 97 objects/sec or ~388 MiB/s and a major contributing factor to the low latency seen by the client.
With WPQ(BST) and with the non-default recovery options, things are very different with the average clat latency shooting up to an average of almost 25 msec which is 7x times worse! This is due to the high number of concurrent recoveries which was measured to be ~350 objects/sec or ~1.4 GiB/s which is close to the maximum OSD bandwidth.
With mClock enabled and with the default high_client_ops profile, the average clat latency was 5.688 msec which is impressive considering the high number of concurrent active background backfill/recoveries. The recovery rate was throttled down by mClock to an average of 80 objects/sec or ~320 MiB/s according to the minimum profile allocation of 25% of the maximum OSD bandwidth thus allowing the client operations to meet the QoS goal.
With the other profiles like balanced and high_recovery_ops, the average client clat latency didn’t change much and stayed between 5.7 – 5.8 msec with variations in the average percentile latency as observed from the chart above.
Perhaps a more interesting chart is the comparison chart shown in Fig 3 that tracks the average clat latency variations through the duration of the test. The chart shows the differences in the average latency between the WPQ and mClock profiles). During the initial phase of the test, for about 150 secs, the differences in the average latency between the WPQ scheduler and across the profiles of mClock scheduler are quite evident and self explanatory. The high_client_ops profile shows the lowest latency followed by balanced and high_recovery_ops profiles. The WPQ(BST) had the highest average latency through the course of the test.
Another important aspect to consider is how the recovery bandwidth and recovery time are affected by mClock profile settings. Fig 4 outlines the recovery rates and times for each mClock profile and how they differ with the WPQ scheduler. The total number of objects to be recovered in all the cases was around 75000 objects as observed in the chart below.
Intuitively, the high_client_ops should impact recovery operations the most and this is indeed the case as it took an average of 966 secs for the recovery to complete at 80 Objects/sec. The recovery bandwidth as expected was the lowest at an average of ~320 MiB/s.
The balanced profile provides a good middle ground by allocating the same reservation and weight to client and recovery operations. The recovery rate curve falls between the high_recovery_ops and high_client_ops curves with an average bandwidth of ~480 MiB/s and taking an average of ~647 secs at ~120 Objects/sec to complete the recovery.
The high_recovery_ops profile provides the fastest way to complete recovery operations at the expense of other operations. The recovery bandwidth was nearly 2x the bandwidth at ~635 MiB/s when compared to the the bandwidth observed using the high_client_ops profile. The average object recovery rate was ~159 objects/sec and completed the fastest in approximately 488 secs.
The recovery tests were performed on HDDs with bluestore WAL and dB configured on faster NVMe SSDs. The baseline throughput measured was 340 IOPS.
The average client throughput comparison and latency for WPQ and mClock and its profiles are shown in Fig 6 & 7.
With WPQ(Def), the average client throughput obtained was ~308 IOPS since the the number of concurrent recoveries was very much limited. The average clat latency was ~208 msec.
However for WPQ(BST), due to concurrent recoveries client throughput is affected significantly with 146 IOPS and an average clat latency of 433 msec.
With the high_client_ops profile, mClock was able to meet the QoS requirement for client operations with an average throughput of 271 IOPS which is nearly 80% of the baseline throughput at an average clat latency of 235 msecs.
For balanced and high_recovery_ops profiles, the average client throughput came down marginally to ~248 IOPS and ~240 IOPS respectively. The average clat latency as expected increased to ~258 msec and ~265 msec respectively.
The clat latency comparison chart in Fig 8 provides a more comprehensive insight into the differences in latency through the course of the test. As observed with the NVMe SSD case, high_client_ops profile shows the lowest latency in the HDD case as well followed by the balanced and high_recovery_ops profile. It’s fairly easy to discern this between the profiles during the first 200 secs of the test.
The charts in Fig 9 & 10 compares the recovery rates and times. The total number of objects to be recovered in all the cases using HDDs with WAL and dB was around 4000 objects as observed in the chart below.
As expected, the high_client_ops impacts recovery operations the most as it took an average of ~1409 secs for the recovery to complete at ~3 Objects/sec. The recovery bandwidth as expected was the lowest at ~11 MiB/s.
The balanced profile as expected provides a decent compromise with an an average bandwidth of ~16.5 MiB/s and taking an average of ~966 secs at ~4 Objects/sec to complete the recovery.
The high_recovery_ops profile is the fastest with nearly 2x the bandwidth at ~21 MiB/s when compared to the high_client_ops profile. The average object recovery rate was ~5 objects/sec and completed in approximately 747 secs. This is somewhat similar to the recovery time observed with WPQ(Def) at 647 secs with a bandwidth of 23 MiB/s and at a rate of 5.8 objects/sec.
The recovery tests were also performed on HDDs without bluestore WAL and dB configured. The baseline throughput measured was 315 IOPS.
This type of configuration without WAL and dB configured is probably rare but testing was nevertheless performed to get a sense of how mClock performs under a very restrictive environment where the OSD capacity is at the lower end. The sections and charts below are very similar to the ones presented above and are provided here for reference.
The average client throughput, latency and percentiles are compared as before in the set of charts shown below.
The recovery rates and times are shown in the charts below.
The study so far shows promising results with the refinements made to the mClock scheduler. Further refinements to mClock and profile tuning are planned. Further improvements will also be based on feedback from broader testing on larger clusters and with different workloads.