0

I know that block(multiple disk sectors) is the basic unit of data transfer for the virtual file system so, if NTFS uses 4 KB cluster size for files how does InnoDB access disk if it uses 8 KB page size?

2 Answers 2

1

Default InnoDB page size is 16K. Pages go into a larger 1MB data structure called an extent. MySQL allocates 4 extents at a time.

All of these are stored in one large file, so boundary issues have minimal effect on InnoDB.

You can read more about MySQL file space management.

Modern hard drives have read caches, and they read ahead, so contiguous sectors are already available when you ask for them without having to perform another seek.

Given enough working space (innodb_buffer_pool_size), InnoDB will store much of your indexes and data in memory, only waiting on disk for update transactions and commits.

According to MySQL documentation, it seems MySQL reads an extent (1MB) at a time from disk to the buffer pool, where it will access it a page at a time.

3
  • Hi Marcus, what I want to learn is if disk accesses are managed by file system how InnoDB make 16 Kb block i/o request to disk at a time?
    – spartacus
    Commented Feb 17, 2015 at 20:08
  • According to MySQL documentation, it seems MySQL reads an extent (1MB) at a time from disk to the buffer pool, where it will access it a page at a time. Commented Feb 17, 2015 at 20:20
  • 4
    InnoDB only reads an extent at a time in read-ahead when it detects an linear scan. Most of the time it reads a page (16 KB with uncompressed tables) at a time. However the questioner is probably on a wrong premise, the OS is responsible for figuring out how to read the requested size read from the filesystem. MySQL/InnoDB requests 16 KB and doesn't care if the OS reads that from a single (large) page, 2 8 KB pages, 4 4 KB pages, etc... it has no control over that.
    – jeremycole
    Commented Feb 24, 2015 at 21:42
0

The NTFS cluster size governs the granularity of allocation of disk space to files. InnoDB (and other application software) basically don't care what the file system's cluster size is.

When InnoDB reads or writes an 8K block, it just reads 8K. When it allocates an 8K block, it allocates two 4K clusters.

That being said, if you're standing up a new file system for a MySQL server, it's a good idea to set the NTFS cluster size to match the block size.

Modern operating systems' physical disk IO can read and write large (46 k bytes or larger) streams of sequential data in single operations.

1
  • so u say that if InnoDB reads one page , file system makes two i/o request to disk?(4K + 4K=8K)
    – spartacus
    Commented Feb 17, 2015 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.