I have freshly installed Ubuntu 16.04 and I can say I am an experienced noob. I had previously another machine with the same specs as this one:

New PC

When I started using RStudio, especially visualizing a large dataframe, it was way much faster on the old system than the new one that I am using right now. I mean by that to navigate, sort columns and move here and there, would load a lot faster. So, I was wondering if it is something related to the swap partitioning size.

~$sudo swapon --show
/dev/sdb5 partition 186,6G   0B   -1


~$ free -h
              total        used        free      shared  buff/cache   available
Mem:            23G        3,1G        302M        103M         20G         19G
Swap:          186G          0B        186G


~$ top

top - 10:15:36 up 18:04,  1 user,  load average: 0,08, 0,19, 0,26
Tasks: 283 total,   2 running, 281 sleeping,   0 stopped,   0 zombie
%Cpu(s): 12,7 us,  0,3 sy,  0,0 ni, 87,0 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Mem : 24591860 total,   277684 free,  3286392 used, 21027784 buff/cache
KiB Swap: 19570073+total, 19570073+free,        0 used. 20742232 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                     
20543 badredda  20   0 3271272 680964 102080 R 102,6  2,8   3:56.38 rstudio

I know that swap is used as a last resort and can render the PC dead-slow so maybe this could be the reason. I have also been reading this source mentioning that I should have a maximum of 48 GB swap space. Maybe mine is too much ?

Thanks for your help in advance.

  • 2
    with 23G of RAM. 30 GB of swap is good if you use hibernate. Less swap is good if you do not hibernate, unless you do some really heavy computing
    – ravery
    Oct 20, 2017 at 8:30
  • I actually do heavy computing @ravery, this is why I want my system running in best conditions.
    – user324810
    Oct 20, 2017 at 11:01
  • @KhalidAbuShawarib that's exactly the source I have stated.
    – user324810
    Oct 20, 2017 at 11:02
  • 186G still seems like overkill, but I guess it is possible to use it all
    – ravery
    Oct 20, 2017 at 11:54
  • As your top screenshot shows, your system is using 0 swap space. That is because there is still some RAM memory free (277684). Rule of thumb: you only need a large swap disk if your system has little RAM but many memory consuming processes. Your system is showing many sleeping processes which apparently all still fit in RAM. Decreasing swap to 24GB is advised. Note swapping will slow your system down, as swap is on disk which is much slower than RAM. If your system allows more RAM, then do so. An SSD would also be a good investment.
    – user680858
    Oct 20, 2017 at 18:48


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.