Author Topic: Which processes use swap more than CPU and disk I/O?  (Read 2486 times)

Offline dbrahmbhatt

  • Newcomer
  • Posts: 7
Which processes use swap more than CPU and disk I/O?
« on: 2017 September 08 11:26:48 »
Help will be greatly appreciated. I am trying to figure out what my real world situation will look like on a new build (Ryzen 1700) on Ubuntu 17.04.

Additionally, is there any point on Ubuntu (or Linux in general for that matter) to create RAMDisk rather than allowing the kernel to figure out how to best use tmp? The tmp is obviously on a M.2 SSD, so it is doing 32Gbps (theoretical at least) - not sure if there is much to gain by doing RAMDisk (DDR4-2133)?

Thanks,
Dhaval

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Which processes use swap more than CPU and disk I/O?
« Reply #1 on: 2017 September 08 12:03:29 »
the name swap is confusing as people associate that word with virtual memory, but that's not what it is...

PI swap comprises the image history for all images open on the various desktops. so pretty much any process is going to read and write the swap area. obviously for processes that run in the global context it's usually all disk i/o as you are exclusively reading and writing files, for instance in ImageCalibration. that doesn't touch the swap area.

while it is difficult to do, your images can be restored from the .swp files on disk in the event of a PI crash or a power failure. obviously if you use a ramdisk for the pi swap area, you'll lose everything in a power failure.


rob


Offline dbrahmbhatt

  • Newcomer
  • Posts: 7
Re: Which processes use swap more than CPU and disk I/O?
« Reply #2 on: 2017 September 08 13:23:21 »
Hi Rob,
Thanks for responding. I do realize the differences between swap in Linux v/s RAMDisk - the real question that I am really trying to get an answer for is - does it matter if I don't create RAMDisk in Linux?

The reason for asking that question is two fold - 1) if the kernel is doing a good job of when to use RAM v/s when to use disk space - then why bother? (Of course I am assuming that the kernel+PI combine to know when to use temporary RAM v/s when to use disk space for swap - that could be a completely wrong assumption to begin with) and 2) if I have a M.2 PCIe3x4 SSD that theoretically does I/O at 32Gbps, then will it hurt/help/no difference to create RAMDisk (again, the speed with the M.2 SSD is theoretically fast - not sure how fast when compared to DDR4-SDRAM).

The other question about which processes use swap/RAMDisk is more to understand real life performance v/s benchmark. It is my understanding after reading a lot about benchmarking process in PI - that there is more weightage given to swap area performance. However, I don't know how that stacks up with what my workflow entails. If most of my processes are CPU/IO intensive, I might not worry too much about RAMDisk v/s disk swap space - just leave it as is. But if my processes are truly swap space intensive, then I will try to figure out if having a RAMDisk makes more sense or not.

Thanks,
Dhaval

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Which processes use swap more than CPU and disk I/O?
« Reply #3 on: 2017 September 08 16:54:08 »
the swap space in pixinsight is managed at the application level. that's what i'm trying to say. linux is going to cache files of course just like any other file, so i guess it's down to kernel configuration. unless an application is able to give hints to the kernel about it's intentions for particular files, i'm assuming the kernel is on its own figuring out how to manage the ram cache for PI's swap files.

does the linux kernel do writebacks or write-through on cache writes? or does it schedule ram cache -> disk write in the background? how big is the write cache? those are the kinds of things you'd have to know to really get a feel for how much performance you'd get by establishing a ramdisk.

most 'normal' processes are CPU-bound. it's the processes that take big lists of files that tend to be i/o bound. juan recently reorganized how ImageCalibration and StarAlignment work to get them to be as cpu-bound as they can be. in the end though, at some point in the execution of a process on a view, PI has to write the disk at least once.

i think the easiest thing to do is just configure a ramdisk for swap and give it a try and see if it's any faster.

rob