dennison
By:
dennison

My server keeps hanging and I don't know why

October 30, 2014 1.4k views

My server keeps hanging for no obvious reason, and the weird thing is that there is no immediately obvious reason why.

It would crash even if there were only less than 100 sessions (in Google Analytics), which is weird because I have had over 500 sessions with no problem.

I am loosing a lot of money, especially since my site runs impression-based ads and I run ads as well. For the last 10 hours I was running 3-4 ads so imagine the revenue loss when users click on the ad and end up on a dead site.

Short of going through the Apache and MySQL logs line by line, any suggestions where to begin?

1 comment
  • How much RAM do you have there ??
    What is the configuration you are running ??
    What is the Size of your Page File ??

    Check the graph in account control panel see if high resource usage, if there is, then use htop to locate the rouge program !!

1 Answer

Thanks for the response. To answer your question:

Hardware is 1 core with 1GB RAM running Ubuntu with LAMP stack pre installed.

Page file is ~4GB which rarely gets used. Here is a snapshot.

top - 09:01:56 up  3:03,  2 users,  load average: 0.34, 0.29, 0.27
Tasks:  92 total,   2 running,  90 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.3 us,  2.0 sy,  0.0 ni, 90.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1017956 total,   764152 used,   253804 free,    80436 buffers
KiB Swap:  4169712 total,     3548 used,  4166164 free.   389544 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
26982 www-data  20   0  402768  44108  27428 S  3.3  4.3   0:00.10 apache2
26970 www-data  20   0  403040  44632  27760 S  2.3  4.4   0:00.19 apache2
26965 www-data  20   0  608736  18408   8000 S  1.0  1.8   0:00.25 apache2
 1115 mysql     20   0  888952  77424   7176 S  0.3  7.6   2:17.13 mysqld
26930 www-data  20   0  616388  50776  29840 S  0.3  5.0   0:00.30 apache2
26931 root      20   0  104552   4004   2920 S  0.3  0.4   0:00.06 sshd
26969 www-data  20   0  535112  17632   8064 S  0.3  1.7   0:00.03 apache2
    1 root      20   0   33480   2640   1320 S  0.0  0.3   0:01.22 init
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd
    3 root      20   0       0      0      0 S  0.0  0.0   0:00.07 ksoftirqd/0
    5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H
    6 root      20   0       0      0      0 S  0.0  0.0   0:01.52 kworker/u2:0
    7 root      20   0       0      0      0 S  0.0  0.0   0:05.35 rcu_sched
    8 root      20   0       0      0      0 R  0.0  0.0   0:04.51 rcuos/0
    9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh
   10 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0
   11 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0

root@alpha:/home/dennison# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/var/swap.img                           file            1023996 3548    -1
/var/swap2.img                          file            1048572 0       -2
/var/swap3.img                          file            1048572 0       -3
/var/swap4.img                          file            1048572 0       -4
root@alpha:/home/dennison# cat /proc/meminfo
MemTotal:        1017956 kB
MemFree:          177348 kB
Buffers:           80184 kB
Cached:           383264 kB
SwapCached:          396 kB
Active:           421028 kB
Inactive:         299176 kB
Active(anon):     218184 kB
Inactive(anon):   122240 kB
Active(file):     202844 kB
Inactive(file):   176936 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       4169712 kB
SwapFree:        4166164 kB
Dirty:               816 kB
Writeback:             0 kB
AnonPages:        256408 kB
Mapped:            81980 kB
Shmem:             83668 kB
Slab:              92388 kB
SReclaimable:      79088 kB
SUnreclaim:        13300 kB
KernelStack:        1080 kB
PageTables:        12000 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     4678688 kB
Committed_AS:     985880 kB
VmallocTotal:   34359738367 kB
VmallocUsed:        9960 kB
VmallocChunk:   34359721212 kB
HardwareCorrupted:     0 kB
AnonHugePages:     53248 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       32760 kB
DirectMap2M:     1015808 kB
DirectMap1G:           0 kB
root@alpha:/home/dennison#



Have another answer? Share your knowledge.