실행 자원 할당

자원 할당 정책 관리자를 통해 시나리오 스위트를 실행하는 데 필요한 스레드의 할당을 관리합니다. WebSphere® Application Server에서, 스레드의 작성은 작업 관리자에 위임됩니다.

실행 요청이 Decision Center에서 SSP(Scenario Service Provider)로 전송될 때마다, SSP는 시나리오 스위츠를 실행하는 데 사용할 스레드의 우선순위와 시뮬레이션의 병렬 실행에 할당할 최대 스레드 수를 결정해야 합니다. WebSphere Application Server에서, 스레드의 우선순위는 사용할 작업 관리자에 따라 결정됩니다.

기본 시나리오 스위트 자원 할당 정책 관리자의 동작은 다음과 같습니다.

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 우선순위 시나리오 스위트가 큐에 추가되면 우선순위가 낮은 기타 모든 시나리오 스위트에 비해 큐의 앞 쪽에 추가됩니다.