Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swap memory speed in Linux

Tags:

c++

linux

I have a process in Linux 64 bit (Redhat Enterprise) which enrolled one million of records into memory, each record is 4KB so total memory consumption is about 4 Gigabytes.

My computer has 2GB of RAM and 3 GB of swap memory. So obviously part of data will be put into swap memory. The problem is that I don't know why it really takes too long time to traverse across all those records. I have a function that loop through each record and do some stuff things. It works well with about 500,000 records, the function just need couple of minutes to accomplish. However, with double amount of that records, i.e 1,000,000 records, it needs hours to do the same function. I used top command in Linux to check the cpu load, and see that it's about 90%wa (waiting time for I/O). I guess this might cause the problem but really don't know why it happens.

I would thank you so much any helpful idea.

like image 264
longbkit Avatar asked Mar 02 '26 09:03

longbkit


1 Answers

Swap area is disk. Disk bandwidth is two or three order of magnitude less than memory bandwidth.

like image 101
AProgrammer Avatar answered Mar 04 '26 23:03

AProgrammer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!