1

When the kernel swaps stuff to disk, can this data be subsequently read by the process directly from swap? or it must absolutely be put back into physical ram (thus generating si so activity in vmstat)

I have a java process that seems to have alot of data in swap (https://paste.fedoraproject.org/542447/raw/) And when I execute it it's really slow, but I don't see any si so activity.

Upon restarting the process, it's very fast again, and smaps now lists 0 bytes in Swap.

Vmstat info: https://paste.fedoraproject.org/542453/raw/

Thank you,

Bob
  • 41
  • 1
  • 5
  • 2
    sorry, but I think that you need to read the concept about virtual memory. – c4f4t0r Feb 01 '17 at 15:22
  • @c4f4t0r My most upvoted answers came mainly from explaining these [things](https://serverfault.com/a/618139/200053) for beginners. He needs an explanation that the jvm is only a process and can't do anything with swap, at most on nonstandard ways. – peterh Feb 01 '17 at 15:44
  • OP, the first line of vmstat is irrelevant for spike identification as it's averaged over entire uptime. Please update your question with `vmstat 1 2` or similar to include the relevant lines. The active/inactive is also mostly useless. I would suggest to take a look at `sar` next. – kubanczyk Feb 01 '17 at 17:01

1 Answers1

0

Processes, including java, are not aware of where their memory is located. All java knows is it tried to access memory location 0x00234525. When the kernel sees access, it'll either return the value out of RAM, or page the memory in from swap to RAM and return the value from RAM. The page has to be read into RAM before it can be accessed.

That said, a single line of vmstat shows the average over the entire uptime is not very useful. Run vmstat 5 while the process is running to see the live data.

Jason Martin
  • 4,865
  • 15
  • 24