timeout 처리가 되어 있어 5초동안 응답이 없으면, 해당 톰캣을 빼도록 되어 있다.
잠깐이지만, 서버가 alive 상태로 있게 하고, 그 문제를 빨리 모니터링 서버에서 캐취해서 어드민 담당자에게 처리 할 수 있도록 하는 것이다..
사실 유지보수 차원에서도 이게 좀 편하다.. 프로젝트만 200개, 서버만 1000대 관리하는데...
worker설정에 다른 서버 ip 적어서 관리하는 것은 상상할 수 없다. 시스템 설정은 최대한 단순하게.. 그리고 배포가능하고 문제를 빨리 파악하게 하는 것이 좋다..
개인적으로 worker를 가지고 다른 ip를 보도록 하는 것은 유지보수 특성상 좋지 않아 보인다고 생각한다. 톰캣을 하나 더 올리는 것이 낫다.
톰캣이 2개여서 좋은 이유는 바로 이 것 같습니다. 바로 톰캣 하나가 비정상적인 종료를 하더라도 하나가 바쳐줄 수 있다라는 것입니다.
Cpu 개수(표준 서버 cpu 2개)에 맞춰서 tomcat 인스턴스를 늘이는 것이 부하를 줄이는 부분과load balancing을 하는 부분에서 탁월하다는 것이 제 생각입니다.
This plugin combines and minimizes JavaScript and CSS files using YUI Compressor for faster page loading.
-- Minimize HTTP Requests
-- Minify JavaScript and CSS
만약 톰캣 로그에서 Too many open files 가 발생한다면, 이는 os 적인 문제로 봐야 한다.
If you meet "SocketExcepton : too many open files" in tomcat log, you have to think about OS configuration.
java.net.SocketException: Too many open files
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:407)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:70)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
OS에서 한 프로세스에서 최대로 사용할 수 있는 File Descriptor의 개수는 정해져 있다. 리눅스의 경우는 ulimit (csh에서는 limit)으로 확인할 수있다.
The maximum number of file descripter is followed by policy of OS. In Linux, you can find ulimit (limit on csh).
Result of "ulimit -a "
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 1024
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
이 경우에는 open files 수자 1024로 되어 있다. 즉, 한 프로세스에서 사용할 수 있는 FD는 총 1024 정도 될 것이다.
In this case, open files number is 1024. So, the maximum number of file descriptors (FD) is 1024.
Tomcat 도 마찬가지로 적용될 수 있다. Tomcat에서 사용하고 있는 FD가 총 1024가 넘으면, (즉 이 말은 File , network socket을 의미한다) Too many files error 라고 Exception이 발생되고, 요청된 Request는 거절될 것이다.
Tomcat is applied like the policy. If FD used in Tomcat is over 1024, 'Too many files error' named SocketException is throwed in Tomcat, And rquest may be rejected.
<Solution>
1)/etc/security/limits.conf 파일을 수정한다.
You need to modify /etc/security/limits.conf file
vi /etc/security/limits.conf
....
#<domain> <type> <item> <value>
# add those thing
* soft nofile 16000
* hard nofile 16000
open files 숫자를 1024 에서 16000 으로 늘렸다.
Increase 1024 to 16000 in the number of open files.
댓글을 달아 주세요