끈기의 기술

After reading book 2007. 11. 26. 09:15

끈기의 기술

이시다 준 지음 | 김은하 옮김
북돋움 2007.02.28
평점

 

꾸준히 하지 못한 자신의 모습의 경과 상황

1. 자신이 결심한 일을 꾸준히 하지 못한다.
2. 목표를 달성하지 못한다.
3. 도중하차 하다 보니 좌절감을 느낀다

 

 

끈기를 발휘하기 위해 필요한 두 가지 기본조건

1. 목표 행동의 발생을 조절한다. 즉, 목표행동을 유도하는 환경을 구축한다.

2.  목표 행동을 방해하는 라이벌 행동의 발생을 조절한다.

 

'끈기의 기술'을 발휘하기 위한 두 가지 원칙

1. 목표행동의 컨트롤 : 목표행동을 즉시 실천할 수 있도록 환경조건을 바꾼다.

2. 라이벌 행동의 컨트롤 : 목표행동을 방해하는 라이벌행동을 사전에 차단한다.

 

'과잉행동'을 줄이기 어려운 이유

과잉행동을 그만두지 못하는 이유는 쾌감과 성과가 그 자리에서 확실히 나타나기 때문이다.

 

 

 

이 포스트를.. 파일로 저장

Posted by '김용환'
,

성공하는 사람들을 위한 부하직원을 움직이는 기술

토다 야스하루 지음 | 홍영의 옮김
글로벌 2006.07.20
평점

좋은 내용이 많아서

 

리더의 조건

1. 선견력을 가질 것.
2. 발상력, 기획력을 가질 것
3. 결단력, 실행력을 가질 것
4. 조직력, 통솔력을 가질 것
5. 포용력, 인간력을 가질 것
6. 건전한 체력을 가질것.

 

부하직원에게 숨기는 일이 없도록 한다. 비밀을 만들지 않는다의 의미

1. 배임 행위 등의 반사회적 행위를 하지 않는다.
2. 부하 직원에게 업무에 필요한 정보는 적극적으로 제공한다.
3. 부하 직원이 할 일을 사전에 동의 없이 처리한 것을 숨기지 않는다.
4. 부하 직원의 험담을 다른 직원에게 하지 않는다 등 부하 직원의 신뢰를 배신하지 않는 것이다.

 

상사가  보고를 받는 자세

1. 보고, 연락, 상담의 씨를 뿌려라
2. 항상 보고를 요구하라
3. 보고 하는 방법을 가르쳐라
4. 정보 전달의 스피드화를 꾀하라
5. 나쁜 정보는 현장에서 처리하라
6. 사실과 추측의 구별을 분명히 하도록 하라
7. 경영을 공명정대하고 비밀이 없도록 하라
8. 보고에 대한 기본적 태도를 익히게 하라
9. 정보의 흐름을 항상 감시하라
10. 나쁜 정보일수록 빨리 보고하게 하라
11. 사내 정보의 흐름을 원화하게 하라
12. 보고, 연락, 상담의 요령을 명시하라
13. 정보는 헛된 것이 없다를 가르쳐라

 

<사원육성에 있어서 중요한 것>

1. 가르치는 것 이상으로 육성하는 마음을 가져라
2. 솔선수범하라
3. 자신을 능가하는 인재를 육성하라
4. 기한이 빠듯한 일을 주고 가느성을 탐색하라
5. 선배, 상사, 타인의 정점을 가지게 하라
6. 경험이 없는 일에 도전하게 하라
7. 사원 교육 담당자를 정하여 일석이조를 노려라
8. 사원 교육의 순서를 그르치지 말라
9. 일의 진행방법을 가르치라
10. 문서 작성법을 가르치자
11. 제안하는 자세를 익히게 하라
12. 무리입니다. 할 수 없습니다 를 하지 말라
13. 등에도 눈을 갖게 하라
14. 프로 의식을 철저히 주입시켜라
15. 코스트 의식을 철저히 갖게 하라
13. 요구되는 인재를 텍스트로 명시하라

 

이 포스트를.. (+1) 파일로 저장

'After reading book' 카테고리의 다른 글

키스 프리젠테이션을 읽고,  (0) 2008.05.27
끈기의 기술  (0) 2007.11.26
처음부터 똑바로 말하라  (0) 2007.10.27
코칭의 힘  (0) 2007.10.27
가로세로 세계사 1  (0) 2007.10.03
Posted by '김용환'
,

아파치 튜닝
출처 : 불분명(통지바람)

1. 웹 페이지 로딩시간 확인
#time -pa lynx -source http://www.gwise.com > /dev/null
real 0.74
user 0.16
sys 0.09
-------------
실제 접속시간 : 0.74-(0.16+0.09)=0.49초

2. 아파치 벤치 마킹
#man ab 사용법 보기
-n requests 요청을 수행할 개수
-c concurrency 요청을 만들 개수로 동시 사용자 개념으로 이해하면 되겠다.
-v verbosity 얼마나 자세한 정보를 화면에 출력해 줄 것인지 결정
-w HTML 문서형식으로 테이블로 만들어 결과를 화면에 출력
-k HTTP 프로토콜의 지속연결 (KeepAlive) 기능을 사용

#./ab -n 100 -c 10 http://www.gwise.com:80/
10 명의 유저가 동시에 http://www.gwise.com/index.html 을 요청하는 것을 모의 실험.
각각의 시뮬레이트 유저는 요청을 10 번씩 하게 됩니다

# ab -n 1500 -c 50 http://www.apache.kr.net:80/
요청을 30 x 50 (50 명의 사용자가, 각각 30 번의 요청)

Requests per second: 80.48
초당 80.48개를 요청 했음.

'MaxRequestsPerChild’ 는 메모리 누수현상(?) 등이 발생하지 않는다면 가능한 이 값을 높게 설정하시고요(파라미터의 값을 0 으로 설정해 무한대로 하실수도 있습니다) StartServers’ 는 프로세스가 active 되어 있는 경우가 적을 경우 값을 낮게 설정하시고, 접속량이 아주 많을 경우는 MaxClients 에 가깝게 조절하시기 바라며, MaxSpareServers 를 MaxClients 와 같게 설정합니다. MaxClients 는 너무 낮게 설정하지 않도록 주의하시기 바라며, 그렇다고 또 너무 크게 잡으셔도 안됩니다


3. 웹 서버 삽질 막기
BrowserMatch "WebZip" go_out
BrowserMatch "Teleport" go_out
BrowserMatch "GetRight" go_out

 

....
Deny from env=go_out


4. 아파치 튜닝
일반 서버에서는 다른것은 그냥 Default 값으로 둔다.
(대형 서버의 경우 말고는 특히 쓸 일어 없을 것이다.)

증가 시킬 경우 배수로 한다. 꼭 이렇게 해야 한다가 아니라
이렇게 하면 좋다.

Timeout 300
클라이언트의 요청에 의해서 Server와 연결 되었을때
클라이언트와 서버간의 아무런 메시지가 발생하지 않았을때
오류로 처리하는 시간
네트워크 속도가 나쁠수록 수치값을 높게 한다.

KeepAlive on
지속적인 접속, 즉 서버 연결에 대하여 한번 이상의 요청을 허용 여부.

MaxKeepAliveRequests 100
클라이언트가 접속된 시간동안 아파치 서버에 요청할 수 있는 처리 process 개수

StartServers 5 X ? =20 -> 초반에 뜰 process 그 이상 그이하의 의미도 없다.
MinSpareServers 5 X ? =20 -> Spare 프로세스가 이것 이하 일때 끌어 올려 준다.
MaxSpareServers 10 X ? =40 -> Spare 프로세스가 이것 이상 일때 진정(?)시켜 준다.
말 그대로 Spare.... 언제 있을지 모를 요청에 대해서 컴퓨터 스스로가
조절해 준다.

MaxClients 150
클라이언트들이 동시에 최대로 접속했을때 가능한 최대 서버이 수를 지정.
Ulimit -a ~~~ max process...이 수치 이상 증가 못함.
httpd.h
HARD_SERVER_LIMIT=250 조정해서 다시 컴파일 가능

MaxClient 150 -> 동시에 떠 있을수 있는 최대 process
더 많은 수를 원할시 httpd.h 소스 파일의
HARD_SERVER_LIMIT 값을 수정 한 다음 다시 컴파일 해야 한다.

#ulimit -a
core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max memory size (kbytes) unlimited
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 2048
pipe size (512 bytes) 8
open files 1024
virtual memory (kbytes) 2105343
-----------------------
위의 max user processes 의 수를 초과 할 수 없다.

MaxRequestPerChild 100
한 프로세스가 몇 번의 서비스를 하고 소멸될 것인지 정한다.
M$계열에서는 별 의미가 없으므로 0을 한다.
하지만 Unix 계열은 0을 사용하지 않는 것이 좋다.

가장 중요한 것은Timeout 설정입니다. 위에서 keep-alive 를 설정해 놓은
경우, 하나의 connection에서 계속해서 다음 request를 처리할 수 있기 때문에 효율적
이라고 하지만, 실제로는 그렇지 않습니다. keep-alive 를 허용하고 그 timeout을
5초로만 설정해도, 하나의 request를 처리한 후 적어도 5초동안은 그 httpd가 다른
작업을 하지 못하고 다음 request를 기다리게 됩니다.

보통 웹브라우저들은 서버로 동시에 4개의 connection을 만들게 됩니다. 한 페이지를
보는데 이미지 등등 해서 보통 4개의 connection을 만드는 것은 기본이죠. 이렇게 되면
httpd가 100개 떠 있다고 해도, 실제로는 동시에 25명의 방문자밖에 처리하지 못합니다.

그리고 keep-alive timeout이 5초인 경우, 한 명의 방문자를 처리한 후 적어도 5초동안은
계속해서 기다리면서 httpd가 놀게 됩니다.(그렇다고 해서 httpd의 수를 늘여주면 앞의
문제 때문에 load가 몰릴 때 순간적으로 부하가 지나치게 많이 걸리게 됩니다. 어떤
request는 수초가 지난 후 답을 받는 등 quality of service가 많이 떨어지죠.)

결국 한 명의 방문자를 처리하는데 4개의 httpd가 5초동안 작업한다는 뜻이고, 100개의
httpd를 띄워봐야 1초에 5명의 방문자밖에 처리하지 못하는 셈입니다. ( 1 명 / 5 sec /
4 httpd = 5 / 1 sec / 100 httpd )

그래서 검색엔진 서비스 등 traffic이 많은 사이트에서는 keep-alive 옵션을 반드시 꺼
놓게 됩니다. 그리고 connection timeout도 상당히 짧게 설정해 놓죠. 4~5초 이내로 말입니다

http://www.apache.org/docs/misc/perf-tuning.html
web performance tunning - 오렐리

그렇지만 명심할 점이 있습니다. 웹사이트의 성능 개선을 위해서는 커널에서만
손대주는 것이 아니라 OS, 네트웍, 프로그래밍 등 다양한 조건을 같이 고려해야
한다는 것입니다. 또한 하드웨어 성능을 고려하지 않은채 무작정 바꾸면 문제가
생긴다는 것입니다. 또한 일반적으로 정적인 html서비스는 문제가 안되지만 성능의
병목지점이 생기는 곳은 네트웍이 아니라면 cgi일 경우가 많습니다. 아파치에
들어있는 ab, 유닉스의 time, ping, netstat 등 다양한 명령어들을 이용해서 항상
시스템의 상태를 모니터링해보고 속도를 재어 보아야 합니다. 또한 아무리 튜닝을
잘해도 웹페이지에 이미지를 엄청나게 넣어둔다면 헛일하는것이지요. 저도 잘
모르면서 어설크게 오라클 튜닝을 한다고 했더니 cpu 4개, 메모리 2G인 시스템에서
오히려 일반PC보다 오라클이 더 느려지더군요. 잘 모르는 경우에는 기본값을 사용하는
것이 더 나을때도 있지요. 아래 예에서 keepalive 옵션은 대형 사이트같은 경우에는
off로 해 놓는 것이 더 나은 경우도 많이 있습니다. 빨리 처리하고 연결을 빨리빨리
끊어주는 것이 아무일도 하지 않은채 그냥 프로세스를 띄워놓고 놀리는 것보다는
낫지요.

 


아파치 웹 서버 튜닝
문태준(taejun at tunelinux.pe.kr http://tunelinux.pe.kr)

아파치 웹 서버의 튜닝은 간략하게 두 부분으로 나눌 수 있다. 첫 번째는 소스코드에
하드코딩 되어 있는 제한 값을 조정하는 것이고, 두 번째는 환경설정 파일의 각 제한
값들을 수정하는 것이다.

1) 소스레벨
httpd.h 파일에 리눅스의 경우 HARD_SERVER_LIMIT 값이 256으로 기본 설정되어
있으며, 이 값은 서버가 수용할 수 있는 최대 접속을 의미한다. 이 값을 1280으로
설정한다.

2) 환경설정 파일
가. KeepAliveTimeout
클라이언트가 서버로 접속을 했을 경우 하나의 웹 서버 프로세스가 해당 웹 페이지의
여러 개체들의 전송을 새로운 프로세스를 생성하지 않고 지속적으로 접속을 유지하며
담당하며, 이 클라이언트의 요청에 대한 타임아웃에 대한 값이다. 기본 15초에서
30초로 증가.
나. MaxKeepAliveRequests
웹 서버 프로세스가 지속적으로 접속을 유지하면서 처리할 수 있는 요청 개수이다.
100으로 설정되어 있으며, 10000으로 증가.
다. StartServer, Min/MaxSpareServer
기본 설정은 5, 5, 10정도이며, 웹 서버가 Standalone 방식일 경우 새로운 접속
요청을 받으면 기존의 Spare Child Process를 포크하여 새로운 Child Process를
만들어내므로 기본적으로 Spare Process가 많을수록 폭주에 빨리 대처할 수 있다.
StartServer 20, MinSpareServer 20, MaxSpareServer 40으로 증가.
라. MaxRequestsPerChild
웹 서버 프로세스가 일정 횟수의 클라이언트 요청을 처리하고 종료되는 수치이며,
1000으로 증가.
마. MaxClients
동시에 실행될 수 있는 최대 프로세스 수를 제한하는 것이며, 기본 256으로 설정되어
있다. 이를 512까지 증가.
바. 로그파일 생성
이용자가 접속할 때마다 기록되는 access_log 파일의 경우 한번 접속당 약 85바이트가
증가하며, 접속량이 많을 경우 이 파일의 크기는 실제로 엄청나다. 이럴 경우
접속때마다 로그파일을 액세스하는데 상당한 시간과 부하가 걸리므로 로그 파일을
일정시간마다 초기화하여 항상 경량화 시켜 줄 필요가 있다. 아파치에서 제공하는
rotatelog를 이용.


ㅇ커널 소프트 레벨 튜닝

커널이 제공하는 파라메터값을 /proc 파일 시스템을 이용해서 부팅이 완료된 시점후에
변경한다. 여기서는 주로 파일시스템과 네트웍 자원에 관련된 내용에 대해서
튜닝한다.

1) 파일 시스템 관련
- 리눅스 커널이 할당할 수 있는 파일 개수의 최대값 : 4096 -> 32768
- 리눅스 커널이 할당할 수 있는 inode 개수의 최대값 : 16384 -> 65536
- root 사용자에 대해 할당할 수 있는 파일 개수의 최대값 : 1024 -> 32768
- 하나의 프로세스가 오픈할 수 있는 파일의 개수 : 256 -> 512

2) 네트웍 자원 관련
- TCP 가 Keep Alive 메시지를 보내는 시간 간격 : 7200 -> 1200
- 소켓이 항상 CLOSE되기 전에 마지막 FIN 을 기다리는 시간 : 180 -> 30
- 하나의 TCP 접속 요청에 대해 응답을 재전송하는 횟수 : 7 -> 2

이렇게 설정되는 값들은 시스템이 부팅되면서 스크립트를 통해 설정되어야 되기
때문에 /etc/rc.d/rc.local 파일의 마지막 부분에 정의된다.

ㅇ 커널 하드 레벨 튜닝

커널 소스를 직접 수정하여 제한값을 조정한다. 이를 위해서는 커널 컴파일이
필수적이며, 조심스런 접근이 필요하다.

- 파일 오픈 개수
- 처리할 수 있는 프로세스 개수

**참고

1. 아파치 웹 서버 튜닝
- apache/src/include/httpd.h:
HARD_SERVER_LIMIT 256 -> 1280
- apache/conf/httpd.conf:
MaxKeepAliveRequests 100 -> 10000
KeepAliveTimeout 15 -> 30
MinSpareServers 5 -> 20
MaxSpareServers 10 -> 40
StartServers 5 -> 20
MaxClients 256 -> 1024

2. 커널 소프트 레벨 튜닝
- ulimit -n 32768
- /proc/sys/fs/file-max: 4096 -> 32768
- /proc/sys/fs/inode-max: 16384 -> 65536
- /proc/sys/net/ipv4/tcp_keepalive_time: 7200 -> 1200
- /proc/sys/net/ipv4/tcp_fin_timeout: 180 -> 30
- /proc/sys/net/ipv4/tcp_sack: 1 -> 0
- /proc/sys/net/ipv4/tcp_timestamps: 1 -> 0
- /proc/sys/net/ipv4/tcp_syncookies: 0 -> 1
- /proc/sys/net/ipv4/tcp_retries1: 7 -> 2
- /proc/sys/net/ipv4/tcp_max_syn_backlog: 128 -> 8192
- /proc/sys/net/ipv4/tcp_window_scaling: 1-> 0

3. 커널 하드 레벨 튜닝
- /usr/src/linux/include/linux/fs.h:
NR_FILE 4096 -> 32768
INR_OPEN 1024 -> 32767
- /usr/src/linux/include/linux/tasks.h:
NR_TASKS 2560 -> 3192
MAX_TASKS_PER_USER 2048 -> 3192
- /usr/src/linux/include/linux/limits.h:
NR_OPEN 1024 -> 32767
- /usr/src/linux/include/net/tcp.h:
TCP_TIMEWAIT_LEN (60*HZ) -> (15*HZ) 

Posted by '김용환'
,

Lucy alpha cms에서 나던 Exception 있죠?

 

IOException while loading persisted sessions: java.io.EOFException

  

톰캣은 persist session을 저장할 수 있답니다.. , 종료나 restart 될 때에 session정보를 serialize 하게 저장합니다.

Shutdown할 때, session create되고, start할 때는 제거된다고 하네요.

serialize한게 저장한 것을 못읽어 Exception이 나왔습니다.

 

해결 방법은 session.ser을 지운면 된다고 합니다. 어제 밤에 확인을 했었는데. Ser 확장자를 지웠더니 해당 Exception은 안나더군요. 참고하세요.^^

 


ERROR [main] (StandardManager.java:372) - IOException while loading persisted sessions: java.io.EOFException
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:57)
at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:361)
at org.apache.catalina.session.StandardManager.load(StandardManager.java:320)
at org.apache.catalina.session.StandardManager.start(StandardManager.java:636)
at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
at org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:391)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1042)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:255)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4076)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:910)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:873)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:680)
at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


ERROR [main] (StandardManager.java:638) - Exception loading sessions from persistent storage
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
at org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStream.java:57)
at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:361)
at org.apache.catalina.session.StandardManager.load(StandardManager.java:320)
at org.apache.catalina.session.StandardManager.start(StandardManager.java:636)
at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:431)
at org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:391)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1042)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:255)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4076)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:910)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:873)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:680)
at org.apache.catalina.startup.Catalina.start(Catalina.java:536)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

 

 

참고자료

http://72.14.235.104/search?q=cache:Ew7B0Xe8VA0J:thiamteck.blogspot.com/2006/07/session-persistent-in-tomcat.html+session.ser&hl=ko&ct=clnk&cd=11&gl=kr

http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-12724.html

 

Posted by '김용환'
,

 

로깅 시간 출력

 

 #!/bin/bash
cd /data/env/project/log
DATE=$(date '+%y/%m/%d %H:%M:%S')
echo $DATE >  /data/env/project/log/logIDS.txt
eval 'exec getLog.pl -p ids >> /data/env/project/log/logIDS.txt'

 

결과

 

[a50236:/data/env/project/log]# cat logIDS.txt
07/11/13 20:31:45
host : aaaa 10%  20%  40%  50%  60%  100%

'unix and linux' 카테고리의 다른 글

grep을 이용하여 여러개의 패턴으로 먼가를 찾기  (0) 2007.12.28
bash if 문 비교  (0) 2007.11.30
netstat 과 tcp 상태  (0) 2007.10.31
grep -c 와 wc -l은 똑같은 명령어이다.  (0) 2007.10.18
crond 문제  (0) 2007.10.17
Posted by '김용환'
,
Posted by '김용환'
,

jmx의 첫장

java core 2007. 11. 13. 06:58

 

정말 편하게 좋게, 좋은 예재로 쉽게 설명한 글..^^

출처 :

 http://java.sun.com/developer/technicalArticles/J2SE/jmx.html

 

  • Solaris

    Download the most advanced operating system in the world

  • Sun Studio

    Optimizing compilers and tools for C/C++/Fortran application development

  • Solaris Developer Center

    Explore the resources and community available to the Solaris developer.

  • Sun Developer Services

    Get technical assistance, product support, training, and other services from the source.

  • BigAdmin

    A community site with Solaris system administration information, hardware compatibility, a script library, and other resources for administrators of Sun products.

  • OpenSolaris

    Join the open-source community for collaboration and conversation around the OpenSolaris technology.

  • OpenJDK

    The place to collaborate on the open-source JDK, an implementation of the Java Platform, Standard Edition specification.

  • Mobile & Embedded

    The Mobile & Embedded Community enables and empowers developers to collaborate and innovate, driving the evolution and adoption of the Java(TM) Platform, Micro Edition (Java ME) for mobile and embedded devices.

  • GlassFish

    The GlassFish community is building free, open source, production-quality, enterprise software.

  • NetBeans

    You have the opportunity to submit bugs and feature requests in IssueZilla, submit news for the NetBeans Community, and contribute code or even create a project of your own. Welcome to the team!

  • OpenSolaris

    The OpenSolaris source code is already cutting edge, but innovation happens everywhere, so we welcome your involvement.

  • OpenSPARC

    OpenSPARC.net is the genesis of a vision to create a larger community where open conversations and collaborative development projects spawn dramatic innovations around chip design.

  • OpenJFX

    Project OpenJFX is a community for sharing early versions of the JavaFX Script language and for collaborating on its development.

  • java.net

    A gathering place for Java technology enthusiasts and existing communities across industries, platforms, and interest groups.

  • Sun Student Developers

    The SDN Academic Developer Program offers you ready access to tools, resources, and student communities.

  • Java Community Process

    The JCP gives you a chance to both have your own work become an official component of the Java platform, and to offer suggestions for improving and growing the technology.

  • Join SDN Now
  • Why Join

    Becoming an Sun Developer Network (SDN) member makes you part of a vibrant worldwide community of developers, and gives you access to cool stuff and exclusive offers.

 
Article

Getting Started with Java Management Extensions (JMX): Developing Management and Monitoring Solutions

By Qusay H. Mahmoud, January 6, 2004  
Contents
 
Overview of JMX Technology
JMX Tiered Architecture
JMX Technology Implementations
JMX Technology and J2SE 5.0
The JMX Technology Programming Model
JMX Technology for Remote Management
JMX Technology Related Specifications
 

The Java Management Extensions (JMX) API is a standard —developed through the Java Community Process (JCP) as JSR 3—for managing and monitoring applications and services. It defines a management architecture, design patterns, APIs, and services for building web-based, distributed, dynamic, and modular solutions to manage Java-enabled resources. The JMX APIs make it possible to add manageability to Java-enabled equipment, from web phones to set-top boxes to network devices and servers. Using JMX technology to manage applications and services increases their value to vendors and clients by making applications easier to install, configure, and maintain.

This article provides a fast track technical tutorial to JMX technology. It discusses JMX's tiered architecture, the JMX programming model, and code demonstrating how to use JMX technology to develop management applications. In addition, the article shows how to use a JMX technology-compliant management tool in the Java 2 Platform, Standard Edition 5.0 (J2SE 5.0), which has implemented version 1.2 of the JMX specification.

Overview of JMX Technology
 

The JMX technology is native to the Java programming language. As a result, it offers natural, efficient, and lightweight management extensions to Java-based functions. It consists of a set of specifications and development tools for managing Java environments and developing state-of-the-art management solutions for applications and services. It provides Java developers with the means to instrument Java code, create smart Java agents, implement distributed management middleware and managers, and easily integrate these solutions into existing management and monitoring systems. The dynamics of the JMX technology architecture enables you to use it to monitor and manage resources as they are implemented and installed. It can also be used to monitor and manage the Java Virtual Machine (JVM machine).

Typical uses of the JMX technology include:

  • Consulting and changing application configuration
  • Collecting statistics about application behavior and making the statistics available
  • Notification of state changes and erroneous conditions

Benefits of JMX Technology

The JMX technology enables Java developers to encapsulate resources as Java objects and expose them as management resources in a distributed environment. The JMX specification lists the following benefits to using it to build a management infrastructure:

  • Manages Java applications and services without heavy investment: JMX architecture relies on a core managed object server that acts as a management agent and can run on most Java-enabled devices. Java applications can be managed with little impact on their design.

  • Provides a scalable management architecture: A JMX agent service is independent and can be plugged into the management agent. The component-based approach enables JMX solutions to scale from small footprint devices to large telecommunications switches.

  • Can leverage future management concepts: It can implement flexible and dynamic management solutions. It can leverage emerging technologies; for example JMX solutions can use lookup and discovery services such as Jini network technology, UPnP, and Service Location Protocol (SLP).

  • Focuses on management: While JMX technology provides a number of services designed to fit into a distributed environment, its APIs are focused on providing functionality for managing networks, systems, applications, and services.
JMX Tiered Architecture
 

JMX technology provides a tiered architecture where managed resources and management applications can be integrated in the plug-and-play approach as shown in Figure 1. A given resource is instrumented by one or more Java objects known as Managed Beans (or MBeans), which are registered in a core managed object server known as the MBean server. This server acts as a management agent and can run on most Java-enabled devices.


Figure 1: JMX Tiered Architecture

As Figure 1 demonstrates, there are three tiers or levels in this architecture: instrumentation, agent, and manager.

Instrumentation Level

This tier contains MBeans and their manageable resources. It provides a specification for implementing JMX technology-manageable resources, which can be an application, service, device, or user. A resource is manageable if it is developed in Java (or provides a Java wrapper) and has been instrumented so that it can be managed by JMX-compliant applications. A resource is instrumented by one or more MBeans that are either standard or dynamic. Standard MBeans are Java objects that conform to certain design patterns (for example, they must have a constructor and setter/getter methods). A dynamic MBean conforms to a specific interface that offers more flexibility at runtime. The instrumentation of a resource allows it to be manageable at the agent level; however, note that MBeans do not require knowledge of the JMX agent with which they operate. In other words, any JMX-manageable resource can use any JMX agent that offers the services it requires.

The key Components at the instrumentation level are the MBeans, the notification model, and the MBean metadata classes.

  • MBeans: An MBean is a Java object that implements a specific interface. The management interface of an MBean is represented as: (1) valued attributes that can be accessed; (2) operations that can be invoked; (3) notifications that can be emitted; and (4) the constructors. There are four types of MBeans:
    • Standard MBeans: The simplest to design and implement. Their management interface is described by their method names.
    • Dynamic MBeans: They implement a specific interface, and they expose their management interfaces at runtime for greatest flexibility.
    • Open MBean: Dynamic MBeans that rely on basic data types for universal manageability; they are self-describing for user-friendliness.
    • Model MBeans: Dynamic MBeans that are fully configurable and self described at runtime. They provide a generic MBean class with default behavior for dynamic instrumentation of resources.
  • Notification Model: JMX technology defines a generic notification model based on the Java event model. It lets developers build proactive management solutions. Using notifications, JMX agents and MBeans can send critical information to interested parties such as management applications or other MBeans.

  • MBean Metadata Classes: These classes contain the structures to describe all components of an MBean's management interface: its attributes, operations, notification, and constructors. For each of these, the metadata include a name, a description and its particular characteristics (for example, an attribute is readable, writeable, or both; for an operation, the signature of its parameter and return types).

Agent Level

This tier contains the JMX agents used to expose the MBeans. It provides a specification for implementing agents, which control the resources and make them available to remote management applications. Agents are usually located on the same machine as the resources they manage, but this is not a requirement. The JMX agent consists of an MBean server and a set of services for handling MBeans. Managers access an agent's MBeans and use the provided services through a protocol adaptor or connector. But note that JMX agents do not require knowledge of the remote management applications that use them.

The main components at the agent level are the MBean Server and Agent Services.

  • MBean Server: A registry of objects that are exposed to management operations in an agent. Any object registered with the MBean server becomes visible to management applications. However, note that the MBean server only exposes an MBean's management interface and never its direct object reference. Any resources that you want to manage from outside the agent's JVM must be registered as an MBean in the server. The server also provides a standardized interface for accessing MBeans within the same JVM, giving local objects all the benefits of manipulating manageable resources. MBeans can be instantiated and registered by another MBean, the agent itself, or a remote management application through the distributed services. When you register an MBean, you must assign it a unique object name, which is used by the management application to identify the object on which to perform a management operation.

  • Agent Services: Objects that can perform management operations on the MBeans registered in the MBean server. By including management intelligence in the agent, JMX helps you build more powerful management solutions. The JMX API defines the following Agent Services available in J2SE 5.0:
    • Dynamic Class loader: Through the management applet (m-let) service, retrieves and instantiates new classes and native libraries from an arbitrary network location.
    • Monitors: Observe the numerical or string value of an attribute of several MBeans and can notify other objects of several types of changes in the target.
    • Timers: Provide a scheduling mechanism based on a one-time alarm-clock notification or on a repeated, periodic notification.
    • The relation service: Defines associations between MBeans and enforces the cardinality of the relation based on predefined relation types.

Manager (or Distributed Services) Level

This tier contains the components that enable management applications to communicate with JMX agents. It provides the interfaces for implementing JMX managers, and defines the management interfaces and components that operate on agents. Such components provide an interface for a management application to interact with an agent and its JMX manageable resources through a connector, and also expose a management view of a JMX agent and its MBeans by mapping their semantic meaning into the constructs of a data-rich protocol (such as HTML).

JMX comprises a separate package for each tier of the management architecture. The instrumentation tier will be free, and other tiers can be built from public specifications or reference implementations available under Sun Community Source License. Alternatively, you can purchase commercially supported products.

JMX Technology Implementations
 

The Java 2 Platform, Standard Edition 5.0 (J2SE 5.0) supports JMX 1.2 and JMX Remote API 1.0, which is now the official JMX reference implementation (RI). For developers who are running J2SE 1.4, a JMX RI is also available from Sun Microsystems, and can be downloaded free of charge.

Sun Microsystems also provides the Java Dynamic Management Kit (Java DMK). Java DMK 5.1 is the first commercial implementation of the latest versions of the JMX standards, JMX 1.2 and JMX Remote API 1.0. JMDK is an all-in-one product for building secure, interoperable monitoring and management solutions on the J2SE platform, and it is supported on Solaris, Microsoft Windows, and Linux. Several other commercial and open source implementations are available as well. It is worth noting that Tomcat 5.0 implements the JMX specification.

JMX Technology and J2SE 5.0
 

J2SE 5.0 has implemented version 1.2 of the JMX specification and version 1.0 of the JMX Remote API (JSR 160) specification. J2SE 5.0 includes significant monitoring and management features, including:

  • JVM instrumentation: The JVM is instrumented for monitoring and management providing built-in, out-of-the-box management capabilities for local and remote access.

  • Monitoring and Management APIs: The java.lang.management package provides the interface for monitoring and managing the JVM. It provides access to information such as: number of classes loaded and threads running, memory consumption, garbage collection statistics, on-demand deadlock detection, and others.

  • Management tools such as JConsole, which is a JMX-compliant monitoring tool that comes with J2SE 5.0. It uses JMX instrumentation of the JVM to provide information on performance and resource consumption of applications running on the Java platform.

The core classes for the JMX implementation are provided in the javax.management package. In addition, the java.lang.management package provides the mangagement interface for monitoring and management of the JVM as well as the operating system on which the JVM is running.

To enable the JMX agent and configure its operation using jconsole, your must set some specific system properties when you start the JVM. For local access, set the property com.sun.management.jmxremote as follows when starting the JVM:

    prompt> java -Dcom.sun.management.jmxremote AppName

And, to enable monitoring and management from remote systems, set the property:

    com.sun.management.jmxremote.port=portNumber

For more information on setting system properties for JMX, please see Monitoring and Management using JMX.

The JMX Technology Programming Model
 

Using JMX to instrument your applications, services, or devices for manageability is simple. This is because JMX technology shares Java's object model. If you are familiar with Java and its JavaBeans component model, you already know 95% of all you need to know.

As mentioned previously, an MBean is a Java object that follows some standard design patterns and naming conventions. It can represent a device, application, or any resource that needs to be managed. An MBean exposes a management interface or a set of readable and/or writable attributes and a set of invokable operations, along with a self-description. Note that the management interface does not change through the life of an MBean instance.

Sample Application

This simple application manages a resource. You will create a simple standard MBean that exposes a String object and an operation. For more JMX technology examples, please see the JMX Tutorial.

The first step is to develop the MBean interface. In this application, the interface is called HelloMBean, which declares three methods: one getter, one setter, and one for saying hello as shown in Code Sample 1.

Code Sample 1: HelloMBean.java
public interface HelloMBean {

   public void setMessage(String message);

   public String getMessage();

   public void sayHello();
}
 

The next step is to implement the MBean interface. A sample implementation is shown in the following Code Sample.

Code Sample 2: Hello.java
public class Hello implements HelloMBean {
   private String message = null;

   public Hello() {
      message = "Hello there";
   }

   public Hello(String message) {
      this.message = message;
   }

   public void setMessage(String message) {
      this.message = message;
   }

   public String getMessage() {
      return message;
   }

   public void sayHello() {
      System.out.println(message);
   }
}
 

Congratulations! You have created your first MBean. The next step is to test the MBean, by developing a JMX agent in which you register the MBean. A JMX agent is a component in the agent level and acts as a container for the MBean. A sample agent, SimpleAgent, is provided in Code Sample 3. This agent performs the following tasks:

  1. Gets the platform MBeanServer
  2. Registers an instance of the Hello MBean
Code Sample 3: SimpleAgent.java
import javax.management.*;
import java.lang.management.*;

public class SimpleAgent {
   private MBeanServer mbs = null;

   public SimpleAgent() {

      // Get the platform MBeanServer
       mbs = ManagementFactory.getPlatformMBeanServer();

      // Unique identification of MBeans
      Hello helloBean = new Hello();
      ObjectName helloName = null;

      try {
         // Uniquely identify the MBeans and register them with the platform MBeanServer 
         helloName = new ObjectName("SimpleAgent:name=hellothere");
         mbs.registerMBean(helloBean, helloName);
      } catch(Exception e) {
         e.printStackTrace();
      }
   }

   // Utility method: so that the application continues to run
   private static void waitForEnterPressed() {
      try {
         System.out.println("Press  to continue...");
         System.in.read();
      } catch (Exception e) {
         e.printStackTrace();
      }
    }

   public static void main(String argv[]) {
      SimpleAgent agent = new SimpleAgent();
      System.out.println("SimpleAgent is running...");
      SimpleAgent.waitForEnterPressed();
   }
}
 

The java.lang.management.ManagementFactory class is a factory class for getting managed beans for the Java platform. In this example, the getPlatformMBeanServer() method is used to get the platform MBeanServer, which is the interface for MBean manipulation on the agent side. It contains the methods necessary for the creation, registration, and deletion of MBeans. The MBeanServer is the core component of the JMX agent infrastructure.

To experiment with this application, do the following:

  1. Create a directory of your choice (such as jmx-example)
  2. Copy Code Samples 1, 2, and 3 into that directory
  3. Compile all the .java files using javac
  4. Run SimpleAgent. In order to use the jconsole tool to manage it, you should run the SimpleAgent as follows:

        prompt> java -Dcom.sun.management.jmxremote SimpleAgent

    Note: The -Dcom.sun.management.jmxremote system property creates an RMI connector to the platform MBeanServer. For information on the RMI connector, see the coming section, Using the RMI Connector.

  5. Connect to the JMX agent using the jconsole tool. Run the jconsole tool from the command line. Once you start jconsole, it will display the list of local processes to be monitored as shown in Figure 2.


    Figure 2: The jconsole monitoring tool

  6. Now, you can connect to the service. Once connected, select the MBeans tab so that you can list the MBeans and manage them as shown in Figure 3.


Figure 3: The MBeans tab of jconsole

It is worth noting that local monitoring with jconsole is useful for development and prototyping. It is not recommended that jconsole be used locally for production environments as it consumes significant system resources. jconsole should be used on a remote system from the platform being monitored. For more information on jconsole and sample screenshots of what it provides, please see Using JConsole.

JMX Technology for Remote Management
 

The MBean server relies on protocol adaptors and connectors to make a JMX agent accessible from management applications outside the agent's JVM. Adaptors provide a view through a specific protocol for all MBeans registered in the MBean server (for example, an HTML adaptor could display an MBean in a Web browser). Connectors provide a manager-side interface that handles the communication between manager and JMX agent. When a remote management application uses this interface, it can connect to a JMX agent transparently through the network regardless of the protocol.

JMX technology exports JMX API instrumentation to remote applications by using Remote Method Invocation (RMI). It also defines an optional protocol based directly on TCP sockets called the JMX Messaging Protocol (JMXMP). However, note that this protocol is not supported in J2SE 5.0.

The JMX Remote API 1.0 (JSR 160) specification describes how to advertise and find JMX agents using existing discovery and lookup infrastructures. In other words, the specification does not define its own discovery and lookup service. Using existing discovery and lookup services is optional; you can encode the address of your JMX API agents in the form of URLs and make these URLs available to the manager.

Using the RMI Connector

Code Sample 4 shows an example of using the RMI connector, which is a slight modification of Code Sample 3.

Code Sample 4: SimpleAgent.java
import javax.management.*;
import java.lang.management.*;
import javax.management.remote.*;

public class SimpleAgent {
   private MBeanServer mbs = null;

   public SimpleAgent() {

      // Get the platform MBeanServer
      mbs = ManagementFactory.getPlatformMBeanServer();

      // Unique identification of MBeans
      Hello helloBean = new Hello();
      ObjectName helloName = null;

      try {
         // Uniquely identify the MBeans and register them with the MBeanServer 
         helloName = new ObjectName("SimpleAgent:name=hellothere");
         mbs.registerMBean(helloBean, helloName);

         // Create an RMI connector and start it
         JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/server");
         JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
         cs.start();
      } catch(Exception e) {
         e.printStackTrace();
      }
   }

   public static void main(String argv[]) {
      SimpleAgent agent = new SimpleAgent();
      System.out.println("SimpleAgent is running...");
   }
}
 

To run this application, do the following:

  1. If you wish to run this application on J2SE 1.4, you need to change the line mbs = ManagementFactory.getPlatformMBeanServer();.
    to mbs = MBeanServerFactory.createMBeanServer("SimpleAgent");
  2. Compile the revised SimpleAgent.java from Code Sample 4.
  3. Start the rmiregistry on port 9999 (prompt> rmiregistry 9999).
  4. Run SimpleAgent (prompt> java SimpleAgent).
  5. While SimpleAgent is running, run jconsole and then use the Advanced tab and enter the information as shown in the following figure.


    Figure 4: Configuring jconsole for remote management

  6. Once you are connected, you can browse the MBeans and manage them using the MBeans tab as shown in Figure 5.


Figure 5: Browsing and managing remote MBeans

Using the HTML Adaptor

An HTML adaptor is provided by Sun Microsystems and comes with the JMX Reference Implementation (it doesn't come with J2SE 5.0). The HTML adaptor lets you manage MBeans using a web browser. The adaptor enables you to interact with the agent to view registered MBeans and their attributes. In other words, this adaptor provides a simple yet powerful management tool that lets you:

  • View the readable MBean attributes
  • Update writable attributes
  • Invoke methods

Code Sample 5 shows the revised SimpleAgent that uses the HTML adaptor.

Code Sample 5: SimpleAgent.java
import javax.management.*;
import java.lang.management.*;
import com.sun.jdmk.comm.HtmlAdaptorServer;

public class SimpleAgent {
   private MBeanServer mbs = null;

   public SimpleAgent() {

      // Create an MBeanServer and HTML adaptor (J2SE 1.4)
      mbs = ManagementFactory.getPlatformMBeanServer();
      HtmlAdaptorServer adapter = new HtmlAdaptorServer();

      // Unique identification of MBeans
      Hello helloBean = new Hello();
      ObjectName adapterName = null;
      ObjectName helloName = null;

      try {
         // Uniquely identify the MBeans and register them with the MBeanServer 
         helloName = new ObjectName("SimpleAgent:name=hellothere");
         mbs.registerMBean(helloBean, helloName);
         // Register and start the HTML adaptor
         adapterName = new ObjectName("SimpleAgent:name=htmladapter,port=8000");
         adapter.setPort(8000);
         mbs.registerMBean(adapter, adapterName);
         adapter.start();
      } catch(Exception e) {
         e.printStackTrace();
      }
   }

   public static void main(String argv[]) {
      SimpleAgent agent = new SimpleAgent();
      System.out.println("SimpleAgent is running...");
   }
}
 

To experiment with this application, do the following:

  1. Download the JMX Reference Implementation. This is needed only because SimpleAgent (in Code Sample 5) uses the HTML Adaptor, which does not come with the J2SE 5.0 implementation of JMX 1.2. From the JMX implementation, you only need the jmxtools.jar file.
  2. If you wish to run this application on J2SE 1.4, you need to change the line mbs = ManagementFactory.getPlatformMBeanServer();
    to mbs = MBeanServerFactory.createMBeanServer("SimpleAgent");
  3. Compile all the .java files (Code Samples 1, 2, and 5). Make sure you include the jmxtools.jar in your classpath.
  4. Run SimpleAgent. Make sure you include the jmxtools.jar in your classpath. SimpleAgent will run as a server.
  5. Connect to the JMX agent by entering the URL http://localhost:8000 in your web browser.
    Once connected to the JMX agent, the HTML adaptor provides three views:
  • Agent view: Provides a summary of the MBeans contained within the agent. You can filter the MBean list to provide refined views.


Figure 6: HTML adaptor agent view

  • MBean view: Provides details about a specific MBean. Here you can set and get MBean attributes and invoke methods as shown in Figure 7.


    Figure 7: HTML adaptor MBean view

  • Admin view: Allows you to register new MBeans on the agent as shown in Figure 8.


    Figure 8: HTML admin view

    JMX Technology Related Specifications
     

    The various JSRs that related to the JMX specification follow:

    Summary
     

    JMX technology provides a component-based architecture for developing solutions to monitor and manage your applications, services, and resources. JMX technology is the way to instrument any application or service that was built using Java technology. Hence, the Java platform now provides excellent facilities for creating and managing applications and services. JMX technology should be used for any application and service that benefit from being manageable, as this will increase their value to vendors and clients, by making them easier to install, configure, and maintain. The current version of JMX is 1.2, and the JMX 2.0 update was launched in September 2004. It will update the JMX and JMX Remote APIs to improve existing interfaces, mainly with respect to ease of use.

    This article provided a fast track introduction and tutorial to the JMX architcture and its programming model. The sample code provided demonstrates how easy it is to get started developing management and monitoring solutions using JMX technology. The J2SE 5.0 implements the JMX specification—if you use J2SE 5.0, you are ready to start developing using JMX technology.

    Related Information
     
    Acknowledgments
     

    Special thanks to Mandy Chung and Eamonn McManus of Sun Microsystems, whose feedback helped me improve this article.

     

    Note: The terms Java Virtual Machine and JVM mean a Virtual Machine for the Java platform.

    <FORM name="form" onsubmit="return onRateSubmitHandler()" action=https://www2.sun.de/dc/servlets/incoming method=post target=rr><INPUT type="hidden" value="1" name="errcount"> <INPUT type="hidden" value="http://www2.sun.de/dc/forms/reg_xh_2610_243.jsp" name="ref"> <INPUT type="hidden" name="">
    Rate and Review
    Tell us what you think of the content of this page.
    <INPUT type="radio" value="Excellent" name="custom_3"> Excellent   <INPUT type="radio" value="Good" name="custom_3"> Good   <INPUT type="radio" value="Fair" name="custom_3"> Fair   <INPUT type="radio" value="Poor" name="custom_3"> Poor  
    Comments:
    <TEXTAREA name="custom_2" rows="3" wrap="virtual" cols="60"></TEXTAREA>
    Your email address (no reply is possible without an address):
    Sun Privacy Policy
    <INPUT maxLength="60" size="35" name="custom_1">
    Note: We are not able to respond to all submitted comments.
    <INPUT class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" type=submit value=" Submit » " border=0> <INPUT type="hidden" value="Qusay H. Mahmoud" name=custom_0> <INPUT type="hidden" value="Getting Started with Java Management Extensions (JMX): Developing Management and Monitoring Solutions" name=custom_4> <INPUT type="hidden" value="http://java.sun.com/developer/technicalArticles/J2SE/jmx.html" name="custom_5"> <INPUT type="hidden" value="Rate and Review - article feedback" name=cf_Form_Name> <INPUT type="hidden" value="Registrations" name="cf_Form_Location"> <INPUT type="hidden" value="XH" name="cf_iso2"> <INPUT type="hidden" value="ISO-8859-1" name="charset">
    </FORM>


  • Posted by '김용환'
    ,

    mysql

    DB 2007. 11. 9. 21:04

    mysqladmin variables -uroot -p

     

    mysqladmin status extended-status -uroot -p

     

    mysqladmin -i3 processlist -uroot -p

     

    Aborted_clients : 클라이언트에서 연결을 적절하게 닫지 못하고 죽어서 취소된 연결 횟수
    Aborted_connects : 연결 시도 실패 횟수
    Connections : mysql 서버에 연결 시도한 횟수
    Key_blocks_used : 키 캐쉬에서 사용된 블락 횟수
    Key_read_requests : 캐쉬에서 키 블락을 읽어들인 요청 횟수
    Key_reads : 디스크에서 물리적으로 키 블락을 읽어들인 횟수
    Max_used_connections : 최대 동시 접속자수
    Open_tables : 현재 열린 테이블 숫자
    Open_files : 현재 연 파일 숫자
    Opened_tables : 열었던 테이블 숫자
    Select_full_join : 인덱스를 사용하지 않은 조인
    Questions : 서버로 보낸 질의 횟수
    Slow_queries : long_query_time 이상 넘어간 질의 횟수
    Sort_merge_passes : 정렬을 위해 병합한 숫자
    Table_locks_waited : 테이블 락을 위해 대기한 시간

     

     

    Uptime: 6770803  Threads: 250  Questions: 105616370  Slow queries: 1538  Opens: 1762  Flush tables: 1  Open tables: 82  Queries per second avg: 15.599
    +--------------------------+------------+
    | Variable_name            | Value      |
    +--------------------------+------------+
    | Aborted_clients          | 1491446    |
    | Aborted_connects         | 154        |
    | Binlog_cache_disk_use    | 0          |
    | Binlog_cache_use         | 0          |
    | Bytes_received           | 2002528374 |
    | Bytes_sent               | 55227217   |
    | Com_admin_commands       | 22569      |
    | Com_alter_db             | 0          |
    | Com_alter_table          | 156        |
    | Com_analyze              | 0          |
    | Com_backup_table         | 0          |
    | Com_begin                | 0          |
    | Com_change_db            | 567044     |
    | Com_change_master        | 0          |
    | Com_check                | 3          |
    | Com_checksum             | 0          |
    | Com_commit               | 28090017   |
    | Com_create_db            | 0          |
    | Com_create_function      | 0          |
    | Com_create_index         | 0          |
    | Com_create_table         | 156        |
    | Com_dealloc_sql          | 0          |
    | Com_delete               | 3558965    |
    | Com_delete_multi         | 0          |
    | Com_do                   | 0          |
    | Com_drop_db              | 0          |
    | Com_drop_function        | 0          |
    | Com_drop_index           | 0          |
    | Com_drop_table           | 156        |
    | Com_drop_user            | 0          |
    | Com_execute_sql          | 0          |
    | Com_flush                | 0          |
    | Com_grant                | 0          |
    | Com_ha_close             | 0          |
    | Com_ha_open              | 0          |
    | Com_ha_read              | 0          |
    | Com_help                 | 0          |
    | Com_insert               | 26744030   |
    | Com_insert_select        | 312        |
    | Com_kill                 | 0          |
    | Com_load                 | 0          |
    | Com_load_master_data     | 0          |
    | Com_load_master_table    | 0          |
    | Com_lock_tables          | 158        |
    | Com_optimize             | 0          |
    | Com_preload_keys         | 0          |
    | Com_prepare_sql          | 0          |
    | Com_purge                | 33         |
    | Com_purge_before_date    | 0          |
    | Com_rename_table         | 0          |
    | Com_repair               | 0          |
    | Com_replace              | 0          |
    | Com_replace_select       | 0          |
    | Com_reset                | 0          |
    | Com_restore_table        | 0          |
    | Com_revoke               | 0          |
    | Com_revoke_all           | 0          |
    | Com_rollback             | 5262306    |
    | Com_savepoint            | 0          |
    | Com_select               | 14570453   |
    | Com_set_option           | 17998640   |
    | Com_show_binlog_events   | 0          |
    | Com_show_binlogs         | 122        |
    | Com_show_charsets        | 0          |
    | Com_show_collations      | 746165     |
    | Com_show_column_types    | 0          |
    | Com_show_create_db       | 158        |
    | Com_show_create_table    | 4035       |
    | Com_show_databases       | 24         |
    | Com_show_errors          | 0          |
    | Com_show_fields          | 4278       |
    | Com_show_grants          | 0          |
    | Com_show_innodb_status   | 734        |
    | Com_show_keys            | 0          |
    | Com_show_logs            | 0          |
    | Com_show_master_status   | 0          |
    | Com_show_new_master      | 0          |
    | Com_show_open_tables     | 0          |
    | Com_show_privileges      | 0          |
    | Com_show_processlist     | 15         |
    | Com_show_slave_hosts     | 0          |
    | Com_show_slave_status    | 0          |
    | Com_show_status          | 45888      |
    | Com_show_storage_engines | 0          |
    | Com_show_tables          | 223        |
    | Com_show_variables       | 768747     |
    | Com_show_warnings        | 791        |
    | Com_slave_start          | 0          |
    | Com_slave_stop           | 0          |
    | Com_truncate             | 1          |
    | Com_unlock_tables        | 158        |
    | Com_update               | 3459497    |
    | Com_update_multi         | 0          |
    | Connections              | 836958     |
    | Created_tmp_disk_tables  | 7110       |
    | Created_tmp_files        | 373        |
    | Created_tmp_tables       | 56034      |
    | Delayed_errors           | 0          |
    | Delayed_insert_threads   | 0          |
    | Delayed_writes           | 0          |
    | Flush_commands           | 1          |
    | Handler_commit           | 158        |
    | Handler_delete           | 2793309    |
    | Handler_discover         | 0          |
    | Handler_read_first       | 938        |
    | Handler_read_key         | 15018787   |
    | Handler_read_next        | 102283727  |
    | Handler_read_prev        | 14941879   |
    | Handler_read_rnd         | 13161303   |
    | Handler_read_rnd_next    | 1375783201 |
    | Handler_rollback         | 91         |
    | Handler_update           | 13545343   |
    | Handler_write            | 36151275   |
    | Key_blocks_not_flushed   | 0          |
    | Key_blocks_unused        | 90983      |
    | Key_blocks_used          | 348900     |
    | Key_read_requests        | 710311501  |
    | Key_reads                | 4751132    |
    | Key_write_requests       | 171022496  |
    | Key_writes               | 160786547  |
    | Max_used_connections     | 1519       |
    | Not_flushed_delayed_rows | 0          |
    | Open_files               | 139        |
    | Open_streams             | 0          |
    | Open_tables              | 82         |
    | Opened_tables            | 1762       |
    | Qcache_free_blocks       | 421        |
    | Qcache_free_memory       | 22463472   |
    | Qcache_hits              | 3592193    |
    | Qcache_inserts           | 5013407    |
    | Qcache_lowmem_prunes     | 0          |
    | Qcache_not_cached        | 9584148    |
    | Qcache_queries_in_cache  | 2532       |
    | Qcache_total_blocks      | 5653       |
    | Questions                | 105616370  |
    | Rpl_status               | NULL       |
    | Select_full_join         | 0          |
    | Select_full_range_join   | 0          |
    | Select_range             | 22517      |
    | Select_range_check       | 0          |
    | Select_scan              | 3016542    |
    | Slave_open_temp_tables   | 0          |
    | Slave_running            | OFF        |
    | Slow_launch_threads      | 0          |
    | Slow_queries             | 1538       |
    | Sort_merge_passes        | 203        |
    | Sort_range               | 1523       |
    | Sort_rows                | 3865615    |
    | Sort_scan                | 56011      |
    | Table_locks_immediate    | 42239400   |
    | Table_locks_waited       | 1071912    |
    | Threads_cached           | 0          |
    | Threads_connected        | 250        |
    | Threads_created          | 270157     |
    | Threads_running          | 1          |
    | Uptime                   | 6770803    |
    +--------------------------+------------+

     

     

    +---------------------------------+----------------------------------------+
    | Variable_name                   | Value                                  |
    +---------------------------------+----------------------------------------+
    | back_log                        | 50                                     |
    | basedir                         | /usr/local/mysql/                      |
    | binlog_cache_size               | 32768                                  |
    | bulk_insert_buffer_size         | 8388608                                |
    | character_set_client            | euckr                                  |
    | character_set_connection        | euckr                                  |
    | character_set_database          | euckr                                  |
    | character_set_results           | euckr                                  |
    | character_set_server            | euckr                                  |
    | character_set_system            | utf8                                   |
    | character_sets_dir              | /usr/local/mysql/share/mysql/charsets/ |
    | collation_connection            | euckr_korean_ci                        |
    | collation_database              | euckr_korean_ci                        |
    | collation_server                | euckr_korean_ci                        |
    | concurrent_insert               | ON                                     |
    | connect_timeout                 | 5                                      |
    | datadir                         | /usr/local/mysql/var/                  |
    | date_format                     | %Y-%m-%d                               |
    | datetime_format                 | %Y-%m-%d %H:%i:%s                      |
    | default_week_format             | 0                                      |
    | delay_key_write                 | ON                                     |
    | delayed_insert_limit            | 100                                    |
    | delayed_insert_timeout          | 300                                    |
    | delayed_queue_size              | 1000                                   |
    | expire_logs_days                | 0                                      |
    | flush                           | OFF                                    |
    | flush_time                      | 0                                      |
    | ft_boolean_syntax               | + -><()~*:""&|                         |
    | ft_max_word_len                 | 84                                     |
    | ft_min_word_len                 | 4                                      |
    | ft_query_expansion_limit        | 20                                     |
    | ft_stopword_file                | (built-in)                             |
    | group_concat_max_len            | 1024                                   |
    | have_archive                    | NO                                     |
    | have_bdb                        | NO                                     |
    | have_compress                   | YES                                    |
    | have_crypt                      | YES                                    |
    | have_csv                        | NO                                     |
    | have_example_engine             | NO                                     |
    | have_geometry                   | YES                                    |
    | have_innodb                     | YES                                    |
    | have_isam                       | NO                                     |
    | have_ndbcluster                 | NO                                     |
    | have_openssl                    | NO                                     |
    | have_query_cache                | YES                                    |
    | have_raid                       | NO                                     |
    | have_rtree_keys                 | YES                                    |
    | have_symlink                    | YES                                    |
    | init_connect                    |                                        |
    | init_file                       |                                        |
    | init_slave                      |                                        |
    | innodb_additional_mem_pool_size | 1048576                                |
    | innodb_autoextend_increment     | 8                                      |
    | innodb_buffer_pool_awe_mem_mb   | 0                                      |
    | innodb_buffer_pool_size         | 8388608                                |
    | innodb_data_file_path           | ibdata1:10M:autoextend                 |
    | innodb_data_home_dir            |                                        |
    | innodb_fast_shutdown            | ON                                     |
    | innodb_file_io_threads          | 4                                      |
    | innodb_file_per_table           | OFF                                    |
    | innodb_flush_log_at_trx_commit  | 1                                      |
    | innodb_flush_method             |                                        |
    | innodb_force_recovery           | 0                                      |
    | innodb_lock_wait_timeout        | 50                                     |
    | innodb_locks_unsafe_for_binlog  | OFF                                    |
    | innodb_log_arch_dir             |                                        |
    | innodb_log_archive              | OFF                                    |
    | innodb_log_buffer_size          | 1048576                                |
    | innodb_log_file_size            | 5242880                                |
    | innodb_log_files_in_group       | 2                                      |
    | innodb_log_group_home_dir       | ./                                     |
    | innodb_max_dirty_pages_pct      | 90                                     |
    | innodb_max_purge_lag            | 0                                      |
    | innodb_mirrored_log_groups      | 1                                      |
    | innodb_open_files               | 300                                    |
    | innodb_table_locks              | ON                                     |
    | innodb_thread_concurrency       | 8                                      |
    | interactive_timeout             | 1800000                                |
    | join_buffer_size                | 131072                                 |
    | key_buffer_size                 | 402653184                              |
    | key_cache_age_threshold         | 300                                    |
    | key_cache_block_size            | 1024                                   |
    | key_cache_division_limit        | 100                                    |
    | language                        | /usr/local/mysql/share/mysql/english/  |
    | large_files_support             | ON                                     |
    | license                         | GPL                                    |
    | local_infile                    | ON                                     |
    | locked_in_memory                | OFF                                    |
    | log                             | OFF                                    |
    | log_bin                         | ON                                     |
    | log_error                       |                                        |
    | log_slave_updates               | OFF                                    |
    | log_slow_queries                | ON                                     |
    | log_update                      | OFF                                    |
    | log_warnings                    | 1                                      |
    | long_query_time                 | 3                                      |
    | low_priority_updates            | OFF                                    |
    | lower_case_file_system          | OFF                                    |
    | lower_case_table_names          | 0                                      |
    | max_allowed_packet              | 10484736                               |
    | max_binlog_cache_size           | 4294967295                             |
    | max_binlog_size                 | 1073741824                             |
    | max_connect_errors              | 99999999                               |
    | max_connections                 | 2000                                   |
    | max_delayed_threads             | 20                                     |
    | max_error_count                 | 64                                     |
    | max_heap_table_size             | 16777216                               |
    | max_insert_delayed_threads      | 20                                     |
    | max_join_size                   | 4294967295                             |
    | max_length_for_sort_data        | 1024                                   |
    | max_relay_log_size              | 0                                      |
    | max_seeks_for_key               | 4294967295                             |
    | max_sort_length                 | 1024                                   |
    | max_tmp_tables                  | 32                                     |
    | max_user_connections            | 0                                      |
    | max_write_lock_count            | 4294967295                             |
    | myisam_data_pointer_size        | 4                                      |
    | myisam_max_extra_sort_file_size | 2147483648                             |
    | myisam_max_sort_file_size       | 2147483647                             |
    | myisam_recover_options          | OFF                                    |
    | myisam_repair_threads           | 1                                      |
    | myisam_sort_buffer_size         | 67108864                               |
    | net_buffer_length               | 16384                                  |
    | net_read_timeout                | 30                                     |
    | net_retry_count                 | 10                                     |
    | net_write_timeout               | 60                                     |
    | new                             | OFF                                    |
    | old_passwords                   | OFF                                    |
    | open_files_limit                | 16000                                  |
    | pid_file                        | /usr/local/mysql/var/ssss.pid        |
    | port                            | 3306                                   |
    | preload_buffer_size             | 32768                                  |
    | protocol_version                | 10                                     |
    | query_alloc_block_size          | 8192                                   |
    | query_cache_limit               | 1048576                                |
    | query_cache_min_res_unit        | 4096                                   |
    | query_cache_size                | 33554432                               |
    | query_cache_type                | ON                                     |
    | query_cache_wlock_invalidate    | OFF                                    |
    | query_prealloc_size             | 8192                                   |
    | range_alloc_block_size          | 2048                                   |
    | read_buffer_size                | 258048                                 |
    | read_only                       | OFF                                    |
    | read_rnd_buffer_size            | 262144                                 |
    | relay_log_purge                 | ON                                     |
    | rpl_recovery_rank               | 0                                      |
    | secure_auth                     | OFF                                    |
    | server_id                       | 1                                      |
    | skip_external_locking           | ON                                     |
    | skip_networking                 | OFF                                    |
    | skip_show_database              | OFF                                    |
    | slave_net_timeout               | 3600                                   |
    | slow_launch_time                | 2                                      |
    | socket                          | /tmp/mysql.sock                        |
    | sort_buffer_size                | 262136                                 |
    | sql_mode                        |                                        |
    | storage_engine                  | MyISAM                                 |
    | sync_binlog                     | 0                                      |
    | sync_replication                | 0                                      |
    | sync_replication_slave_id       | 0                                      |
    | sync_replication_timeout        | 0                                      |
    | sync_frm                        | ON                                     |
    | system_time_zone                | KST                                    |
    | table_cache                     | 512                                    |
    | table_type                      | MyISAM                                 |
    | thread_cache_size               | 8                                      |
    | thread_stack                    | 196608                                 |
    | time_format                     | %H:%i:%s                               |
    | time_zone                       | SYSTEM                                 |
    | tmp_table_size                  | 33554432                               |
    | tmpdir                          |                                        |
    | transaction_alloc_block_size    | 8192                                   |
    | transaction_prealloc_size       | 4096                                   |
    | tx_isolation                    | REPEATABLE-READ                        |
    | version                         | 4.1.10-log                             |
    | version_comment                 | Source distribution                    |
    | version_compile_machine         | i686                                   |
    | version_compile_os              | pc-linux-gnu                           |
    | wait_timeout                    | 1800000                                |
    +---------------------------------+----------------------------------------+

    'DB' 카테고리의 다른 글

    오라클 테이블 내용 복구하기  (0) 2008.02.18
    mysql 에서 root 암호 잃어버렸을 때  (0) 2007.12.31
    mysql 로그가 차면??  (0) 2007.10.20
    mysql에서 버젼보기  (0) 2007.10.19
    ERR=12505 에러  (1) 2007.10.11
    Posted by '김용환'
    ,

     

     출처

    http://kin.naver.com/db/detail.php?d1id=1&dir_id=10701&eid=fX28CLSRytz4Xh9sE09GgdkGqTzRQe3E&qb=wMwgxNzF2cauuKYgIHdtdg==

     

     

    동영상 파일 확장자를 바꾸려고 하는데요...

    나도 평가하기 40

    sujin9502

    조회1,329 답변1

    답변이 완료된 질문입니다. (2007-04-08 17:00 작성)

    신고

    핸드폰으로 동영상을 찍었는데 컴퓨터로 확인하니까

     

     

     

    GOM미디어 플레이어 확장자(d3g)로 되어있는 거에요.

     

     

     

    네이버 카페에 올릴려면 이 확장자가 아니라

     

    AVI, MOV,WMV,MPG 확장자를 가진 파일만 된다고 하더라고요

     

     

     

    그래서 바꿔보려고 WMI(윈도우즈 미디어 인코더)를 사용해봤거든요?

     

     

     

    지식인에 나와있는 것처럼

     

     

    새 세션=>파일 변환=>파일 선택=>콘텐트 배포(웹서버)=>인코딩 옵션(VHS 화질 비디오)=>

     

    정보 표시(막 썼습니다.) 해서 인코딩을 해보려고 해도

     

     

     

    '이 콘텐츠를 여는 데 필요한 하나 이상의 코덱을 찾을 수 없습니다.(0xC00D1B83)'

     

     

     

    라고 떠요.

     

     

     

     

    어떻게 하면 좋을까요?

     

     

    방법 좀 올려주세요;ㅁ;

     

     

     

    re: 동영상 파일 확장자를 바꾸려고 하는데요...

    hahaj1 (2007-04-10 21:11 작성)

    신고|이의제기

    질문자 평
    감사합니다. 'ㅂ')

    휴대폰에서 촬영한 동영상의 종류를 우선 확인할 필요가 있을 것 같습니다. 국내의 경우 *.k3g. *.skm, *.mp4 등을 사용하고 있는 것으로 알고 있는데, 이들 모두 MPEG-4 Video 형식인 것으로 압니다. 질문하신 분께서는 d3g가 확실한가요? 아니면 k3g를 잘 못 기재하신 것인가요? 전자라면, 처음보는 파일 형식입니다.

    그리고 GOM 미디어 플레이어 확장자로 나오는 것은, 단순히 질문하신 분의 컴퓨터에 곰 플레이어가 기본 동영상 재생기로 지정되어 있기 때문입니다.

     

    만약 질문하신 분의 파일 형식이 k3g가 확실하다면, 윈도우 미디어 인코더에서 원하는 파일 형식으로 변환을 하기 위해서는 코덱이 필수적입니다. 즉 MPEG-4를 지원하는 코덱이 있어야 합니다.

    그런데 코덱을 개별적으로 설치하면 번거로움이 매우 많습니다. 그래서 여러 코덱을 통합한 코덱팩이 있습니다. 대표적으로 국내에서 제작된 것으로는 Unified Codec Pack이 있고, 외국 제작 프로그램으로는 K-Lite Codec Pack이 유명합니다. 전자의 경우 설치할 때 불필요한 것이 설치될 수 있으므로 약간 주의해서 설치하시구요, 후자의 경우 외국산이기는 하나 안정적인 것으로 알려져 있습니다.

     

    ⒜ Unified Codec Pack : http://codec.lil.tohttp://codec.ohpy.com
    ⒝ K-Lite Codec Pack : http://www.codecguide.com

     

    통합코덱 설치시에 주의할 점은, 이전에 개별적으로 다른 코덱을 설치하셨다면 모두 깨끗이 삭제한 후에 설치해야 충돌이 발생하지 않습니다.

     

    코덱이 정상적으로 설치되었다면, 윈도우 미디어 인코더에서 WMV로 변환하여, 네이버 블로그 등에 올릴수 있습니다. 윈도우 미디어 인코더 외에는, 곰인코더로도 WMV 파일로 쉽게 변환할 수 있습니다.

    http://club.ipop.co.kr/gomencoder

     

    곰인코더의 장점은 무료이고 사용하기 쉽다는 것이지만, 단점으로는 베타 버전이어서 로고가 10초 정도 삽입되고, 아이팝 회원 인증으로 거쳐야 하는 등 번거로움이 있습니다.

     

    Posted by '김용환'
    ,

     

     

    출처 : http://cafe.naver.com/ArticleRead.nhn?articleid=100&sc=e0d5351d01452b9a12&clubid=11678574

     

    netstat의 State 필드에 표시되는 TCP 상태표시가 갖는 의미.
    RFC 793 문서에 있는 TCP 기본 연결, 종료 과정 참고.
     
    -----------------------------------------------------------

    # netstat -atn
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address     Foreign Address    State
    ... 생략 ...
    tcp  0  0 0.0.0.0:25       0.0.0.0:*       LISTEN   <-- 포트가 열렸음
    tcp  0  0 192.168.123.10:32799  207.46.106.141:1863  ESTABLISHED <-- 서로 연결중
    tcp  0  0 192.168.123.10:32794  218.xxx.xx.xx:22   ESTABLISHED
    tcp  0  0 192.168.123.10:32802  207.46.108.46:1863  CLOSE_WAIT <-- 종료 대기중
    tcp  0  0 192.168.123.10:33244  211.xxx.xx.x:80    ESTABLISHED
    ... 생략 ...
    -----------------------------------------------------------
     
    1) TCP 연결관련 상태
     
    * RFC 793문서에 나온 기본적인 TCP 연결 과정

       TCP A                           TCP B

     1. CLOSED                          LISTEN
     2. SYN-SENT  --> < SEQ=100>< CTL=SYN>         --> SYN-RECEIVED
     3. ESTABLISHED <-- < SEQ=300>< ACK=101>< CTL=SYN,ACK> <-- SYN-RECEIVED
     4. ESTABLISHED --> < SEQ=101>< ACK=301>< CTL=ACK>    --> ESTABLISHED
     5. ESTABLISHED --> < SEQ=101>< ACK=301>< CTL=ACK>< DATA> --> ESTABLISHED

    LISTEN   : 데몬이 요청을 발을 수 있도록 연결 요구를 기다리는 상태
     즉, 포트가 열려있음을 의미. http(80), mail(25), ftp(21), telnet(23) 등
     위에서 포트 25(mail)이 메일을 받을 수 있도록 열려 있는 상태
     윈도우즈에서는 LISTENING으로 표시
    SYN_SENT  : 로컬에서 원격으로 연결 요청(SYN 신호를 보냄)을 시도한 상태
    SYN_RECV  : 원격으로 부터 연결 요청을 받은 상태
     요청을 받아 SYN+ACK 신호로 응답은 한 상태이지만 ACK는 받지 못했다.
     netstat로 확인할 때 SYN_RECV가 상당히 많다면 TCP SYN 플러딩(Flooding) 공격일
     가능성이 있다.
     윈도우즈와 솔라리스에서는 SYN_RECEIVED으로, FreeBSD는 SYN_RCVD으로 표시
    ESTABLISHED : 서로 연결이 되어 있는 상태
     위에서 192.168.123.10의 포트 32794과 218.xxx.xx.xx의 포트 22(ssh)이 서로
     연결되어 있는 상태

    2) TCP 종료관련 상태

    * 정상적인 연결 종료 과정

       TCP A                          TCP B

     1. ESTABLISHED                       ESTABLISHED
     2. (Close)
       FIN-WAIT-1 --> < SEQ=100>< ACK=300>< CTL=FIN,ACK> --> CLOSE-WAIT
     3. FIN-WAIT-2 <-- < SEQ=300>< ACK=101>< CTL=ACK>   <-- CLOSE-WAIT
     4.                    (Close)
       TIME-WAIT  <-- < SEQ=300>< ACK=101>< CTL=FIN,ACK> <-- LAST-ACK
     5. TIME-WAIT  --> < SEQ=101>< ACK=301>< CTL=ACK>   --> CLOSED
     6. (2 MSL)
       CLOSED                           

    FIN_WAIT1  : 소켓이 닫히고 연결이 종료되고 있는 상태. 원격의 응답은 받을 수 있다.
     솔라리스에서는 FIN_WAIT_1로 표시
    FIN_WAIT2  : 로컬이 원격으로 부터 연결 종료 요구를 기다리는 상태
     솔라리스에서는 FIN_WAIT_2로 표시
    CLOSE_WAIT : 원격의 연결 요청을 받고 연결이 종료되기를 기다리는 상태
     원격으로 부터 FIN+ACK 신호를 받고 ACK 신호를 원격에 보냈다.
    TIME_WAIT  : 연결은 종료되었으나 원격의 수신 보장을 위해 기다리고 있는 상태
     이 상태를 특히 자주 보게되는 Apache에서 KeepAlive를 OFF로 해둔 경우,
     Tomcat 서버를 쓰는 경우 등
    LAST_ACK  : 연결은 종료되었고 승인을 기다리는 상태
    CLOSED   : 완전히 연결이 종료된 상태

    ※ 위의 FIN_WAIT1, FIN_WAIT2, CLOSE_WAIT 3개 상태는 연결 종료를 위해 서로간에
      신호를 주고받는 과정에 나타나는 상태로 이해하면 된다.
      종료 요청을 한 곳에서는 FIN_WAIT1, FIN_WAIT2, TIME_WAIT 상태가
      종료 요청을 받는 곳에서는 CLOSE_WAIT, LAST_ACK 상태가 표시된다.

    3) 기타

    CLOSING   : 연결은 종료되었으나 전송도중 데이타가 분실된 상태
    UNKNOWN   : 소켓의 상태를 알 수 없음

    솔라리스의 netstat 명령에서는 다음 2개의 상태를 더 표시한다.

    IDLE    : 소켓이 열렸지만 binding 되지 않은 상태
    BOUND    : listen이나 연결을 위한 준비 상태

     

    추가) Time-Wait

    먼저 종료를 시킨경우는 Time-Wait 과정을 거치게 된다

    종료요청을 하게되변 FIN 을 전송하게 되며

     

    Time-Wait 상태

    ** A가 먼저 종료하는 경우

    < four-way handshaking >

       A                                  B

     FIN  ------------------>

           <-----------------   ACK

           <-----------------   FIN

    ACK  ------------------>

    Time-Wait                      소켓소멸

          ~

    소켓소멸

     

     

    결론> 발생이유: 마지막 ACK가 소멸 되었을 경우 재전송을 하기 위함

             따라서 재시작시 Bind 에러가 발생하며 이는 적정시간이 흐르면 해제가 된다

            이때 접속되어있는 클라이언트가 패킷을 송신을 하면 Time-Wait 상태를 유지하는 타이머는 재시작된다

           이는 Time-Wait상태가 길어질 수 있는 결과를 초래한다

    해결방안 : 소켓옵션중 SO_REUSEADDR의 상태를 1(TRUE)로 설정한다

                    물론, 접속자가 없는 상태에선 Fin메세지를 시작으로 four-way handshaking 과정을 거치지 않는다

     

     

    ===========================================

     

    LISTEN : 서버의 데몬이 떠서 접속 요청을 기다리는 상태

    SYS-SENT : 로컬의 클라이언트 애플리케이션이 원격 호스트에 연결을 요청한 상태

    SYS-RECEIVED : 서버가 클라이언트로 부터 접속 요구를 받아 클라이언트에게 응답을 했지만 아직 클라이언트에게 확인 메세지는 받지 않은 상태

    ESTALISHED : 3Way Handshaking 완료된후 서로 연결된 상태

    FIN-WAIT, CLOSE-WAIT, FIN-WAIT2 : 서버에서 연결을 종료하기 위해 클라이언트에게 종결을 요청하고 회신을 받아 종료하는 과정의 상태

    CLOSING : 흔하지 않지만 주로 확인 메세지가 존송 도중 분실된 상태

    TIME-WAIT : 연결은 종료 되었지만 분실되었을지 모를 느린 세그먼트를 위해 당분간 소켓을 열어 놓은 상태

    CLOSED : 완전히 종료

    'unix and linux' 카테고리의 다른 글

    bash if 문 비교  (0) 2007.11.30
    [bash] 로깅 시간 출력  (0) 2007.11.14
    grep -c 와 wc -l은 똑같은 명령어이다.  (0) 2007.10.18
    crond 문제  (0) 2007.10.17
    bash 배열 선언 및 처리하기  (0) 2007.10.16
    Posted by '김용환'
    ,