실행 자원 할당
자원 할당 정책 관리자를 통해 시나리오 스위트를 실행하는 데 필요한 스레드의 할당을 관리합니다. WebSphere® Application Server에서, 스레드의 작성은 작업 관리자에 위임됩니다.
실행 요청이 Decision Center에서 SSP(Scenario Service Provider)로 전송될 때마다, SSP는 시나리오 스위츠를 실행하는 데 사용할 스레드의 우선순위와 시뮬레이션의 병렬 실행에 할당할 최대 스레드 수를 결정해야 합니다. WebSphere Application Server에서, 스레드의 우선순위는 사용할 작업 관리자에 따라 결정됩니다.
기본 시나리오 스위트 자원 할당 정책 관리자의 동작은 다음과 같습니다.
SSP에서 작성된 모든 스레드의 우선순위가 같습니다.
- SSP가 WebSphere Application Server에 배치되는 경우, 스레드가 모두 NORMAL_PRIORITY_MANAGER 작업 관리자에서 작성됩니다. 이 작업 관리자에 대한 스레드의 우선순위가 WebSphere Application Server 관리 콘솔을 통해 정의됩니다. 자세한 정보는 WebSphere Application Server의 자원 할당의 내용을 참조하십시오.
- SSP가 다른 애플리케이션 서버에 배치되거나 Java™ SE에서 실행되면, 스레드가 Thread.NORM_PRIORITY 우선순위로 작성됩니다. 자세한 정보는 Java SE 및 기타 애플리케이션 서버의 자원 할당의 내용을 참조하십시오.
참고:Linux에서 SSP를 사용하는 경우, Java 스레드 우선순위가 모두 단일 스레드 우선순위인 0 나이스 레벨로 맵핑됩니다. 즉, 스레드에 설정한 우선순위에 관계없이 모든 스레드가 동일한 우선순위로 실행됩니다.
애플리케이션 서버가 Sun JVM을 사용하는 경우, -XX:ThreadPriorityPolicy JVM 인수를 사용하여 명시적으로 우선순위를 설정할 수 있습니다. 이 인수를 성공적으로 전달하려면 루트 권한이 있어야 합니다. 자세한 정보는 JVM 문서를 참조하십시오.
WebSphere Application Server에서 사용되는 IBM® JVM은 -XX:ThreadPriorityPolicy JVM 인수를 지원하지 않습니다.
시뮬레이션의 병렬 실행에 대해 할당할 수 있는 최대 스레드 수는 SSP 아카이브의 web.xml 배치 디스크립터에서 매개변수로 정의됩니다. 다음 매개변수에서는 시뮬레이션의 각 시나리오마다 하나의 스레드를 정의합니다.
<init-param> <description>This parameter defines the maximum number of threads to allocate to one simulation if no custom scenario suite resource allocation policy manager is defined. A value of 0 or less means that the maximum number of threads that the SSP allocates is equal to the number of parts in the simulation. The value of this parameter is ignored if a custom scenario suite resources allocation policy manager is defined. </description> <param-name>MAX_NUMBER_OF_THREADS_PER_SIMULATION</param-name> <param-value>0</param-value> </init-param>Decision Center에서, 시뮬레이션의 파트가 병렬로 실행 중일 때 시나리오 스위트 파트마다 하나의 러너 인스턴스가 있습니다. 각 러너에서는 파트에 포함된 시나리오를 실행합니다. 시뮬레이션에 대해 시나리오의 수를 보고할 때 콘솔에서 총 시나리오 수를 표시합니다.
참고:각 파트의 시나리오 수는 시작할 때 러너에게만 알립니다. 따라서 러너가 동시에 시작되지 않으면 스레드 풀 또는 작업 관리자가 예제에 대해 충분한 자원을 할당할 수 없으므로 보고된 총 시나리오 수가 총계보다 작습니다. 대기 중인 러너가 시작되면 콘솔의 시나리오 수가 업데이트됩니다.
Rule Execution Server 역할을 통해 SSP 웹 애플리케이션에 로그인하면 SSP에서 실행 중인 작업을 모니터링할 수 있습니다. 자세한 정보는 Decision Validation Services의 가용성 확인을 참조하십시오.
WebSphere Application Server의 자원 할당
SSP가 WebSphere Application Server에 배치되면 스레드의 작성이 작업 관리자에 위임됩니다. 자세한 정보는 WebSphere Application Server 문서의 작업 관리자를 참조하십시오.
우선순위가 서로 스레드에 실행 요청을 디스패치하기 위해 SSP가 3개의 서로 다른 작업 관리자를 사용합니다. 각 작업 관리자는 자체 고유의 스레드 우선순위를 정의하는데, 이는 SSP 웹 애플리케이션의 web.xml 배치 디스크립터에서 참조됩니다. 그런 다음 시나리오 스위트의 우선순위는 시나리오 스위트를 실행할 수 있는 작업 관리자를 결정하는 데 사용됩니다.
SSP 서블릿에 정의된 3개의 초기화 매개변수가 있습니다.
- NORMAL_PRIORITY_MANAGER: 일반 우선순위 스레드를 실행하는 데 사용할 작업 관리자를 정의합니다.
- HIGH_PRIORITY_WORK_MANAGER: 높은 우선순위 스레드를 실행하는 데 사용할 작업 관리자를 정의합니다.
- LOW_PRIORITY_MANAGER: 낮은 우선순위 스레드를 실행하는 데 사용할 작업 관리자를 정의합니다.
3개의 작업 관리자가 배치 디스크립터에 다음과 같이 정의됩니다.
<init-param>
<description>Name of the high priority work manager to use to spawn high
priority threads in the SSP.
If this value is updated to use a dedicated work manager that
is not the default (wm/default), the resources references
section of this descriptor must be updated to make sure that
the new work manager is referenced in a resource-ref element.</description>
<param-name>HIGH_PRIORITY_WORK_MANAGER</param-name>
<param-value>wm/default</param-value>
</init-param>
<init-param>
<description>Name of the normal priority work manager to use to spawn
normal priority threads in the SSP.
If this value is updated to use a dedicated work manager that
is not the default (wm/default), the resources references
section of this descriptor must be updated to make sure that
the new work manager is referenced in a resource-ref element.</description>
<param-name>NORMAL_PRIORITY_WORK_MANAGER</param-name>
<param-value>wm/default</param-value>
</init-param>
<init-param>
<description>Name of the low priority work manager to use to spawn low
priority threads in the SSP.
If this value is updated to use a dedicated work manager that
is not the default (wm/default), the resources references
section of this descriptor must be updated to make sure that
the new work manager is referenced in a resource-ref element.</description>
<param-name>LOW_PRIORITY_WORK_MANAGER</param-name>
<param-value>wm/default</param-value>
</init-param>
<res-ref-name> 요소에서 web.xml 배치 디스크립터의 자원 참조에 정의된 대로 각 매개변수의 값은 사용할 작업 관리자의 이름입니다.
<resource-ref>
<res-ref-name>wm/default</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
기본적으로 3개의 작업 관리자 정의는 모두 WebSphere Application Server 인스턴스에 정의된 기본 작업 관리자를 참조합니다(wm/default). 모든 스레드는 이 작업 관리자에서 정의된 대로 동일한 우선순위로 실행됩니다.
사용자 정의 자원 할당 정책 관리자를 정의하는 경우에만 다른 스레드 우선순위가 지정되어 있는 여러 작업 관리자를 사용하면 유용합니다. SSP에서 작성할 수 있는 최대 스레드 수가 작업 관리자 구성에서 정의되어 있습니다. 작업 관리자는 동일한 애플리케이션 서버에 배치된 서로 다른 애플리케이션 간에 공유될 수 있습니다.
Java SE 및 기타 애플리케이션 서버의 자원 할당
기타 지원되는 Java EE 애플리케이션 서버 및 Java SE에서, 우선순위가 다른 스레드를 실행하는 데 고정된 스레드 풀 크기가 사용됩니다. 고정된 스레드 풀의 크기는 SSP 웹 애플리케이션의 web.xml 배치 디스크립터에서 JRULES_JOBS_POOL_SIZE 매개변수로 정의됩니다.
다음 예제에서 표시된 대로 풀 크기에 대한 기본값은 10입니다.
<init-param>
<description>The number of threads in the pool for asynchronous
executions (jobs)</description>
<param-name>JRULES_JOBS_POOL_SIZE</param-name>
<param-value>10</param-value>
</init-param>
Java SE에서, 풀 크기를 인수로 하는 IlrLocalSSPService 생성자를 사용해야 합니다.
스레드의 우선순위는 자원 할당 정책 관리자로 정의됩니다. 다음과 같이 3개의 우선순위 값이 있습니다.
- Thread.NORM_PRIORITY(우선순위 NORMAL)
- Thread.MAX_PIORITY(우선순위 HIGH)
- Thread.MIN_PRIORITY(우선순위 LOW)
스레드가 시작되면 우선순위에 따라 큐에 대기됩니다. 풀의 모든 스레드가 실행 중일 때, 풀의 스레드가 실행을 완료할 때까지 새 스레드 요청이 큐에 대기됩니다. 실행하려고 대기 중인 스레드에 우선순위가 지정되는데 즉, HIGH 우선순위 시나리오 스위트가 큐에 추가되면 우선순위가 낮은 기타 모든 시나리오 스위트에 비해 큐의 앞 쪽에 추가됩니다.