What is the size of an IO Operation (IOP) in AWS EBS?
Solution 1:
The size of one I/O operation is dependent on a lot of things. Calculating the average for your application is not necessarily a bad idea.
Amazon's definition of them implies that their hardware supports 256KB blocks. A single I/O operation is the read or write of one block. An "unaligned" access to the hardware where an operation spans two blocks will result in two I/O operations, even if the software and hardware block sizes match. This is why it is so useful for I/O performance to use a filesystem blocksize the same size as the hardware blocksize, though this can reduce storage efficiency since a filesystem block is the allocation quantum.
Block sizes in filesystems are largely dictated by memory page size, since reads go into memory pages. Normally, memory pages are 4kB in x86 Linux; though the kernel can map larger pages, there isn't an intermediary size between a normal 4kB page and a huge 4MB page. So, you can't really tune this on modern systems and hardware.
However, the filesystem can try to make all reads and writes across several blocks sequential, by preventing fragmentation. EXT4 does this by allocating files sparsely on the disk instead of allocating the next free block when a block is requested; other filesystems have strategies for this as well. The kernel (filesystem and disk drivers) can aggregate a single read operation spanning multiple blocks into a single read operation when those blocks are physically consecutive and do not cross a physical block boundary.
The disk driver discovers the disk blocksize automatically; you cannot adjust it. You can read it with blockdev --getpbsz /dev/xvda
or what have you.