WMS日常运维_WJC

3.25、奥克斯项目Apache的server reached MaxClients setting问题

apachelog报错:[mpm_worker:error] [pid 2486:tid 140526322251584] AH00287: server is within MinSpareThreads of MaxRequestWorkers, consider raising the MaxRequestWorkers setting

解答:检查了一下,这是由于并发链接数太多导致的!

解决:

 ps -ef | grep httpd | grep -v grep | wc -l    --查看进程量

netstat -ant | grep -E ":80|:443" | wc -l    ----查看连接数

netstat -ant | grep ESTABLISHED | grep -E ":80|:443"   ---查看建立连接数

# vi /usr/local/apache2/conf/extra/httpd-mpm.conf

<IfModule mpm_worker_module>

    StartServers             3

    MinSpareThreads         75

    MaxSpareThreads        250

    ThreadsPerChild         25

    ServerLimit            2000

    MaxRequestWorkers      1000

    MaxConnectionsPerChild   0

</IfModule>

3.26、奥克斯项目 限制单个IP进行连接的线程,不允许多线程连接资源

对于IP限制,采用了 mod_limitipconn 这个模块。

这个模块的优点是配置简单,缺点是不能够针对单独的文件夹或者文件进行设置,而且不支持虚拟主机。 

在 apache 中安装了这个模块后,在配置文件中添加如下几段就可以生效了: 

ExtendedStatus On 

< IfModule mod_limitipconn.c > 

    < Location / >          # 所有虚拟主机的/目录 

        MaxConnPerIP 3      # 每IP只允许3个并发连接 

        NoIPLimit image/*      # 对图片不做IP限制 

    < /Location > 

    < Location /mp3 >            # 所有主机的/mp3目录 

        MaxConnPerIP 1              # 每IP只允许一个连接请求    

        OnlyIPLimit audio/mpeg video    # 该限制只对视频和音频格式的文件 

    < /Location > 

< /IfModule >

3.27、奥克斯项目No space left on device: Cannot create SSLMutex

错误提示“No space left on device: Cannot create SSLMutex”,这一句的含义是没有剩余资源创建 SSLMutex 共享变量

联想到了Linux无法创建句柄,并会无法提供服务,于是查看共享变量资源的占用情况

ipcs : ipcs provides information on the ipc facilities for which the calling process has read access.

# ipcs -s 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems    

0x00000000 0          root       600        1        

0x00000000 32769      root       600        1        

0x00000000 163842     apache     600        1        

0x00000000 196611     apache     600        1        

0x00000000 229380     apache     600        1        

0x00000000 262149     apache     600        1        

0x00000000 294918     apache     600        1 

发现共享变量有数百个被apache进程占用,无法释放,资源耗尽了。

于是,需要删除占尽的共享变量信号资源,删除命令如下:

# ipcs -s | perl -ane '/^0x00000000/ && `ipcrm -s $F[1]`'

查看 ipcs 的限制参数:ipcs -l

# ipcs -l

------ Shared Memory Limits --------

max number of segments = 4096

max seg size (kbytes) = 67108864

max total shared memory (kbytes) = 17179869184

min seg size (bytes) = 1

------ Semaphore Limits --------

max number of arrays = 128

max semaphores per array = 250

max semaphores system wide = 32000

max ops per semop call = 32

semaphore max value = 32767

------ Messages: Limits --------

max queues system wide = 3751

max size of message (bytes) = 65536

default max size of queue (bytes) = 65536

显示发现,Semaphore Limits 最大为128,超过了这个数量,httpd 服务将会无法再启动,也就导致了上面的网站打不开。

3.28、奥克斯项目tomcat内存泄漏存入dump文件

很多tomcat进程退出(或者进程假死),都是由于频繁的抛出OutOfMemeoryError导致的。

  为了让tomcat退出前或者发生OutOfMemeoryError时自动dump堆栈信息,方便事后排查问题,我们可以做如下操作:

  1、 在tomcat启动参数中加入两个参数 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/export /oom.hprof

  2、 重启tomcat

  参数说明

  (1)-XX:+HeapDumpOnOutOfMemoryError 表示当JVM发生OOM时,自动生成DUMP文件。

  (2)-XX:HeapDumpPath=存储文件/目录 表示生成DUMP文件的路径

3.29、奥克斯项目tomcat的Session超时的三种配置

设置Session超时时间方式:

方式一:
 在web.xml中设置session-config如下:
 <session-config>
  <session-timeout>2</session-timeout>
 </session-config>
 
 即客户端连续两次与服务器交互间隔时间最长为2分钟,2分钟后session.getAttribute()获取的值为空

方式二:
 在Tomcat的/conf/web.xml中session-config,默认值为:30分钟
 <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
 
方式三:
 在Servlet中设置
  HttpSession session = request.getSession();
  session.setMaxInactiveInterval(60);//单位为秒

说明:
 1.优先级:Servlet中API设置 > 程序/web.xml设置 > Tomcat/conf/web.xml设置
 2.若访问服务器session超时(本次访问与上次访问时间间隔大于session最大的不活动的间隔时间)了,即上次会话结束,但服务器与客户端会产生一个新的会话,之前的session里的属性值全部丢失,产生新的sesssionId
 3.客户端与服务器一次有效会话(session没有超时),每次访问sessionId相同,若代码中设置了session.setMaxInactiveInterval()值,那么这个session的最大不活动间隔时间将被修改,并被应用为新值。
 4.Session的销毁(代表会话周期的结束):在某个请求周期内调用了Session.invalidate()方法,此请求周期结束后,session被销毁;或者是session超时后自动销毁;或者客户端关掉浏览器

3.38、长安项目apache报错ap_proxy_connect_backend disabling worker  for (127.0.0.1)

解决办法是在apache http服务器虚拟主机配置中向代理程序指令添加“重试=0”参数,这样它就不会等待默认的60秒才能重试。

ProxyPass / http://backendserver:8080/ retry=0

猜你喜欢

转载自www.cnblogs.com/Snowfun/p/11536577.html