Application Server: Thread Pool

From Resin 4.0 Wiki

(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{WebServer}}
 
{{WebServer}}
  
The Resin application server thread pool is generally self-adjusting to the application load.
+
The Resin application server thread pool is generally self-adjusting to the application load. With
 +
a modern 64-bit operating system, you can generally set the thread-max to its maximum value.
 +
 
 +
= resin.xml configuration =
 +
 
 +
The resin.xml configuration file has a <thread-max>, <thread-idle-min> and <thread-idle-max> configuration.
 +
 
 +
* thread-max is the maximum threads allowed for the pool (should be large like 8192 or unset)
 +
* thread-idle-min is the minimum number of idle threads (can be increased for spiky services)
 +
* thread-idle-max is the maximum number of idle threads
 +
 
 +
= ScheduledExecutorService for @Inject =
 +
 
 +
The Resin thread pool is available to applications as a Dependency Injected ScheduledExecutorService.
 +
 
 +
Your application can use the thread pool by injecting the executor service.
 +
 
 +
public class MyBean {
 +
  @Inject
 +
  private ScheduledExecutorService _executor;
 +
 
 +
  void myMethod()
 +
  {
 +
    _executor.schedule(runnable);
 +
  }
 +
}

Latest revision as of 00:00, 29 February 2012

Web-48.png

The Resin application server thread pool is generally self-adjusting to the application load. With a modern 64-bit operating system, you can generally set the thread-max to its maximum value.

resin.xml configuration

The resin.xml configuration file has a <thread-max>, <thread-idle-min> and <thread-idle-max> configuration.

  • thread-max is the maximum threads allowed for the pool (should be large like 8192 or unset)
  • thread-idle-min is the minimum number of idle threads (can be increased for spiky services)
  • thread-idle-max is the maximum number of idle threads

ScheduledExecutorService for @Inject

The Resin thread pool is available to applications as a Dependency Injected ScheduledExecutorService.

Your application can use the thread pool by injecting the executor service.

public class MyBean {
  @Inject
  private ScheduledExecutorService _executor;
 
  void myMethod()
  {
    _executor.schedule(runnable);
  }
}
Personal tools
TOOLBOX
LANGUAGES