Can swap file cause delays?

(Avorio) #1

I just created a swapfile for my Linux server and I started noticing a huge (~ 4-5 seconds) delay in the very first request to the forum. The following requests go through within a normal timeframe. Could this swapfile be the cause of this delay? I’m not sure what else could be causing it; it certainly wasn’t there before.

I’m running the recommended box setup in DigitalOcean.


Create a swapfile for your Linux server
(Avorio) #2

Ha! I’ve found these topics that relate to my question above…


Could this very issue had been impacted by the swapfile setting?

(Jeff Atwood) #3

Nope that is not possible. Is your server very slow, e.g. what kind of CPU does it have?

(Avorio) #4

Here it goes:

root@discourse:~# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Model name:            Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
Stepping:              4
CPU MHz:               2399.998
BogoMIPS:              4799.99
Virtualization:        VT-x
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              15360K
NUMA node0 CPU(s):     0,1

And top:

top - 12:15:40 up 84 days, 17:42,  1 user,  load average: 1.01, 1.03, 1.05
Tasks: 114 total,   3 running, 111 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.7 us, 50.4 sy,  0.0 ni, 48.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.2 st
KiB Mem:   2048804 total,  2014976 used,    33828 free,   157044 buffers
KiB Swap:  2097148 total,     7004 used,  2090144 free.   772568 cached Mem

(Jeff Atwood) #5

Wait are you referring to the first requests after a rebuild or restart? If so then yes some delay is expected as the system is spinning up db, redis, Ruby and so on. Same reason your desktop, laptop, of phone takes extra time after powering up.

(Avorio) #6

No, I mean first request in general (not just after restart). Open a new tab in your browser, then request. That’s the first request. If you click on a topic title, that’s a second request, etc.

(Jeff Atwood) #7

This sounds like something else entirely. Press f12 and watch the network tab in your browsers f12 diagnostics panel. Perhaps some remote dependency you have added?