Skip to main content

mod_jk Thread 설정

yum install httpd httpd-devel

해서 httpd 설치


cd tomcat-connectors-1.2.35-src
./configure --with-apxs=/usr/local/apache2/bin/apxs
make install
하면 파일이 httpd의 모듈 디렉토리에 들어감

### Mod_jk : connect tomcat ####

LoadModule jk_module modules/

JkWorkerProperty worker.list=ajp13w
JkWorkerProperty worker.ajp13w.type=lb
JkWorkerProperty worker.ajp13w.balanced_workers=WAS1,WAS2
JkWorkerProperty worker.sticky_session=true

JkWorkerProperty worker.WAS1.type=ajp13
JkWorkerProperty worker.WAS1.port=8009
JkWorkerProperty worker.WAS1.socket_timeout=3
JkWorkerProperty worker.WAS1.prepost_timeout=1000
JkWorkerProperty worker.WAS1.connect_timeout=1000
JkWorkerProperty worker.WAS1.lbfactor=1

JkWorkerProperty worker.WAS2.type=ajp13
JkWorkerProperty worker.WAS2.port=8009
JkWorkerProperty worker.WAS2.socket_timeout=3
JkWorkerProperty worker.WAS2.prepost_timeout=1000
JkWorkerProperty worker.WAS2.connect_timeout=1000
JkWorkerProperty worker.WAS2.lbfactor=1

JkLogFile logs/jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
#JkMount /*.jsp ajp13w
JkMount /* ajp13w
JkMount /example/* ajp13w

JkUnMount /*.html ajp13w
JkUnMount /*.txt ajp13w
JkUnMount /*.gif ajp13w
JkUnMount /*.jpg ajp13w
#JkMount /servlet/* ajp13w

#### 아파치 MPM은 Worker 모델을 사용한다
[root@node1 httpd]# apachectl -l
Compiled in modules:

[root@node1 httpd]# httpd -V
#HTTPD=/usr/sbin/httpd.worker 주석 해제


[root@buy-0936 sysconfig]# apachectl -l
Compiled in modules:

worker.c로 동작

웹서버에서의 AJP connection 개수는 AJP connector의 maxThreads 개수보다 작아야 한다.

AJP connector는 쓰레드가 하나의 connection을 서비스하는 구조이므로, 쓰레드 개수를 넘는 connection은 받아들일 수 없다.
따라서, 웹 서버의 최대 ajp connection 개수를 maxThreads 이상 설정해서는 안된다.

그렇다면 최대 ajp connection 개수는 어떻게 설정될까?
최대 ajp connection 개수 = 최대 프로세스 개수 * connection_pool_size

  최대 프로세스 개수
    Prefork 모델: MaxClients
    Worker 모델: MaxClients / ThreadsPerChild
    NT Thread 모델: 1

  connection_pool_size 기본값
    Prefork 모델: 1
    Worker 모델: ThreadsPerChild
    NT Thread 모델: ThreadsPerChild



Popular posts from this blog

codefights smooth sailing ( CommonCharacterCount) s1, String s2) { int sum = 0; char[] as= s1.toCharArray(); char[] bs= s2.toCharArray(); int[] ias = newint[126]; int[] ibs = newint[126]; for (int i = 0; i < as.length; i++) { ias[(int)as[i]]++; } for (int i = 0; i < bs.length; i++) { ibs[(int)bs[i]]++; } for (int i = 0; i < ibs.length; i++) { sum += Math.min(ias[i], ibs[i]); } return sum; }

Given two strings, find the number of common characters between them. Example For s1 = "aabcc" and s2 = "adcaa", the output should be
commonCharacterCount(s1, s2) = 3. Strings have 3 common characters - 2 "a"s and 1 "c". Input/Output [time limit] 3000ms (java)[input] string s1 A string consisting of lowercase latin letters a-z. Guaranteed constraints:
1 ≤ s1.length ≤ 15. [input] string s2 A string consisting of lowercase latin letters a-z. Guaranteed constr…

Bucket Sort in python

I make buckets as many as size of arr
and put data.

arr = [0.897, 0.565, 0.656, 0.1234, 0.665, 0.3434] def bucketSort(arr, size): buckets = [[] for i in range(size)] # put arr in bucket for i in range(len(arr)): num = size*arr[i] buckets[int(num)].append(arr[i]) output = [] # use insertion sort for i in range(len(buckets)): insertionSort(buckets[i]) # concat all data for i in range(len(buckets)): while len(buckets[i]) > 0: output.append(buckets[i].pop(0)) return output def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def insertionSort(arr): for i in range(1, len(arr)): index= i print("index : " + str(i)) while index!=0: if arr[index] < arr[index-1]: temp = arr[index] arr[index]= arr[index-1] arr[index-1] = temp index = index-1print(arr) else …