CCoW: Optimizing Copy-on-Write Considering The Spatial Locality in Workloads Part 6

Apr 03, 2024

The best region size and the threshold vary according to the workload characteristics. To evaluate the influence of workload, we measure the performance of CCoW on the workloads with various localities. Specifically, we changed the parameter α of the Zipf distribution, which determines the degree of locality.

There is a close relationship between human memory and workload. When we need to process large amounts of information or complete complex tasks, our brains must remain highly vigilant to ensure that all necessary information is processed and stored correctly. Neurons in the brain are constantly connecting and communicating, which greatly affects the way we think and remember.

While processing large amounts of information and completing complex tasks can challenge our memory and cognitive abilities, research shows that with proper training and practice, we can significantly improve our memory and productivity. For example, through experiments, scientists have discovered that through extensive memory training and practice, people can significantly improve their memory and work efficiency.

From this perspective, we can conclude that continuous practice and training are very important for those who want to improve their memory and work efficiency. Also, keep a positive attitude, as stress can hamper one's memory and productivity.

In summary, there is a strong correlation between workload and memory. As long as we stay focused, train and practice regularly, and maintain a positive attitude, we can significantly improve our memory and work efficiency. Cistanche deserticola can also regulate the balance of neurotransmitters, such as increasing levels of acetylcholine and growth factors, which are important for memory and learning. In addition, Cistanche deserticola can also improve blood flow and promote oxygen delivery, which can ensure that the brain receives sufficient nutrients and energy, thereby improving brain vitality and endurance.

supplements to improve memory

Click know ways to improve your memory

The accesses are distributed uniformly when α is 0, and the higher the value of α, the higher the level of locality the workload exhibits. When α is 1.0, approximately 80% of the operations involve 20% of the data. 

This degree of locality is commonly found in several real workloads, as the Pareto principle states. We measure with three different α values, 1.0, 0.9, and 1.1, where 1.0 is the baseline, and 0.9 and 1.1 represent the low- and high-locality workload, respectively. 

The original CoW performance varies according to the workloads, so the fork period for a workload was set according to the time measured with the original CoW setup. For example, if the original CoW configuration requires 10 seconds to recover the normal performance after a fork, the other CCoW configurations also fork child processes every 10 s. 

Figure 5 summarizes the average throughput and memory usage of CCoW with different locality workloads. For the low-locality workload, the configurations with small CCoW thresholds exhibit better performance than those with large thresholds. 'CCoW-all' even outperforms the original CoW by 15% in the low-locality workload. This is due to the effectiveness of the precopy. In the low-locality workload, a large part of memory should be replicated as accesses are spread over the entire process address space. In effect, copying entire regions results in the copying of the necessary memory in advance with low overhead. 

improve brain

Thus, the smaller the threshold is, the higher the performance of the program with the low-locality workload. However, this trend has the opposite effect with high-locality workloads. With high-locality workloads, many accesses are focused on a few pages. 

This implies that only a small part of memory needs to be replicated throughout the copyon-write. Copying the entire region on a page fault tends to copy the pages that are not accessed at all. 

This only incurs a temporal overhead, impairing the performance with higher-locality workloads. As a result, CCoW-all exhibits the worst performance with the high-locality workload. Other configurations show similar patterns of baseline workloads; the performance peaks at the threshold value of 80% and declines with smaller thresholds.

improving brain function

The memory usage of the benchmark shows a consistent trend regardless of the degree of locality of the workloads. 'CCoW-all' always represents the highest memory usage because it always copies all pages in the memory after a fork. Besides that, the memory footprints are inversely proportional to the threshold value; the smaller the threshold value is, the more memory the benchmark utilizes. 

The memory amplification is only increased by up to 10% compared to the original CoW configuration, which is considered to be in a reasonable range. In addition to analyzing the performance of CCoW, we compare the performance of CCoW to that of the transparent huge page (THP) scheme of Linux. 

THP is somewhat similar to CCoW in that it aims at mitigating the overhead originating from small pages. 'CoW-THP' in Figure 5 represents the performance of the THP-enabled configuration. Note that the THP-enabled system handles CoW by splitting huge pages into base pages before copying the faulty page, and so do other schemes optimizing THP [12–15,17]. 

We can observe that THP exhibits better performance than the default 'CoW-only' configuration. We attribute the performance gain to the increased efficiency in address translation with huge pages. 

Specifically, according to the THP scheme, the hot part of the process address space is likely to be broken into base pages, thereby providing the same performance as the 'CoW-only' configuration. However, the cold part of the process address space is not split, and maintained with huge pages. Thus, this can boost the application performance to some extent. 

However, THP does not provide as much performance improvement as CCoW does. Figure 6 shows the cumulative distribution of the throughput during the evaluation. The x-axis represents the throughput in operations per second, and the y-axis represents the cumulative ratio of the performance to the throughput value. Except for CCoW-all, we can find three frequently observed throughput ranges regardless of the configurations. 

The first group in the cumulative ratio of 0 to 0.1 indicates the period during which the benchmark performance declines right after the fork. Then the performance recovers over time, as in the second group with a cumulative ratio of 0.1 to 0.7. 

The remaining cumulative ratios in the range of 0.7 to 1.0 are from accesses that do not incur page faults. Overall, CCoW configurations tend to have more severe performance drops than the original CoW. Specifically, with the high-locality workload of the original CoW scheme, the throughput drops to approximately 1900 K operations per second right after the fork. 

improve memory

It then slowly ramps up to the 2500 K operations per second range. With CCoW, the performance dropped more, to the 1700 K operations per second range. However, the performance recovered faster, demonstrating better performance than the original CoW most of the time (i.e., mostly on the right-hand side of the cumulative graph). We can observe a similar trend from other workloads as well, and CCoW-all configuration demonstrates extreme behavior; right after the fork the performance drops significantly and stays low while most of the address space is copied with spread accesses. 

After that point, however, only a few page faults occur, so most accesses are processed without page faults. Thus, the throughput has a bimodal distribution in CCoW. From this evaluation, we confirmed that CCoW provides optimal performance by optimizing the common case. 

However, the performance drop should be addressed to obtain better performance characteristics. To this end, we are currently working on throttling the amount of copied data right after the fork.

supplements to boost memory

4.2. CCoW Performance on Realistic Workload

To evaluate the proposed CCoW on a realistic workload, we used the Redis and YCSB. The Redis is an in-memory key-value database widely used for accelerating Internet-scale applications. 

We used the YCSB Benchmark to populate key-value pairs in a Redis instance and to perform operations on them. Specifically, the Redis instance is initialized with 10 GB of key-value pairs with the default YCSB configuration. 

All keys and values are 23 and 100 bytes in size, respectively, and each key contains 10 fields of values. After populating the Redis instance, we configured it to make snapshots and then fed update operations with YCSB. 

To incorporate the temporal locality in the key-value accesses, we set up the YCSB workload to select target keys according to the Zip distribution using the parameter value of 1.0. 

While making 100 GB of updates, we collected the throughput for every second of the YCSB benchmark report. Figure 7 summarizes the average throughput and memory usage of the Redis instance when the system is configured to use the original CoW or CCoW. Note that we used 2 MB for the region size, and all result values were normalized to that of CoW.

improve cognitive function

Overall, all CCoW configurations outperformed the original CoW, regardless of the coverage threshold. Likewise, as we analyzed above, the performance was determined by the trade-off between the performance gain from the mitigated copy-on-write and the overhead of copying additional pages. When the threshold value is high, only a few regions are copied, making both the optimization opportunity and the memory overhead small. 

When the threshold value decreases below 85%, the memory footprint increases and incurs more overhead. As a result, the average throughput of CCoW varies according to the coverage threshold but demonstrates up to 5% performance improvement compared to the original CoW. 

With the Redis and YCSB workload, we observed only a marginal performance improvement with THP. This is due to that, in the workload, write accesses are scattered all over the process address space, and huge pages are effectively split into base pages while handling CoW. 

As the Redis process can have only a few huge pages, its performance is similar to that of the base configuration. This result demonstrates that the THP-based approach is less effective in write-intensive workloads, and CCoW outperforms THP. 

To evaluate the accuracy of the mechanism in identifying high-locality regions, we classified the reason for the copy-generating mechanism for each copied page. Specifically, we collected the ratio of copied pages out of all copied pages. When the precopy ratio is x%, increasing the total memory footprint by y%, we can calculate the ratio of unnecessary precopy by dividing y by x. 

For example, on the CCoW-80 configuration, 26.9% of copied pages are copied, increasing the memory footprint by 6.7%. This implies that 24.9% of the pre-copy pages are not referenced. Table 1 summarizes the calculation. The unnecessary precopy ratio ranges from 23.4% to 35.6%, and from the evaluation result it can be concluded that the proposed scheme accurately captures high-locality regions.

improve working memory

5. Conclusions

In this study, we proposed CCoW, an optimized copy-on-write scheme for workloads with high spatial locality. CCoW divides the process address space into regions and estimates their locality with the coverage. 

A write to a high-locality region leads the page fault handler to precopy nearby pages. To properly track the coverage after the pre-copy, CCoW leverages the dirty bit in the page table. Evaluation with benchmarks confirmed that the proposed scheme can identify high-locality regions with small overhead, enabling performance gain from applications without modification. 

As we mentioned, the performance drops significantly right after the fork due to the huge amount of data to copy. We are currently working on managing the performance drop by throttling the rate of pre-copy and performing the pre-copy asynchronously. We are also planning to incorporate an adaptive mechanism that tunes the configuration parameters according to the characteristics of the current workload.

Author Contributions: Conceptualization, M.H. and S.-H.K.; methodology, M.H.; software, M.H.; validation, M.H., and S.-H.K.; formal analysis, M.H., and S.-H.K.; investigation, M.H., and S.-H.K.; resources, S.-H.K.; data curation, M.H.; writing-original draft preparation, M.H.; writing-review and editing, M.H. and S.-H.K.; visualization, M.H.; supervision, S.-H.K.; project administration, S.-H.K.; funding acquisition, S.-H.K. All authors have read and agreed to the published version of the manuscript.

boost memory

Funding: This research was supported by an Electronics and Telecommunications Research Institute (ETRI) grant funded by the Korean government (20ZS1310) and the BK21 FOUR program of the National Research Foundation of Korea funded by the Ministry of Education (NRF5199991014091).

Institutional Review Board Statement: Not applicable.

Informed Consent Statement: Not applicable.

Data Availability Statement: Not applicable.

Conflicts of Interest: The authors declare no conflict of interest.


References
1. Gorman, M. Understanding the Linux Virtual Memory Manager; Prentice Hall: Upper Saddle River, NJ, USA, 2007. 

2. Bovet, D.P.; Cesati, M. Understanding the Linux Kernel; O'Reilly: Newton, MA, USA, 2001. 

3. Love, R. Linux Kernel Development, 3rd ed.; Addison Wesley: Boston, MA, USA, 2010. 

4. Labs, R. Redis. Available online: https://github.com/redis/redis (accessed on 7 June 2021). 

5. Silberschatz, A.; Galvin, P.B.; Gagne, G. Operating System Concepts; Addison-Wesley Longman Publishing Co., Inc.: Boston, MA, USA, 2018. 

6. Harris, S.L.; Harris, D. Digital Design and Computer Architecture; Morgan Kaufmann: Burlington, MA, USA, 2022. 

7. Abi-Chahla, F. Intel Core i7 (Nehalem): Architecture By AMD? Available online: https://www.tomshardware.com/reviews/ Intel-i7-nehalem-cpu,2041.html (accessed on 18 October 2021). 

8. Pham, B.; Bhattacharjee, A.; Eckert, Y.; Loh, G.H. Increasing TLB reach by exploiting clustering in page translations. In Proceedings of the 2014 IEEE 20th International Symposium on High-Performance Computer Architecture (HPCA'14), Orlando, FL, USA, 15–19 February 2014; pp. 558–567.


For more information:1950477648nn@gmail.com

You Might Also Like