2

This question was originally asked on StackOverflow.com, and I've duplicated it to the more appropriate ServerFault.com site. The original question, which I've voted to close, can be found here

I have a small, low traffic WordPress blog hosted on AWS. Unfortunately, approximately once a week or so, the website becomes unavailable and attempting to access the website leaves users hanging until the connection times out. I also cannot access the server via SSH during these downtimes, until the server is restarted. It always recovers instantly after rebooting the instance.


Last lines of AWS EC2 log (30,000 character limit prevents posting all of it):

[1079988.125918] Out of memory: Kill process 32620 (httpd) score 16 or sacrifice child

[1079988.130913] Killed process 32620 (httpd) total-vm:510348kB, anon-rss:32328kB, file-rss:0kB

[1079996.872570] httpd invoked oom-killer: gfp_mask=0x24280ca, order=0, oom_score_adj=0

[1079996.887776] httpd cpuset=/ mems_allowed=0

[1079996.892671] CPU: 0 PID: 374 Comm: httpd Tainted: G            E   4.4.5-15.26.amzn1.x86_64 #1

[1079996.896664] Hardware name: Xen HVM domU, BIOS 4.2.amazon 12/07/2015

[1079996.896664]  0000000000000000 ffff88002f66bb58 ffffffff812c88ef ffff88002f66bd40

[1079996.896664]  0000000000000000 ffff88002f66bbe8 ffffffff811cdc8d 0000000000000001

[1079996.896664]  ffffffff810b2c61 0000000000000000 0000000000000010 ffffffff817d07f9

[1079996.896664] Call Trace:

[1079996.896664]  [<ffffffff812c88ef>] dump_stack+0x63/0x84

[1079996.896664]  [<ffffffff811cdc8d>] dump_header+0x5e/0x1d8

[1079996.896664]  [<ffffffff810b2c61>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20

[1079996.896664]  [<ffffffff811634d5>] oom_kill_process+0x205/0x3d0

[1079996.896664]  [<ffffffff81163b35>] out_of_memory+0x435/0x480

[1079996.896664]  [<ffffffff81168bee>] __alloc_pages_nodemask+0x91e/0xa60

[1079996.896664]  [<ffffffff811ae5e5>] alloc_pages_vma+0xb5/0x210

[1079996.896664]  [<ffffffff8118e296>] handle_mm_fault+0x13a6/0x1870

[1079996.896664]  [<ffffffff810b2c61>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20

[1079996.896664]  [<ffffffff810922c2>] ? finish_task_switch+0x72/0x1d0

[1079996.896664]  [<ffffffff8105ea23>] __do_page_fault+0x183/0x3f0

[1079996.896664]  [<ffffffff8105ecb2>] do_page_fault+0x22/0x30

[1079996.896664]  [<ffffffff814de858>] page_fault+0x28/0x30

[1079996.958270] Mem-Info:

[1079996.959270] active_anon:457775 inactive_anon:13 isolated_anon:0

[1079996.959270]  active_file:16 inactive_file:106 isolated_file:0

[1079996.959270]  unevictable:0 dirty:0 writeback:0 unstable:0

[1079996.959270]  slab_reclaimable:2369 slab_unreclaimable:10892

[1079996.959270]  mapped:24 shmem:35 pagetables:33000 bounce:0

[1079996.959270]  free:3686 free_pcp:68 free_cma:0

[1079996.973173] Node 0 DMA free:7976kB min:40kB low:48kB high:60kB active_anon:6348kB inactive_anon:0kB active_file:4kB inactive_file:24kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15988kB managed:15904kB mlocked:0kB dirty:0kB writeback:0kB mapped:8kB shmem:0kB slab_reclaimable:72kB slab_unreclaimable:268kB kernel_stack:0kB pagetables:1036kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:168 all_unreclaimable? yes

[1079996.991168] lowmem_reserve[]: 0 1984 1984 1984

[1079996.993371] Node 0 DMA32 free:6768kB min:5584kB low:6980kB high:8376kB active_anon:1824752kB inactive_anon:52kB active_file:60kB inactive_file:400kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:2080768kB managed:2035632kB mlocked:0kB dirty:0kB writeback:0kB mapped:88kB shmem:140kB slab_reclaimable:9404kB slab_unreclaimable:43300kB kernel_stack:3920kB pagetables:130964kB unstable:0kB bounce:0kB free_pcp:272kB local_pcp:272kB free_cma:0kB writeback_tmp:0kB pages_scanned:2808 all_unreclaimable? yes

[1079997.012134] lowmem_reserve[]: 0 0 0 0

[1079997.014077] Node 0 DMA: 30*4kB (ME) 71*8kB (UM) 26*16kB (UME) 3*32kB (ME) 0*64kB 1*128kB (E) 2*256kB (ME) 2*512kB (ME) 1*1024kB (E) 2*2048kB (UM) 0*4096kB = 7984kB

[1079997.021833] Node 0 DMA32: 478*4kB (UME) 55*8kB (UM) 210*16kB (UM) 31*32kB (M) 1*64kB (M) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 6768kB

[1079997.028501] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB

[1079997.032184] 160 total pagecache pages

[1079997.033858] 0 pages in swap cache

[1079997.035455] Swap cache stats: add 0, delete 0, find 0/0

[1079997.037793] Free swap  = 0kB

[1079997.039117] Total swap = 0kB

[1079997.040511] 524189 pages RAM

[1079997.041780] 0 pages HighMem/MovableOnly

[1079997.043474] 11305 pages reserved

[1079997.044872] [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds swapents oom_score_adj name

[1079997.048548] [ 1524]     0  1524     2866      229      12       3        0         -1000 udevd

[1079997.052366] [ 1647]     0  1647     2865      213      11       3        0         -1000 udevd

[1079997.056081] [ 1648]     0  1648     2865      210      11       3        0         -1000 udevd

[1079997.059637] [ 2045]     0  2045     2340      123      10       3        0             0 dhclient

[1079997.063283] [ 2097]     0  2097    28018      106      25       3        0         -1000 auditd

[1079997.067016] [ 2118]     0  2118    61865      375      25       3        0             0 rsyslogd

[1079997.070879] [ 2140]     0  2140     1095       37       8       3        0             0 rngd

[1079997.074484] [ 2158]    32  2158     8823       97      22       3        0             0 rpcbind

[1079997.078205] [ 2179]    29  2179     9965      201      24       3        0             0 rpc.statd

[1079997.081954] [ 2210]    81  2210     5448       61      15       3        0             0 dbus-daemon

[1079997.085861] [ 2339]     0  2339    19458      203      40       3        0         -1000 sshd

[1079997.089500] [ 2361]    38  2361     7322      140      18       3        0             0 ntpd

[1079997.093148] [ 2654]     0  2654    22245      463      45       3        0             0 sendmail

[1079997.096960] [ 2663]    51  2663    20109      369      40       4        0             0 sendmail

[1079997.100976] [ 2678]     0  2678   102872     1914     200       3        0             0 httpd

[1079997.104736] [ 2689]     0  2689    29880      146      15       3        0             0 crond

[1079997.108453] [ 2703]     0  2703     4267       41      13       3        0             0 atd

[1079997.112100] [ 2733]     0  2733     1615       31       8       3        0             0 agetty

[1079997.115895] [ 2735]     0  2735     1078       24       8       3        0             0 mingetty

[1079997.119835] [ 2738]     0  2738     1078       24       8       3        0             0 mingetty

[1079997.123661] [ 2740]     0  2740     1078       24       7       3        0             0 mingetty

[1079997.127430] [ 2742]     0  2742     1078       24       8       3        0             0 mingetty

[1079997.131420] [ 2744]     0  2744     1078       23       8       3        0             0 mingetty

[1079997.135291] [ 2746]     0  2746     1078       24       8       3        0             0 mingetty

[1079997.139070] [32214]    48 32214   126502     7229     209       3        0             0 httpd

[1079997.142642] [32297]    48 32297   125281     6111     207       3        0             0 httpd

[1079997.146286] [32310]    48 32310   125754     6561     208       3        0             0 httpd

[1079997.150023] [32346]    48 32346   125990     6820     208       3        0             0 httpd

[1079997.153576] [32365]    48 32365   127220     7837     210       3        0             0 httpd

[1079997.157241] [32369]    48 32369   125991     6820     208       3        0             0 httpd

[1079997.160923] [32395]    48 32395   125282     6129     207       3        0             0 httpd

[1079997.164515] [32498]    48 32498   125998     6758     208       3        0             0 httpd

[1079997.168490] [32515]    48 32515   125281     6111     207       3        0             0 httpd

[1079997.172046] [32575]    48 32575   125732     6475     208       3        0             0 httpd

[1079997.175868] [32578]    48 32578   125683     6508     207       3        0             0 httpd

[1079997.179602] [32584]    48 32584   125731     6561     208       3        0             0 httpd

[1079997.183372] [32598]    48 32598   125683     6508     207       3        0             0 httpd

[1079997.187140] [32603]    48 32603   125731     6561     208       3        0             0 httpd

[1079997.190715] [32608]    48 32608   125683     6508     207       3        0             0 httpd

[1079997.194454] [32612]    48 32612   126566     7496     209       3        0             0 httpd

[1079997.198263] [32625]    48 32625   125524     6305     207       3        0             0 httpd

[1079997.201863] [32635]    48 32635   125731     6561     208       3        0             0 httpd

[1079997.205449] [32649]    48 32649   125990     6748     208       3        0             0 httpd

[1079997.209316] [32650]    48 32650   107262     6519     206       3        0             0 httpd

[1079997.213170] [32652]    48 32652   127395     7886     211       3        0             0 httpd

[1079997.216906] [32658]    48 32658   125729     6527     208       3        0             0 httpd

[1079997.220644] [32661]    48 32661   108843     7773     210       3        0             0 httpd

[1079997.224418] [32666]    48 32666   125282     6111     207       3        0             0 httpd

[1079997.228078] [32669]    48 32669   126892     7484     210       3        0             0 httpd

[1079997.231832] [32675]    48 32675   125706     6520     207       3        0             0 httpd

[1079997.235511] [32676]    48 32676   125683     6508     207       3        0             0 httpd

[1079997.239227] [32681]    48 32681   125684     6508     207       3        0             0 httpd

[1079997.243019] [32691]    48 32691   125993     6747     208       3        0             0 httpd

[1079997.246836] [32696]    48 32696   125683     6507     207       3        0             0 httpd

[1079997.250732] [32698]    48 32698   126371     6954     209       3        0             0 httpd

[1079997.254287] [32700]    48 32700   107752     6734     207       3        0             0 httpd

[1079997.258018] [32703]    48 32703   106347     5553     205       3        0             0 httpd

[1079997.261647] [32714]    48 32714   125684     6508     207       3        0             0 httpd

[1079997.265446] [32723]    48 32723   125731     6561     208       3        0             0 httpd

[1079997.269066] [  307]    48   307   125685     6506     207       3        0             0 httpd

[1079997.272679] [  314]    48   314   108660     7632     209       3        0             0 httpd

[1079997.276452] [  319]    48   319   107752     6723     207       3        0             0 httpd

[1079997.280364] [  320]    48   320   107240     6427     206       3        0             0 httpd

[1079997.284027] [  323]    48   323   107888     6912     208       3        0             0 httpd

[1079997.287595] [  324]    48   324   107122     6264     206       3        0             0 httpd

[1079997.291243] [  325]    48   325   122406     7539     209       3        0             0 httpd

[1079997.294995] [  326]    48   326   108274     7130     208       3        0             0 httpd

[1079997.298756] [  327]    48   327   124978     7732     210       3        0             0 httpd

[1079997.302330] [  329]    48   329   108274     7267     208       3        0             0 httpd

[1079997.306007] [  333]    48   333   106928     6052     206       3        0             0 httpd

[1079997.309818] [  334]    48   334   105747     4938     203       3        0             0 httpd

[1079997.313613] [  338]    48   338   108539     7521     209       3        0             0 httpd

[1079997.317252] [  339]    48   339   107816     6838     208       3        0             0 httpd

[1079997.320966] [  340]    48   340   108361     7341     209       3        0             0 httpd

[1079997.324587] [  342]    48   342   107944     6986     208       3        0             0 httpd

[1079997.328421] [  343]    48   343   103541     2605     199       3        0             0 httpd

[1079997.331943] [  344]    48   344   106288     5479     205       3        0             0 httpd

[1079997.335650] [  346]    48   346   106493     5678     205       3        0             0 httpd

[1079997.339365] [  347]    48   347   108326     7310     209       3        0             0 httpd

[1079997.343168] [  349]    48   349   106412     5579     205       3        0             0 httpd

[1079997.346819] [  350]    48   350   106612     5832     205       3        0             0 httpd

[1079997.350423] [  351]    48   351   107440     6484     207       3        0             0 httpd

[1079997.354093] [  352]    48   352   106984     6133     206       3        0             0 httpd

[1079997.357822] [  354]    48   354   107122     6265     206       3        0             0 httpd

[1079997.361467] [  355]    48   355   103541     2604     199       3        0             0 httpd

[1079997.365074] [  358]    48   358   103541     2605     199       3        0             0 httpd

[1079997.368805] [  359]    48   359   106475     5660     205       3        0             0 httpd

[1079997.372852] [  360]    48   360   104710     3796     201       3        0             0 httpd

[1079997.376601] [  370]    48   370   103538     2622     199       3        0             0 httpd

[1079997.380201] [  372]    48   372   103538     2622     199       3        0             0 httpd

[1079997.383966] [  373]    48   373   107752     6733     207       3        0             0 httpd

[1079997.387998] [  374]    48   374   108539     7520     209       3        0             0 httpd

[1079997.391913] [  375]    48   375   103541     2604     199       3        0             0 httpd

[1079997.395537] [  376]    48   376   103538     2626     199       3        0             0 httpd

[1079997.399174] [  378]    48   378   106467     5646     205       3        0             0 httpd

[1079997.402981] [  381]    48   381   107952     6967     208       3        0             0 httpd

[1079997.406805] [  383]    48   383   108338     7328     209       3        0             0 httpd

[1079997.410374] [  385]    48   385   105068     4224     202       3        0             0 httpd

[1079997.414010] [  388]    48   388   104866     4047     202       3        0             0 httpd

[1079997.417701] [  392]    48   392   105881     5036     204       3        0             0 httpd

[1079997.421384] [  394]    48   394   106347     5540     205       3        0             0 httpd

[1079997.425365] [  396]    48   396   103538     2626     199       3        0             0 httpd

[1079997.429044] [  407]    48   407   103838     2961     200       3        0             0 httpd

[1079997.432577] [  412]    48   412   103542     2605     199       3        0             0 httpd

[1079997.436201] [  413]    48   413   105079     4262     202       3        0             0 httpd

[1079997.439868] [  416]    48   416   103541     2605     199       3        0             0 httpd

[1079997.443501] [  422]    48   422   103541     2604     199       3        0             0 httpd

[1079997.447093] [  424]    48   424   103540     2637     199       3        0             0 httpd

[1079997.450727] [  426]    48   426   103542     2604     199       3        0             0 httpd

[1079997.454398] [  427]    48   427   103541     2604     199       3        0             0 httpd

[1079997.458434] [  428]    48   428   103538     2622     199       3        0             0 httpd

[1079997.463763] [  429]    48   429   103541     2604     199       3        0             0 httpd

[1079997.467592] [  437]    48   437   103538     2627     199       3        0             0 httpd

[1079997.471172] [  438]    48   438   104324     3456     201       3        0             0 httpd

[1079997.474751] [  439]    48   439   103541     2604     199       3        0             0 httpd

[1079997.478432] [  440]    48   440   103545     2622     199       3        0             0 httpd

[1079997.482044] [  441]    48   441   103539     2622     199       3        0             0 httpd

[1079997.485780] [  442]    48   442   106474     5667     205       3        0             0 httpd

[1079997.489572] [  445]    48   445   103547     2620     199       3        0             0 httpd

[1079997.493165] [  448]    48   448   103541     2604     199       3        0             0 httpd

[1079997.496719] [  449]    48   449   104500     3638     201       3        0             0 httpd

[1079997.500255] [  450]    48   450   106208     5364     204       3        0             0 httpd

[1079997.503768] [  468]    48   468   103613     2733     199       3        0             0 httpd

[1079997.507327] [  469]    48   469   103538     2622     199       3        0             0 httpd

[1079997.511042] [  470]    48   470   103541     2604     199       3        0             0 httpd

[1079997.514670] [  471]    48   471   103541     2604     199       3        0             0 httpd

[1079997.518298] [  472]    48   472   103542     2605     199       3        0             0 httpd

[1079997.522039] [  480]    48   480   104314     3471     201       3        0             0 httpd

[1079997.525663] [  481]    48   481   103610     2670     199       3        0             0 httpd

[1079997.529538] [  482]    48   482   103541     2604     199       3        0             0 httpd

[1079997.533280] [  483]    48   483   103542     2604     199       3        0             0 httpd

[1079997.536999] [  484]    48   484   103538     2622     199       3        0             0 httpd

[1079997.540651] [  485]    48   485   103538     2622     199       3        0             0 httpd

[1079997.544204] [  486]    48   486   104094     3224     200       3        0             0 httpd

[1079997.547808] [  488]    48   488   119730     2929     201       3        0             0 httpd

[1079997.551370] [  489]    48   489   103538     2622     199       3        0             0 httpd

[1079997.554962] [  490]    48   490   104808     3968     202       3        0             0 httpd

[1079997.558875] [  491]    48   491   103538     2622     199       3        0             0 httpd

[1079997.562490] [  494]    48   494   104059     3199     200       3        0             0 httpd

[1079997.566339] [  495]    48   495   104143     3232     200       3        0             0 httpd

[1079997.570045] [  501]    48   501   103564     2562     199       3        0             0 httpd

[1079997.573871] [  502]    48   502   104707     3771     201       3        0             0 httpd

[1079997.577369] [  503]    48   503   103538     2621     199       3        0             0 httpd

[1079997.580897] [  504]    48   504   103541     2609     199       3        0             0 httpd

[1079997.584364] [  505]    48   505   103539     2621     199       3        0             0 httpd

[1079997.588037] [  506]    48   506   103545     2621     199       3        0             0 httpd

[1079997.591946] [  507]    48   507   103541     2604     199       3        0             0 httpd

[1079997.595820] [  508]    48   508   103538     2622     199       3        0             0 httpd

[1079997.599555] [  509]    48   509   103541     2604     199       3        0             0 httpd

[1079997.603102] [  510]    48   510   103475     2562     199       3        0             0 httpd

[1079997.609123] [  511]    48   511   103539     2622     199       3        0             0 httpd

[1079997.613009] [  512]    48   512   103281     2335     199       3        0             0 httpd

[1079997.616695] [  513]    48   513   103475     2562     199       3        0             0 httpd

[1079997.620272] [  514]    48   514   103541     2604     199       3        0             0 httpd

[1079997.623949] [  515]    48   515   103475     2562     199       3        0             0 httpd

[1079997.627601] [  516]    48   516   103066     2051     198       3        0             0 httpd

[1079997.631257] [  517]    48   517   103285     2307     199       3        0             0 httpd

[1079997.634944] [  518]    48   518   103539     2622     199       3        0             0 httpd

[1079997.638875] [  519]    48   519   103484     2517     199       3        0             0 httpd

[1079997.642467] [  520]    48   520   103541     2601     199       3        0             0 httpd

[1079997.646281] [  521]    48   521   103564     2562     199       3        0             0 httpd

[1079997.650000] [  522]    48   522   103254     2242     199       3        0             0 httpd

[1079997.654227] [  523]    48   523   103541     2601     199       3        0             0 httpd

[1079997.657861] [  524]    48   524   102968     2025     198       3        0             0 httpd

[1079997.662169] [  525]    48   525   103433     2411     199       3        0             0 httpd

[1079997.666436] [  526]    48   526   102968     2050     198       3        0             0 httpd

[1079997.670950] [  527]    48   527   103254     2252     199       3        0             0 httpd

[1079997.676349] [  528]    48   528   103281     2350     199       3        0             0 httpd

[1079997.680095] [  529]    48   529   103538     2561     199       3        0             0 httpd

[1079997.683947] [  530]    48   530   103173     2126     198       3        0             0 httpd

[1079997.687608] [  531]    48   531   103228     2262     199       3        0             0 httpd

[1079997.691466] [  532]    48   532   103475     2515     199       3        0             0 httpd

[1079997.694988] [  533]    48   533   103173     2119     198       3        0             0 httpd

[1079997.698754] [  534]    48   534   102975     1973     198       3        0             0 httpd

[1079997.702324] [  535]    48   535   103434     2409     199       3        0             0 httpd

[1079997.705935] [  536]     0   536   102872     1915     192       3        0             0 httpd

[1079997.709734] [  537]    48   537   102968     2032     198       3        0             0 httpd

[1079997.713367] [  538]    48   538   102873     1926     198       3        0             0 httpd

[1079997.717141] [  539]    48   539   102872     1922     196       3        0             0 httpd

[1079997.720839] [  540]    48   540   102975     1973     198       3        0             0 httpd

[1079997.724457] [  541]     0   541   102872     1915     192       3        0             0 httpd

[1079997.728106] [  542]    48   542   102872     1915     193       3        0             0 httpd

[1079997.731629] [  543]    48   543   102872     1915     193       3        0             0 httpd

[1079997.735163] [  544]    48   544   102872     1915     193       3        0             0 httpd

[1079997.738927] Out of memory: Kill process 32652 (httpd) score 15 or sacrifice child

[1079997.742215] Killed process 32652 (httpd) total-vm:509580kB, anon-rss:31536kB, file-rss:8kB

I do believe it's to do with low memory usage given the log, however upgrading the instance to a larger one doesn't prevent the problem occuring. Also, the site is extremely low in traffic (< 50 users/week), so it doesn't make sense that I'd need a much bigger server than the t1-medium it's currently running upon.


Software versions:

PHP (php --version):

PHP 5.6.21 (cli) (built: May  2 2016 23:27:53) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

MySQL (mysql --version):

mysql  Ver 14.14 Distrib 5.5.46, for Linux (x86_64) using readline 5.1

Apache (apachectl -V):

Server version: Apache/2.4.18 (Amazon)
Server built:   Mar  7 2016 22:32:11
Server's Module Magic Number: 20120211:52
Server loaded:  APR 1.5.1, APR-UTIL 1.4.1
Compiled using: APR 1.5.1, APR-UTIL 1.4.1
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

WordPress (grep wp_version "$WPDIR/wp-includes/version.php"):

 * @global string $wp_version
$wp_version = '4.4.3';

free -m command output:

Please note that I've restarted the server and the error is not currently affecting the server. So the output below is not the output from when the error occured, but after restarting the server.

             total       used       free     shared    buffers     cached
Mem:          2003        741       1261          0         21        469
-/+ buffers/cache:        250       1752
Swap:     

   0          0          0
Nick Bull
  • 123
  • 4
  • update question with Apache prefork settings; for details which params are relevant to prefork setup check http://serverfault.com/questions/644622/tuning-apache2-prefork-maxclients-serverlimit/644632 – Hrvoje Špoljar May 19 '16 at 10:59

3 Answers3

4

When your system invoked the OOM killer, you appear to be running 161 httpd processes, that seems to be a little excessive for a system that gets <50 users/week.

The first thing I would do is reduce the number of httpd processes your system will spawn and keep alive

To do this adjust values of StartServers, MinSpareServers, MaxSpareServers, ServerLimit, etc (see the Apache documentation for details on each of those and more).

To do this properly you'll have to roll up your sleeves and get your hands dirty with the aid of Scientific Method or you could just randomly reduce ServerLimit and see what happens.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • 1
    Thank you! I knew there was something very odd about the number of `httpd` entries. The solution is in action and should I not report back in a few weeks after this then it's worked! – Nick Bull May 19 '16 at 12:14
4

As Iain described above the kernel module is killing apache I recently had similar issues, my first solution was to lighten the load on apache... particularly the wp-cron.php file.

Disabling the file running in wordpress on every click of every page and making a manual cron removed lots of load from the server: http://www.inmotionhosting.com/support/website/wordpress/disabling-the-wp-cronphp-in-wordpress

Besides that apache tuning was most effective in resolving this.. mine ended up something like:

StartServers        5
MinSpareServers     5
MaxSpareServers     10
MaxClients          50
MaxRequestsPerChild 200
cormpadre
  • 404
  • 2
  • 5
  • Upvoted for the specific Apache configs which have been implemented and seem to work perfectly, thanks for the help! – Nick Bull May 19 '16 at 14:30
0

I was running into the same issue with the same sort of traffic load. However, I've just disabled Jetpack and it seems to be working like a charm - I'm wondering if the extra queries from JetPack have been causing issues?