Multiple thread pools under single executor

I would like to segregate the tasks running in an Executor so that certain tasks (perhaps identified by an annotation) could be restricted to a thread pool of a limited size while others run in a different pool.
The intend is to limit certain crunchy tasks so that they don't saturate a limited resource.
As far as I can tell I can't do this with a ThreadPoolExecutor even with a custom ThreadFactory. The original Callable is wrapped a couple of times by the time the ThreadFactory.newThread method is called so I can't inspect it at that time. Also, once the maximumPoolSize is reached the waiting tasks will get handed off to whichever thread finishes first, thus making my fixed pools useless.
I have a feeling that I will need to write my own ThreadPoolExecutor but I thought that I would ask if there was a way to do this with the existing classes first.
Thanks.

I used to do this.
The problem comes in managing the work that flows between the queues, and managing the results. I need to be able to take the output from one task and feed it into another, potentially running in a different thread pool.
Multiple queues mean waiting for more than one blocking event, which means multiple management threads with a meta-event queue feeding back to an dispatcher that does the messaging.
With multiple management threads you have to poison all of those queues so that the thing shuts down when you are done.
By the time that I'm done I may be better off just modifyingThreadPoolExecutor to do what I want. One work queue keeps the shutdown problem under control.
Thanks for the feedback.

Similar Messages

  • Query about multiple connection pools under one database

    Hi,
    I have s query about connection pool, now we have a requirement,
    we have two schemas in one db, some data store in one schema, some in another schema,
    all tables are the same, but data is different, we want to retrive all data under two schemas,
    so we need two connection pools under one database,
    I have set two system DSN, and each connection pool was mapping to one DSN,
    but after I importing tables into RPD, when I view data, there is a dialog let me select connection pool. so If this, when we drag columns in answer, it will definitely get wrong.
    so how to realize this function about multiple connection pools under one database and we can get data normally.

    Hi,
    Try this step
    1)Better to create two different DSN for the same database with different user id and password
    2)now create multiple connection pool in the same database in u r RPD physical layer .
    also refer this link : for imporving performance
    http://obiee101.blogspot.com/2009/01/obiee-multiple-connection-pools.html
    http://gerardnico.com/wiki/dat/obiee/connection_pool
    Thanks
    Deva

  • Managing Multiple threads accessing  a single instance of a class

    Hi,
    i have to redesign a class, say X, in such a way that i manage multiple threads accessing a single instance of the class, we cannot create multiple instances of X. The class looks like this:
    Class X{
    boolean isACalled=false;
    boolean isInitCalled=false;
    boolean isBCalled=false;
    A(){
    isACalled=true;
    Init(){
    if(!isACalled)
    A();
    B();
    C();
    isInitCalled=true;
    B(){
    if(!isACalled)
    A();
    isBCalled=true;
    C(){
    if(!isACalled)
    A();
    if(!isBCalled)
    B();
    }//end of class
    Init is the method that would be invoked on the single instance of this class.
    Now i cannot keep the flags as instance variables coz different threads would have differrent status of these flags at the same time, hence i can make them local, but if i make them local to one method, the others won't be able to check their status, so the only solution i can think of is to place all the flags in a hashtable local to method INIT AND INITIALIZE ALL OF them to false, as init would call other methods, it would pass the hashtable reference as an additional parameter, the methods would set the flags in the hashtable and it would be reflectecd in the original hashtable, and so all the methods can have access to the hashtable of flags and can perform their respective checks and setting of flags.
    This all would be local to one thread, so there's no question of flags of one thread mixin with the flags of some other thread.
    My question is :
    Is this the best way, would this work?
    In java, everything is pass by value, but if i pass the hashtable reference, would the changes made inside the called method to the hashtable key-value would be visible in the original hashtable declared inside the calling method of which the hashtable is local variable?

    In Java object variables are passed "by copy of reference", and primitive variables "by value".
    The solution with HashMap/Hashtable you suggest is ok, but I think you should read about ThreadLocal class:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html

  • Multiple applications on a single JVM

    I was looking at some of the disadvantages of running multiple apps on a single JVM and then I came across this sentence which I donot totally comprehend. I guess somebody here would be able to shed some light
    JVMs tend not to scale well past four processor configurations, which limits the viability of the single-JVM model on larger machines

    It means a single JVM won't take as much advantageof
    an 8 CPU system as multiple JVMs will.Yes I understand the lingual meaning of the sentence,
    what I am struggling with is its semantic meaning.
    Why can't a single JVM take advantage of 8 processor
    r CPU? Are there any limitations associated with a
    single JVM and in case there are what could they be?If I remember correctly the inherent concurrency limitations of JVM prevent it from fully utilizing the processing power of the machine. There is a limitation to the heap size one JVM can have, no. of thread pools that could be supported so multiple JVMs provide additional heap size, multiple thread pools, each corresponding to the application associated with the JVM, thus enabling to use the extra processing power.

  • Multiple connection pools in the same DB physical source

    Hi, I have this situation in BI Admin:
    A single DB with 2 physical schema and 2 Connection Pools with OCI 10/11g.
    Clicking on any table I can see the data after selecting the right connection pool for that table.
    I created a Business Model based upon tables from one of the 2 physical schemas and a corresponding presentation layer. It is consistent and I can view the related subject area in Answers, but when I select a Dimension column (CONVERGENZA_NEGOZIO.STATO) and the fact measure ( Convergenza_Fact.INCASSO ) in viewing results I get this error:
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
    SQL Issued: SELECT CONVERGENZA_NEGOZIO.STATO saw_0, Convergenza_Fact.INCASSO saw_1 FROM Convergenza ORDER BY saw_0
    Is it caused by the multiple connection pools under the same DB?

    Yes I think that's correct, but only if you're going to use the same user to connect to them.
    If you have a single user you're using to connect to a database to read data which happens to be over more than one schema, you'd use one connection pool.
    However if you have entirely separate schemas (eg. different applications) and need to use a different user for each then you would use one connection pool per schema. Also if you thought you might move one of the schemas to another physical database at some point in the future it might be prudent to use a separate connection pool from the outset.
    If you're still getting the error that the table cannot be found and your users have full permissions then logically the table that's being looked for does not exist, or you have not qualified it. What I mean by that is if you are connecting as USER2 and SELECT * FROM TABLE_A then the database will assume that you mean USER2.TABLE_A. If you mean USER1.TABLE_A then you need to make sure the qualification is in there.
    In the admin tool check your Physical layer is set up correctly with your Physical Tables residing in the correct Physical Schemas.

  • Multiple threads calling the same stored proc with different parameters

    Hi,
    I have a stored procedure which will be called by 8 threads. Every time it takes in a different parameter.
    Actual execution time for this proc (irrespective of the parameter) is around 2 seconds. But when I call the 8 threads, I see that the total time taken (END TO END) is around 16 seconds. Threads do acquire a read lock right? Is there a way i can get over this issue?
    Please let me know.

    Sybase IQ is the database. I am using a thread pool. The time taken to execute this procedure without threads is about 2 seconds. It takes 16 seconds when I start using threads.
    I do something like this :
    ///////////////////////// databaseThreadPool.java
    * example of a fixed-size thread pool using the
    * executors introduced in Java 5
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    public class databaseThreadPool
    public static void main(String[] args)
    * create a thread pool with four threads
    ExecutorService execSvc = Executors.newFixedThreadPool( 8);
    * place six tasks in the work queue for the thread pool
    for( int i = 0; i < 6; i++ )
    execSvc.execute( new CountDown() );
         long a =System.currentTimeMillis();
    execSvc.execute( new databaseThread("00055","YTD","GROSS") );
    execSvc.execute( new databaseThread("00055","YTD","NET") );
    execSvc.execute( new databaseThread("00055","YTM","GROSS") );
    execSvc.execute( new databaseThread("00055","YTM","NET") );
    execSvc.execute( new databaseThread("00055","LY","GROSS") );
    execSvc.execute( new databaseThread("00055","LY","NET") );
    execSvc.execute( new databaseThread("00055","LLY","GROSS") );
    execSvc.execute( new databaseThread("00055","LLY","NET") );
         long b =System.currentTimeMillis();
         try{
         while(databaseThread.done!=8)
              Thread.sleep(1000);
         catch(Exception ex){}
    execSvc.shutdown();
    System.out.println("END TO END TIME TAKEN : "+(b-a));
    /////////////////////////////////////////////////////////// databaseThread.java
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Statement;
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.io.IOException;
    public class databaseThread implements Runnable
    protected int count = 8;
    * the following counter is incremented once
    * each time the class is instantiated, giving each
    * instance a unique number, which is printed in run()
    private static int taskCount = 0;
    private final int id = taskCount++;
    private String gpNum;
    private String time;
    private String domain;
    public static int i=0;
    public static int done=0;
    PrintWriter out = null;
    Connection connection = null;
    Statement statement;
    ResultSet rs;
    ResultSetMetaData rsmd;
         CallableStatement cStmt = null;
    public databaseThread(String gpNum, String time, String domain) {
    this.gpNum=gpNum;
    this.time=time;
    this.domain=domain;
    * print the id and the iteration count to the console, then
    * yield to another thread.
    public void run()
         try
         Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
         connection = DriverManager.getConnection("jdbc:sybase:Tds:XXXXXXXXXXX:XXXXXXX", "cp_dbo","cp_dbo");
         statement = connection.createStatement();
              cStmt=connection.prepareCall("{call XXXXXX ?,?,?)}");
              cStmt.setString(1,gpNum);
              cStmt.setString(2, time);
              cStmt.setString(3,domain);
              long a =System.currentTimeMillis();
              rs=cStmt.executeQuery();
              long b=System.currentTimeMillis();
              System.out.println(id+" Time taken by to execute Query : "+(b-a));
         //rsmd=rs.getMetaData();
              while(rs.next())
              Thread.yield();
         catch (ClassNotFoundException e) {
              System.out.println("Driver Error" );
              e.printStackTrace();
              } catch (SQLException e) {
              System.out.println("SQLException: " + e.getMessage());
    }

  • Executors.newSingleThreadScheduledExecutor() creating multiple threads?

    While examining a stack trace this morning, I found approximately 250 idle threads labelled "pool-4-thread-###", where ### ranged from 1 to 250 or so.
    I then traced pool-4-thread to a ScheduledExecutorService and underlying ThreadPoolExecutor object created via a call to Executors.newSingleThreadScheduledExecutor().
    There are two types of tasks scheduled on that instance of the Executor. The first is a task which runs twice a day. The second type is something that gets scheduled as the result of a user action, which may occur dozens of times a day.
    Under what conditions can a SingleThreadScheduledExecutor create and leave around multiple threads?
    Thanks in advance,
    Mike Benveniste

    If the thread never completes.
    It's either hanging, or, more likely, has an exit condition that's never being met. Or it's spawning processes that are not completing.
    Simply put a debug statement at the beginning and end of the thread so you can see when (and if) it's starting and stopping.
    You may want to use object.killProcess() prior to starting the next instance to force the previous instance to stop if it still exists.
    bcf

  • A good design for a single thread pool manager using java.util.concurrent

    Hi,
    I am developing a client side project which in distinct subparts will execute some tasks in parallel.
    So, just to be logorroic, something like that:
    program\
                \--flow A\
                           \task A1
                           \task A2
                \--flow B\
                            \task B1
                            \task B2
                            \...I would like both flow A and flow B (and all their launched sub tasks) to be executed by the same thread pool, because I want to set a fixed amount of threads that my program can globally run.
    My idea would be something like:
    public class ThreadPoolManager {
        private static ExecutorService executor;
        private static final Object classLock = ThreadPoolManager.class;
         * Returns the single instance of the ExecutorService by means of
         * lazy-initialization
         * @return the single instance of ThreadPoolManager
        public static ExecutorService getExecutorService() {
            synchronized (classLock) {
                if (executor != null) {
                    return executor;
                } else {
                    // TODO: put the dimension of the FixedThreadPool in a property
                    executor = Executors.newFixedThreadPool(50);
                return executor;
         * Private constructor: deny creating a new object
        private ThreadPoolManager() {
    }The tasks I have to execute will be of type Callable, since I expect some results, so you see an ExecutorService interface above.
    The flaws with this design is that I don't prevent the use (for example) of executor.shutdownNow(), which would cause problems.
    The alternative solution I have in mind would be something like having ThreadPoolManager to be a Singleton which implements ExecutorService, implementing all the methods with Delegation to an ExecutorService object created when the ThreadPoolManager object is instantiated for the first time and returned to client:
    public class ThreadPoolManager implements ExecutorService {
        private static ThreadPoolManager pool;
        private static final Object classLock = ThreadPoolManager.class;
        private ExecutorService executor;
         * Returns the single instance of the ThreadPoolManager by means of
         * lazy-initialization
         * @return the single instance of ThreadPoolManager
        public static ExecutorService getThreadPoolManager() {
            synchronized (classLock) {
                if (pool !=null) {
                    return pool;
                } else {
                    // create the real thread pool
                    // TODO: put the dimension of the FixedThreadPool in a property
                    // file
                    pool = new ThreadPoolManager();
                    pool.executor = Executors.newFixedThreadPool(50);
                    // executor = Executors.newCachedThreadPool();
                    return pool;
         * Private constructor: deny creating a new object
        private ThreadPoolManager() {
        /* ======================================== */
        /* implement ExecutorService interface methods via delegation to executor
         * (forbidden method calls, like shutdownNow() , will be "ignored")
          // .....I hope to have expressed all the things, and hope to receive an answer that clarifies my doubts or gives me an hint for an alternative solution or an already made solution.
    ciao
    Alessio

    Two things. Firstly, it's better to use     private static final Object classLock = new Object();because that saves you worrying about whether any other code synchronises on it. Secondly, if you do decide to go for the delegation route then java.lang.reflect.Proxy may be a good way forward.

  • Thread Pool executor

    I run a set of java programs as a single process in solaris os. Those java programs make use of thread pool executor to process threads and it runs in an infinite loop for ever. Thread processing is done whenever data is populated in database from an external source. The issue is after 2 to 3 days of running the process, it gets slowed down in executing the threads and finally it stops executing. What may be the reason for this.....how to solve this......... or how to fine tune thread pool executor in java or how to make best use of it...........

    Hey folks.... Sorry its a typo in my e-mail. Sorry about that. I am pasting the actual code here.
    The problem again is that in the index function only FirstRunnable executes but not the SecondRunnable
    final public class Crawler {
        / create an instance of the ISSThreadPoolExecutor /
        private static ThreadPoolExecutor mythreadpoolexecutor = ThreadPoolExecutor.getInstance();
        / Constructor /
        / Index function /
        public void index( .... ) {
            :::::: code :::::::::
            // Execute this folder in a seperate thread.
            this.issthreadpoolexecutor.execute(new FirstRunnable(alpha, beta, gamma));
        / The Inner Class /
        class FirstRunnable implements Runnable {
            public FirstRunnable(int alpha, int beta, int gamma) {
            public void run() {
                            doSomething();
                            // Some other tasks and ...spawn of another thread.
                            issthreadpoolexecutor.execute(new SecondRunnable(a));
             // The Inner Class that Indexes the Folder
              class SecondRunnable implements Runnable {
                      private int ei;
                      public SecondRunnable ( int abc ) {
                            this.ei = abc;
                      public void run() {
                            doSomething ( ".....") ;
              } // End of SecondRunnable Class.
         } // End of FirstRunnable class.
    } // End of Crawler Class.

  • Creating Multiple LibrarySession (Connection Pool), Using single LibraryService

    Hello,
    I am trying to create multiple LibrarySession with a single LibraryService, so that each user can pick a new session from a pool and release LibrarySession back to the pool, when the user task is been completed.
    Question.
    1. Is it possible to create LibrarySession Pool ?
    2. If yes, Can any one suggest, whether there will be any improvement in the performance of the application by doing so, or Oracle IFS internally handles the connection pool mechanism for LibrarySession.
    3. Does Oracle IFS handle LibrarySession pool internally.
    If there is any code, which does similar action, please do forward.
    Best Regards
    Sujeem Haries

    Sujeem, we do not pool LibrarySession instances for you. You may see a performance improvement if you maintain a LibrarySession pool, depending on the application. See the following post for more info:
    Oracle Security & PAM
    Please note that although LibrarySession instances are not pooled for you, the underlying database connections are pooled.

  • Thread Pool , Executors ...

    Sorry if i make a stupid post now, but i'm looking for a implementation of a Thread Pool using the latest 1.5 java.util.concurrent classes and i can't find anything serious. Any implementation or link to a tutorial should be vary helpful.
    Thnx

    but i'm looking
    for a implementation of a Thread Pool using
    the latest 1.5 java.util.concurrent classes and i
    can't find anything serious. Any implementation or
    link to a tutorial should be vary helpful.
    Thnxhere is an Example :
    import java.util.concurrent.*;
    public class UtilConcurrentTest {
    public static void main(String[] args) throws InterruptedException {
    int numThreads = 4;
    int numTasks = 20;
    ExecutorService service = Executors.newFixedThreadPool(numThreads);
    // do some tasks:
    for (int i = 0; i < numTasks; i++) {
    service.execute(new Task(i));
    service.shutdown();
    log("called shutdown()");
    boolean isTerminated = service.awaitTermination(60, TimeUnit.SECONDS);
    log("service terminated: " + isTerminated);
    public static void log(String msg) {
    System.out.println(System.currentTimeMillis() + "\t" + msg);
    private static class Task implements Runnable {
    private final int id;
    public Task(int id) {
    this.id = id;
    public void run() {
    log("begin:\t" + this);
    try { Thread.sleep(1000); } catch (InterruptedException e) {}
    log("end\t" + this);
    public String toString() {
    return "Task " + id + " in thread " + Thread.currentThread().getName();
    }

  • Thread pool executor problem

    When using a thread pool executor (java.util.concurrent.ThreadPoolExecutor) to limit the number of threads executing at a time, the number of threads running still exceeds the limit number.
    This is the code:
    private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(2, 3, 20, TimeUnit.SECONDS, new LinkedBlockingQueue());
    The number of tasks in my program are 4, so i always have 4 threads running, although i limited it to 3.
    Can anyone help me with this problem? Or can u propose another solution to limit the number of running threads? By the way, i also tried using a newFixedThreadPool() and got the same problem.
    Thx.

    The number of tasks in my program are 4, so i always
    have 4 threads running, although i limited it to 3.How do you know that there are 4 threads running? If you're generating a JVM thread dump, you're going to see threads that are used internally by the JVM.
    Here's a simple program that creates a fixed-size threadpool and runs jobs. It limits the number of concurrent threads to 3. Compare it to what you're doing, I'm sure that you'll find something different. Also, verify that you're not creating threads somewhere else in your program; all of the ThreadPoolExecutor threads will have names of the form "pool-X-thread-Y"
    import java.util.concurrent.Executors;
    import java.util.concurrent.ExecutorService;
    public class ThreadPoolTest {
        public static void main(String[] args) {
            ExecutorService pool = Executors.newFixedThreadPool(3);
            for (int ii = 0 ; ii < 10 ; ii++) {
                pool.execute(new MyRunnable());
            pool.shutdown();
        private static class MyRunnable implements Runnable {
            public void run() {
                log("running");
                try {
                    Thread.sleep(1000L);
                catch (InterruptedException e) {
                    log("interrupted");
            private void log(String msg) {
                System.err.println(
                        msg + " on " + Thread.currentThread().getName()
                        + " at " + System.currentTimeMillis());
    }

  • Optimization of Thread Pool Executor

    Hi,
    I am using ThreadPoolexecutor by replacing it with legacy Thread.
    I have created executor as below:
    pool = new ThreadPoolExecutor(coreSize, size, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(coreSize), new CustomThreadFactory(name),new CustomRejectionExecutionHandler());
           pool.prestartAllCoreThreads();
    here core size is maxpoolsize/5
    and i have prestarted all the core threads on start up of application roughly around 160 threads.
    in legacy design we were creating and starting around 670 threads.
    But the point is even after using Executor and creating and replacing  legacy design we are not getting much better results.
    For results memory management we are using top command to see memory usage
    and for time we have placed loggers of System.currentTime in millis to check the usage.
    Please tell how to optimize this design
    Thanks & Regards,
    tushar

    The first step is to decide what you want to optimize. I'm guessing you want to minimize the total elapsed time for the job to run, but anyway that's your first step. Determine what you're optimizing. Then measure the performance of the job, with respect to that metric, for various pool sizes, and see what happens.
    However I'm not sure why you expected that rewriting the application to use the ThreadPoolExecutor would improve the runtime performance of the job. I would expect it might simplify the code and make it easier for future programmers to understand, but it's possible that your thread pool implementation performs just as well.

  • Creating Thread Pool with Executors.newFixedThreadPool(poolSize)

    I am creating a server socket and want a Thread pool to limit the number of threads created for serving each clients. I have written a code:
    private ExecutorService threadPool;
    //Creating a Thread Pool for handling new sessions
    threadPool=ThreadPool.createSessionThreadPool(poolSize);
    and in my main listen logic:
    serverSocket = new ServerSocket(listenPort);
    clientSocket = serverSocket.accept();
                        threadPool.execute(new Runnable(){
                             public void run(){
                                  handleConnection();
    and in handleConnection I am trying to read the inputstream in a while loop:
    public void handleConnection(){
    BufferedReader in=null;
    in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    while (true) {
    if((fullCommandString = in.readLine()) ==null){
    wait(); // I assume that this wait will block the thread and keep the thread back in to the pool.
                        System.out.println(Thread.currentThread().getName() + " received the message");
                        System.out.println("echo: " + fullCommandString);
                        out.println("230 reply back \r\n");     
    why don't it keep the thread back in the pool when I call the wait() ? Is it since the thread is still active in reading the input stream? If so can any one hepl me with a snippet which will keep the thread back in the pool when there is noting on the input stream to read.

    Hi,
    The call to wait does not return the thread pool back to the pool. The thread will be associated with your runnable as long as your run method hasn't returned.
    It looks like you instead want to use NIO if you want to use a few threads to handle many clients.
    Kaj

  • JRun Thread Pool Issue

    I'm running CF 9.0.1 on Ubuntu on an "Medium" Amazon EC2 instance. CF has been crashing intermittently (several times per day). At such times, running top gets me this (or something similar):
    PID
    USER
    PR
    NI
    VIRT
    RES
    SHR
    S
    %CPU
    %MEM
    TIME+COMMAND                                                                                                   
    15855
    wwwrun
    20
    0
    1762m
    730m
    20m
    S
    99.3
    19.4
    13:22.96 coldfusion9
    So, it's obviously consuming most of the server resources. The following error has been showing up in my cfserver.log in the leadup to each crash:
    java.lang.RuntimeException: Request timed out waiting for an available thread to run. You may want to consider increasing the number of active threads in the thread pool.
    If I run /opt/coldfusion9/bin/coldfusion status, I get:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  150   25    0     0      -1352560      0      0
    In the administrator, under Server Settings > Request Tuning, the setting for Maximum number of simultaneous Template requests is 25. So this makes sense so far. I could just increase the thread pool to cover these sort of load spikes. I could make it 200. (Which I did just now as a test.)
    However, there's also this file /opt/coldfusion9/runtime/servers/coldfusion/SERVER-INF/jrun.xml. And some of the settings in there appear to conflict. For example, it reads:
    <service class="jrunx.scheduler.SchedulerService" name="SchedulerService">
      <attribute name="bindToJNDI">true</attribute>
      <attribute name="activeHandlerThreads">25</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="minHandlerThreads">20</attribute>
      <attribute name="threadWaitTimeout">180</attribute>
      <attribute name="timeout">600</attribute>
    </service>
    Which a) has fewer active threads (what does this mean?), and b) has a max threads that exceed the simultaneous request limit set in the admin. So, I'm not sure. Are these independent configs that need to be made to match manually? Or is the jrun.xml file supposed to be written by the CF Admin when changes are made there? Hmm. But maybe this is different because presumably the CF Scheduler should only use a subset of all available threads, right...so we'd always have some threads for real live users. We also have this in there:
    <service class="jrun.servlet.http.WebService" name="WebService">
      <attribute name="port">8500</attribute>
      <attribute name="interface">*</attribute>
      <attribute name="deactivated">true</attribute>
      <attribute name="activeHandlerThreads">200</attribute>
      <attribute name="minHandlerThreads">1</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="mapCheck">0</attribute>
      <attribute name="threadWaitTimeout">300</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="timeout">300</attribute>
    </service>
    This appears to have changed when I changed the CF Admin setting...maybe...but it's the activeHandlerThreads that matches my new maximum simulataneous requests setting...rather than the maxHandlerThreads, which again exceeds it. Finally, we have this:
    <service class="jrun.servlet.jrpp.JRunProxyService" name="ProxyService">
      <attribute name="activeHandlerThreads">200</attribute>
      <attribute name="minHandlerThreads">1</attribute>
      <attribute name="maxHandlerThreads">1000</attribute>
      <attribute name="mapCheck">0</attribute>
      <attribute name="threadWaitTimeout">300</attribute>
      <attribute name="backlog">500</attribute>
      <attribute name="deactivated">false</attribute>
      <attribute name="interface">*</attribute>
      <attribute name="port">51800</attribute>
      <attribute name="timeout">300</attribute>
      <attribute name="cacheRealPath">true</attribute>
    </service>
    So, I'm not certain which (if any) of these I should change and what exactly the relationship is between maximum requests and maximum threads. Also, since several of these list the maxHandlerThreads as 1000, I'm wondering if I should just set the maximum simultaneous requests to 1000. There must be some upper limit that depends on available server resources...but I'm not sure what it is and I don't really want to play around with it since it's a production environment.
    I'm not sure if it pertains to this issue at all, but when I run a ps aux | grep coldfusion I get the following:
    wwwrun   15853  0.0  0.0   8704   760 pts/1
    S
    20:22   0:00 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -autorestart -start coldfusion
    wwwrun   15855  5.4 18.2 1678552 701932 pts/1  
    Sl
    20:22   1:38 /opt/coldfusion9/runtime/bin/coldfusion9 -jar jrun.jar -start coldfusion
    There are always these two and never more than these two processes. So there does not appear to be a one-to-one relationship between processes and threads. I recall from an MX 6.1 install I maintained for many years that additional CF processes were visible in the process list. It seemed to me at the time like I had a process for each thread...so either I was wrong or something is quite different in version 9 since it's reporting 25 running requests and only showing these two processes. If a single process can have multiple threads in the background, then I'm given to wonder why I have two processes instead of one...just curious.
    So, anyway, I've been experimenting while composing this post. As noted above I adjusted the maximum simulataneous requests up to 200. I was hoping this would solve my problem, but CF just crashed again (rather it slogged down and requests started timing out...so effectively "crashed"). This time, top looked similar (still consuming more than 99% of the CPU), but CF status looked different:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  0     150   0     0      0      0      0      0
    Obviously, since I'd increased the maximum simultaneous requests, it was allowing more requests to run simultaneously...but it was still maxing out the server resources.
    Further experiments (after restarting CF) showed me that the server became unusably slogged after about 30-35 "Reqs Run'g", with all additional requests headed for an inevitible timeout:
    Pg/Sec  DB/Sec  CP/Sec  Reqs  Reqs  Reqs  AvgQ   AvgReq AvgDB  Bytes  Bytes
    Now Hi  Now Hi  Now Hi  Q'ed  Run'g TO'ed Time   Time   Time   In/Sec Out/Sec
    0   0   0   0   -1  -1  0     33    0     0      -492   0      0      0
    So, it's clear that increasing the maximum simultaneous requests has not helped. I guess what it comes down to is this: What is it having such a hard time with? Where are these spikes coming from? Bursts of traffic? On what pages? What requests are running at any given time? I guess I simply need more information to continue troubleshooting. If there are long-running requests, or other issues, I'm not seeing it in the logs (although I do have that option checked in the admin). I need to know which requests exactly are those responsible for these spikes. Any help would be much appreciated. Thanks.
    ~Day

    I really appreciate your help. However, I haven't been able to find the JRun Thread settings you describe above.
    Under Request Tuning, I see:
    Server Settings > Request Tuning
    Request Limits
    Maximum number of simultaneous Template requests
      Restricts the number of simultaneously processed requests. Use this setting to increase overall system performance for heavy load applications. Requests beyond the specified limit are queued. On Standard Edition, you must restart ColdFusion to enable this setting. 
    Maximum number of simultaneous Flash Remoting requests
      The number of Flash Remoting requests that can be processed concurrently.
    Maximum number of simultaneous Web Service requests
      The number of Web Service requests that can be processed concurrently.
    Maximum number of simultaneous CFC function requests
      The number of ColdFusion Component methods that can be processed concurrently via HTTP. This does not affect invocation of CFC methods from within CFML, only methods requested via an HTTP request.
    Tag Limit Settings
    Maximum number of simultaneous Report threads
      The maximum number of ColdFusion reports that can be processed concurrently.
    Maximum number of threads available for CFTHREAD
      The maximum number of threads created by CFTHREAD that will be run concurrently. Threads created by CFTHREAD in excess of this are queued.  On Standard Edition, the maximum limit is 10. 
    And under Java and JVM, I see:
    Server Settings > Java and JVM
        Java and JVM settings control the way ColdFusion starts the Java Virtual Machine when it starts.  You can control settings like what classpaths are used and how memory is allocated as well as add custom command line arguments.  Changing these settings requires restarting ColdFusion.  If you enter an incorrect setting, ColdFusion may not restart properly. 
       Backups of the jvm.config file are created when you hit the submit button. You can use this backup to restore from a critical change. 
       Java Virtual Machine Path
      Specifies the location of the Java Virtual Machine.
       Minimum JVM Heap Size (MB)         Maximum JVM Heap Size  (MB)       
       The Memory Size settings determine the amount of memory that the JVM can use for programs and data. 
       ColdFusion Class Path
      Specifies any additional class paths for the JVM, with multiple directories separated by  commas.
       JVM Arguments
      -server -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Dcoldfusion.libPath={application.home}/../lib
      Specifies any specific JVM initialization options, separated by spaces.
    I did go take a look at FusionReactor and found it's not free (which would be fine, of course, if it would actually help). It looks like there's a fully functional demo, which is cool...but I've haven't been able to get it to install yet, so we'll see.
    Thanks again!
    ~Day
    (By the way, I've cross-posted this inquiry on StackOverflow. So if you're able to help me arrive at a solution you might want to answer there as well.)

Maybe you are looking for

  • Deployment analysis error

    We made sure all of addressing was relative and changed the directory name of our code to conform to our ClearCase naming conventions. I load the ws file and the main sequence after which the tests come up and run normally. However we are having buil

  • Closing Error - Do you want to save changes to '..... . pdf' file?

    Hi, I am kinda stuck with this error for a long time now and I always thought that changing to a new PC would resolve the issue. Unfortunately that did not help and hence I am seeking a solution using this community forum. In brief, whenever I try to

  • Profile for x86

    Hi I tried to create a profile for an x86 pc to jumpstart. But when I run "check", I get an error message. My sparc-profiles are working. The only difference between those profiles is the partitions: fdisk c1t0d0s0 4000 / fdisk c1t0d0s1 256 /swap fdi

  • Help with video FX

    I am looking tutorial on how to do the "vibrating"or "scattering" video FX in final cut pro. Is there a plug-in for this? here's an exemple http://www.youtube.com/watch?v=D23ng_Clky8 Thank you

  • StreamTokenizer static fields

    Maybe this is a stupid question but why does this compile without problems: Reader r = new BufferedReader(new InputStreamReader(System.in)); StreamTokenizer tok = new StreamTokenizer(r);           // StreamTokenizer tok = new StreamTokenizer(System.i