How Direct Path Reads(DPR) work for MariaDB Performance?

Direct Path Reads (DPR) is a performance optimization feature in MariaDB that enables the database to read data directly from disk into memory, bypassing the operating system cache. This can result in significant performance improvements for large data sets, as the data is read into memory more efficiently.

Here’s how DPR works in MariaDB:

  1. When a query is executed, the database checks to see if the data needed for the query is already in the operating system cache. If it is, the database retrieves the data from the cache.
  2. If the data is not in the cache, the database performs a direct path read to retrieve the data from disk. The data is read directly into memory, bypassing the operating system cache.
  3. Once the data has been read into memory, the database uses it to execute the query.
  4. If the data is subsequently needed for another query, it can be retrieved from memory instead of being read from disk again, which greatly improves the performance of the query.
  5. If the data is no longer needed, it can be flushed from memory to make room for new data.

The use of Direct Path Reads in MariaDB can greatly improve the performance of database operations, especially for large data sets and frequent queries. However, it is important to carefully monitor the performance of the database when using DPR, as the increased memory usage may impact other applications running on the same system.

How to monitor Direct Path Reads(DPR) in MariaDB?

To monitor Direct Path Reads (DPR) in MariaDB, you can use the following methods:

  1. MariaDB status variables: The MariaDB performance_schema provides various status variables related to DPR, such as Innodb_buffer_pool_read_requests, Innodb_buffer_pool_reads, and Innodb_buffer_pool_read_ahead_rnd. These status variables provide information on the number of read requests made to the buffer pool, the number of physical disk reads performed, and the number of random read-ahead operations performed, respectively.
  2. MariaDB performance metrics: The MariaDB performance metrics provide various metrics related to DPR, such as innodb_buffer_pool_reads_per_sec, innodb_buffer_pool_read_requests_per_sec, and innodb_buffer_pool_read_ahead_per_sec. These metrics provide information on the number of buffer pool reads per second, the number of buffer pool read requests per second, and the number of buffer pool read-ahead operations per second, respectively.
  3. MariaDB slow query log: The MariaDB slow query log provides detailed information on queries that take a long time to execute. If a query is slow because of disk I/O, it may be due to insufficient use of DPR. By analyzing the slow query log, you can identify any queries that could benefit from using DPR.
  4. Operating system tools: Operating system tools, such as iostat or dstat, can provide information on disk I/O performance, including the number of disk reads and the time spent reading from disk. This information can help you determine if DPR is being used effectively and if there is room for improvement.

In conclusion, monitoring Direct Path Reads in MariaDB can provide valuable information on the performance of the database, and can help identify any areas for improvement. By carefully monitoring DPR, you can ensure that the database is using the feature effectively to improve performance and reduce disk I/O overhead.

About Shiv Iyer 446 Articles
Open Source Database Systems Engineer with a deep understanding of Optimizer Internals, Performance Engineering, Scalability and Data SRE. Shiv currently is the Founder, Investor, Board Member and CEO of multiple Database Systems Infrastructure Operations companies in the Transaction Processing Computing and ColumnStores ecosystem. He is also a frequent speaker in open source software conferences globally.