- Mijin An, Soojun Im, Dawoon Jung, and Sang-Won Lee. 2022. Your Read is Our Priority in Flash Storage. Proc. VLDB Endow. 15, 9 (May 2022), 1911–1923. https://doi.org/10.14778/3538598.3538612
RW is an intuitive and explicit storage command to address read stalls. Upon read stall, both read and write can be requested to the flash storage in a single call. And the read can be processed as soon as the dirty page is copied to the storage buffer cache using DMA, without waiting for the NAND write to finish. By replacing two I/O calls for write and read upon read stalls with one call, RW can simplify the structure of the buffer manager in DBMS and reduce the number of I/O interrupts and consequently the number of context switches.
The major modifications on MySQL are made in directories below:
storage/innobase/buf
: The database buffer implementation for InnoDBstorage/innobase/fil
: File I/O operations for InnoDBstorage/innobase/include
: The collection of header files for InnoDB
RW consists of the following components:
- Basic modules for the buffer manager to utilize the RW command (e.g., buffer initialization, buffer allocation, buffer replacement, etc.)
- The module to send the RW NVM command set to storage
- The module to proceed the transaction immediately using the read data buffer without a separate free buffer acquisition procedure
You can check the modified code by searching for the #ifdef RW_CMD
keyword in the file. For example:
storage/innobase/fil/fil0fil.cc
#ifdef RW_CMD
...
fil_mutex_enter_and_prepare_for_rw_io(
/*===============================*/
ulint space_id, /*!< in: space id to write */
ulint space_id_to_read /*!< in: space id to read */
)
{
fil_space_t* space;
...
#endif /* RW_CMD */
R-Buf is a read-dedicated in-storage buffer. RW and R-Buf are complementary, so we combine two techniques to eliminate the read stall problem in both host and storage buffer. To evaluate the performance of the combined technique, we implement them on Comsos+ OpenSSD firmware.
- RW
- R-Buf
- libreadline
$ sudo apt-get install libreadline6 libreadline6-dev
- libaio
$ sudo apt-get install libaio1 libaio-dev
- etc.
$ sudo apt-get install build-essential cmake libncurses5 libncurses5-dev bison
- Clone the source code:
$ git clone https://github.com/meeeejin/rw-rbuf.git
$ cd rw-rbuf/mysql
- Then build and install the source code: (8: # of cores in your machine)
$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/basedir
$ make -j8 install
For example:
$ cmake -DCMAKE_INSTALL_PREFIX=/home/mijin/rw-rbuf/mysql
$ make -j8 install
- Initialize the data directory, including the mysql database:
--datadir
: the path to the MySQL data directory--basedir
: the path to the MySQL installation directory
$ cd scripts
$ sudo chmod +x mysql_install_db
$ ./mysql_install_db --user=mysql --datadir=/path/to/datadir --basedir=/path/to/basedir
For example:
$ ./mysql_install_db --user=mysql --datadir=/home/mijin/test-data --basedir=/home/mijin/rw-rbuf/mysql
- Open
.bashrc
and add MySQL installation path to your path:
$ vi ~/.bashrc
export PATH=/path/to/basedir/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/basedir/lib/
$ source ~/.bashrc
For example:
export PATH=/home/mijin/rw-rbuf/mysql/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/mijin/rw-rbuf/mysql/lib/
-
Create a configuration file (
my.cnf
) for the MySQL server or use the uploaded configuration file. You should modify the path/path/to/datadir
to your local path. For details on each variable, refer to MySQL Server System Variable -
You can start the MySQL server using the below command:
$ ./bin/mysqld_safe --defaults-file=/path/to/my.cnf
- You can shut down the server using the below command:
$ ./bin/mysqladmin -uroot shutdown
-
Refer to p70-137 of slides to build the basic Cosmos+ OpenSSD firmware.
-
Copy source files in
rw-rbuf/cosmos-firmware
tosrc
folder in project explorer (See p107 in the slides above). -
Build firmware.