How to avoid apache to stop responding in MVC appl

2019-07-24 17:25发布

问题:

ASP.NET MVC4 application is running using Apache, Mono 3.2.8 and mod_mono in Debian x64 Linux

Some times in every month server stops responding:

There is also mod_mono control panel and apache server status module istalled.

Typing mysite.com, mysite.com/server-status or mysite.com/mono in browser waits forever. top shows that cpu usage is almost zero and there are lot of free memory.

There is no special timeout in web.config so every thread should terminated after 110 seconds even if it hangs. It looks like apache stops responding, maybe max number of conncurrent connections is reached. This is shopping cart application and search engine robots make huge amount of calls to it in every day.

How to fix or find reason of those hangups?

Is it reasonable to create cron job

wget --tries=1 --timeout=5  www.mysite.com || /etc/init.d/apache2 restart

which runs after every 10 minutes ? Will this restart apache if hangup occurs ?

Using crontab -e and adding line

10 * * * * wget --tries=1 --timeout=5  www.mysite.com || /etc/init.d/apache2 restart

runs check only once per hour. How to run check after every 10 minutes ?

apache2 -V returns:

Server version: Apache/2.2.22 (Debian)
Server built:   Feb  1 2014 21:26:17
Server's Module Magic Number: 20051115:30
Server loaded:  APR 1.4.6, APR-Util 1.4.1
Compiled using: APR 1.4.6, APR-Util 1.4.1
Architecture:   64-bit
Server MPM:     Worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/worker"
 -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 APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"