Dev

Linux Cache Aware Scheduling Extension Speeds Up MySQL by up to 360%

According to Phoronix, an extended patch for Cache Aware Scheduling merged into Linux Kernel 7.2 has achieved up to 360% performance gains in MySQL.

4 min read Reviewed & edited by the SINGULISM Editorial Team

Linux Cache Aware Scheduling Extension Speeds Up MySQL by up to 360%
Photo by Brian Kostiuk on Unsplash

According to a report by Phoronix, an extended patch for Cache Aware Scheduling (CAS), which was merged into the Linux Kernel last week, has been submitted to the kernel mailing list. The patch, provided by Hygon, enhances CAS by introducing topology-aware hierarchical task aggregation, resulting in significant performance improvements in benchmarks.

The improvements include up to 49% in Hackbench, 20% in Schbench, and an impressive 360% in MySQL. These results highlight the potential of CAS when its current limitations are addressed.

The Evolution of Schedulers and

Fundamentals of CAS

CAS is a mechanism designed for modern CPUs with multiple cache domains. It ensures that tasks sharing data are placed within the same Last Level Cache (LLC) domain. By making the scheduler cache-aware, CAS reduces cache misses and cache bounces, thereby improving overall throughput.

The current CAS model relies on task aggregation within a single LLC domain. While effective for workloads confined to one LLC domain, the scheduler struggles to maintain locality when aggregation to higher domains is required, leading to performance bottlenecks.

Hygon’s Proposal for Hierarchical Aggregation

The patch proposed by Hygon fundamentally addresses this limitation. It introduces a hierarchical mechanism for aggregation, allowing the scheduling domains to dynamically expand or contract. This design adjusts the aggregation scope based on workload size and system topology.

Specifically, it enables task aggregation across larger cache hierarchies or even at the NUMA node level, beyond individual LLC domains. This is expected to significantly enhance performance in large-scale database operations and virtualized environments spanning multiple LLCs.

Analysis of Benchmark Results

The published benchmarks reported the following performance improvements:

  • Hackbench: Up to a 49% performance boost. This process scheduling benchmark benefited from reduced task context switching and cache contention.
  • Schbench: Up to a 20% improvement. An enhanced task allocation strategy improved performance under scheduler load tests.
  • MySQL: Up to a 360% performance boost. Database workloads, which exhibit pronounced shared data access patterns, show the most significant gains from CAS. The improved cache hit rate directly translated into throughput gains in transaction processing and query execution.

It’s worth noting that these figures represent maximum values under specific conditions, and similar improvements may not be observed across all workloads. However, the clear direction of improvement is noteworthy.

Technical Significance and Practicality

This extension marks a significant evolution in Linux Kernel scheduling, allowing it to better understand and dynamically adapt to hardware cache hierarchies. The benefits are expected to be particularly pronounced in areas where shared cache efficiency is critical, such as database servers, high-performance computing (HPC), and virtualization platforms.

It’s also noteworthy that Hygon, a Chinese x86 processor manufacturer, proposed this patch optimized for their own CPU architecture. This suggests that CAS has the potential to function as a vendor-independent, general-purpose framework.

Editorial Opinion

In the short term, if this patch aims for inclusion in Linux 7.3, it represents a highly anticipated improvement for database operators. Databases like MySQL, MariaDB, and PostgreSQL, which rely on shared memory structures, could experience dramatic performance gains. If integrated into the kernel within the next 3–6 months, its adoption by cloud providers and enterprises could accelerate.

From a long-term perspective, the expansion of CAS might influence CPU design itself. It could prompt manufacturers like Intel and AMD to explore architectures that integrate cache hierarchies with OS schedulers. Additionally, this improvement could have ripple effects on resource management in containerized and Kubernetes environments.

As an editorial team, we are keen to see more data on the reproducibility and general applicability of these benchmark results. While the reported gains are dramatic under specific hardware configurations and workloads, it remains uncertain how effective the patch will be across diverse real-world environments. Further discussions on the kernel mailing list and the release of additional benchmark data will be critical.

References

Frequently Asked Questions

On which CPUs is Cache Aware Scheduling expected to have an impact?
It is expected to be effective on all multicore CPUs with multiple LLC domains. The impact is particularly notable on architectures like AMD EPYC and Intel Xeon, where caches are segmented by CCX or core clusters. CPUs with a single LLC will see limited benefits.
When will this patch be merged into the official Linux Kernel?
As of now, it has only been submitted to the kernel mailing list, and its merge timeline is uncertain. Since CAS itself was only recently merged into Linux 7.2, the extension patch is likely targeting 7.3 or later. After community review, it could potentially be merged within the next few months.
Will the 360% MySQL performance improvement apply to all queries?
No, this figure represents the maximum improvement under specific workloads and hardware configurations. Significant gains are more likely in scenarios involving high concurrency or complex queries with heavy JOIN operations and shared data structures. Simple SELECTs or lightweight index lookups will see smaller improvements.
Source: Phoronix

Comments

← Back to Home