0

i'm puzzled if linux writes and reads on swap sequentially .

Now i'm analizyng pressure on swap partition and it's strange that utilisation is near 90% (util column in iostat ) but throughput is just 10MB/s on 2xSAS RAID1 hdd's.

Google couldn't help

aceqbaceq
  • 9
  • 1

2 Answers2

1

Generally, writes to swap can go anywhere swap is free, so they will tend to be sequential. Reads from swap have to be to the particular data the system needs, so they often are not sequential.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82
1

Besides being random, swap reads are also likely serialized. Take in mind that the VM system is creating the illusion of real RAM, so the userspace process doesn't have any opportunity to optimize access. From it's point of view, it's just RAM, so it has to be read before anything else can happen.

The bad thing about serialized, random reads, is that it has to go full round trip (request, head seek, plate turn, read, response) before it can emit the next IO request.

that means, in the worst case, a single 4KB page per IOP (per thread). Assuming 250 IOPS per spindle, you get only 500 IOPS, 500/s x 4KB = 2MB/s. seems you're still way better than the worst case for your hardware. Probably some readahead page clustering is helping you.

Javier
  • 9,078
  • 2
  • 23
  • 24