Seda/NIO and the Idle Loop

Tim Walker <[email protected]> Wed, 20 Aug 2003 14:41:44 -0700
Newsgroups gmane.comp.java.seda.user
Message-ID <[email protected]>
Hi All, 
 
First off, sorry about the HTML. 
 
Question: Our Seda application has a few stages, but doesn't do a lot when the data is turned off. Still, some
are complaining that the mere presence of Seda is causing slow downs in other parts of the application. I was
a little surprised to see that theory born out with JProfiler showing that, of the CPU usage (which is small,
like 8%) a fair amount is in java.nio and sandstorm.core as shown below. What the heck is it doing, when it's
doing nothing? My config file follows signature. Any thoughts, very much appreciated. All the best!
 
  21.7% - 284251 ms - 5 inv. org.apache.ajp.tomcat4.Ajp13Processor.run
     16.5% - 216083 ms - 202 inv. java.nio.channels.Selector.select
         16.5% - 216083 ms - 202 hot spot inv. seda.sandStorm.lib.aSocket.nio.NIOSelectSource.doPoll
             16.5% - 216083 ms - 202 hot spot inv.
seda.sandStorm.lib.aSocket.nio.NIOSelectSource.blocking_dequeue
                 16.5% - 216083 ms - 202 hot spot inv.
seda.sandStorm.lib.aSocket.aSocketThreadManager$aSocketThread.run
     13.7% - 179449 ms - 6124 inv. java.lang.Object.wait
         13.7% - 179389 ms - 5903 hot spot inv. seda.sandStorm.core.FiniteQueue.blocking_dequeue
             13.7% - 179389 ms - 5903 hot spot inv. seda.sandStorm.core.FiniteQueue.blocking_dequeue
                 10.9% - 143320 ms - 5474 hot spot inv.
seda.sandStorm.internal.TPSThreadManager$stageRunnable.run
                 2.7% - 36069 ms - 429 hot spot inv.
seda.sandStorm.lib.aSocket.aSocketThreadManager$aSocketThread.run
         0.0% - 58 ms - 207 hot spot inv. com.mercury.util.threads.AbstractTimedoutRunnable.waitForThread
         0.0% - 0 ms - 6 hot spot inv. com.mercury.util.threads.ThreadPool$MonitorRunnable.run
         0.0% - 0 ms - 8 hot spot inv. EDU.oswego.cs.dl.util.concurrent.ClockDaemon.nextTask
     12.4% - 162660 ms - 0 inv. org.jboss.Main.main
--
Tim 
<sandstorm>
  <global>
 
    #<threadPool>
    #      initialThreads 1             # Initial number of threads per stage
    #      minThreads 1                    # Min number of threads per stage
    #      maxThreads 20                 # Max number of threads per stage
    #      blockTime 100                 # Time to block waiting for events (ms)
    #      <sizeController>
    #            autoMaxDetect false
    #            enable true                      # Enable thread pool sizing controller
    #            delay 100                       # Delay between measurements (ms)
    #            threshold 10                           # Queue threshold above which to add thread
    #            idleTimeThreshold 15000   # Idle time (ms) after which thread dies
    #      </sizeController>
    #   </threadPool>
# Options for thread pool management
    <threadPool>
        # The minimum number of threads allocated to each thread pool.
        minThreads 1
        # The maximum number of threads allocated to each thread pool.
        maxThreads 10
        # The initial number of threads allocated to each thread pool.
        initialThreads 1
        <sizeController>
              # Enable the thread pool sizing controller. This resizes the thread
              # pool for each stage when the stage's incoming event queue reaches
              # some threshold.
              enable true
              # The sampling delay (in milliseconds) for the controller.
              delay 2000
              # The threshold above which threads are added to a pool.
              threshold 1000
        </sizeController>
    </threadPool>
 
 
       <batchController>
          enable false                     # Enable batching controller
          minBatch 1                     # Minimum batching factor
          maxBatch 1024              # Maximum batching factor
    #      maxBatch 4                  # Maximum batching factor
          recalcWindow 100                     # Averaging window
          smoothConst 0.5                        # Smoothing constant
        </batchController>
 
        <profile>
          enable false             # Enable profiler (sandstorm-profile.txt)
          delay 1000                     # Delay between measurements (ms)
          sockets false                   # Whether to include socket queues
          graph false                      # Whether to generate stage graph
        </profile>
 
    <aSocket>
      provider NIO
    </aSocket>
 
#  <aDisk>
#    enable true              # Enable aDisk layer
#     <threadPool>
#      initialThreads 1     # Initial thread pool size
#              <sizeController>
#                  threshold 20                     # Queue threshold above which to add thread
#              </sizeController>
#      </threadPool>
#    </aDisk>
 
    <initargs>                             # Initial arguments passed to all stages
 
    # Port for the server to listen on
    httpPort 8888
 
    # Maximum number of requests per conection; -1 for no max
    maxRequests -1
 
    # Maximum number of simultaneous connections; -1 for no max
    maxConnections -1
 
    # Maximum number of simultaneous requests; -1 for no max
    maxSimultaneousRequests -1
 
    # Maximum size of page cache in KB; -1 for no max
    maxCacheSize 204800
 
    # Number of buffers in BufferCache
    numBuffers 1024
 
    # Size of each buffer in bytes
    bufferSize 8192
 
    # Servername in response header
    serverName Frieda v1.0
 
    # Default URL for accessing directory
    defaultURL index.html
 
    # Root of page directory
    rootDir /current/Frieda/Mockup
 
    </initargs>
 
  </global>
 
# Specify stages
  <stages>
            <enterprise_services>
                        class com.freshwater.stage.enterprise.EnterpriseServicesStage
            </enterprise_services>
 
            <sitescope_listener>
                        class com.freshwater.stage.sitescope.SiteScopeListenerStage
                         <initargs>
                                    listener_port 8887
                                    listener_host localhost
                                    listener_heartbeat_frequency 30000
                                    ss_connection_heartbeat_interval 30000
                        </initargs>
                        <threadPool>
                                    minThreads 20                  # Min number of threads per stage
            maxThreads 100                           # Max number of threads per stage
                                    initialThreads 20       # Initial thread pool size
                                    <sizeController>
                                    threshold 5000             # Queue threshold above which to add thread
                                    </sizeController>
            </threadPool>
            </sitescope_listener>
 
    <directory_services>
      class com.freshwater.stage.directory.DirectoryServicesStage
                <initargs>
                                    dirHost ldap://localhost:389
                                    dirRoot 
                                    dirBase SSEnterprise
                                    dirEnterprise Enterprise
                                    dirFactory com.sun.jndi.ldap.LdapCtxFactory
                                    dirServiceCmd C:/openldap/openldap-2_0_19_debug/start_slapd.bat
                                    default_search_filter_attributes pname,objectcategory,pdescription
            </initargs>
   </directory_services>
 
   <active_agent_directory_services>
      class com.freshwater.stage.directory.ActiveAgentDirectoryServicesStage
                <initargs>
                                    dirHost ldap://localhost:389
                                    dirRoot 
                                    dirBase SSEnterprise
                                    dirEnterprise Enterprise
                                    dirFactory com.sun.jndi.ldap.LdapCtxFactory
                                    dirServiceCmd C:/openldap/openldap-2_0_19_debug/start_slapd.bat
                                    default_search_filter_attributes pname,objectcategory,pdescription
                </initargs>
   </active_agent_directory_services>
 
            <sitescope_controller>
                        class com.freshwater.stage.sitescope.SiteScopeControllerStage
            </sitescope_controller>
 
            <sitescope_interface>
                        class com.freshwater.stage.sitescope.SiteScopeInterfaceStage
                        <initargs>
                                    ss_control_mode on
                        </initargs>
            </sitescope_interface>
 
            <topaz_controller>
                        class com.freshwater.stage.topaz.TopazControllerStage
            </topaz_controller>
 
            <device_controller>
                        class com.freshwater.stage.device.DeviceControllerStage
            </device_controller>
 
  </stages>
</sandstorm>
image001.gif (image/gif, 609 B) - not displayed
image002.gif (image/gif, 619 B) - not displayed
image003.gif (image/gif, 588 B) - not displayed
image004.gif (image/gif, 1006 B) - not displayed