2 Replies Latest reply on Oct 5, 2012 5:46 AM by mandarv99

    Database connection taking time in Jboss as 7.1.1

    mandarv99

      Hello everyone,

       

      I am testing a servlet on Jboss AS 7.1.1.Final. In production environment it is expected to get around 10,000 requests in a minute. When I have simulated it without connecting to database it was taking requests close to 12,000 per minute. However, when I add database connection to it, it takes around 100 to 2000 requests per minute. When I start the server, till the time pool is filled it takes only around 50-100 request in a minute and after 3-4 minutes it takes 2000 requests.

       

      I am using Oracle RAC 11g 11.2.0.3 and server is having 8GB RAM.

       

      This is my datasource setting.

       

      <datasources>

       

          <datasource jta="true" jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">

       

              <connection-url>jdbc:oracle:oci:@ Connection - String</connection-url>

       

              <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

       

              <driver>ojdbc6.jar</driver>

       

              <pool>

       

                  <min-pool-size>100</min-pool-size>

       

                  <max-pool-size>500</max-pool-size>

       

                  <prefill>true</prefill>

       

              </pool>

       

              <security>

       

                  <user-name>user name</user-name>

       

                  <password>password</password>

       

              </security>

       

              <validation>

       

                  <validate-on-match>false</validate-on-match>

       

                  <background-validation>false</background-validation>

       

              </validation>

       

              <timeout>

       

                  <blocking-timeout-millis>1000</blocking-timeout-millis>

       

                  <idle-timeout-minutes>5</idle-timeout-minutes>

       

              </timeout>

       

              <statement>

       

                  <share-prepared-statements>false</share-prepared-statements>

       

              </statement>

       

          </datasource>

       

          <drivers>

       

              <driver name="ojdbc6.jar" module="com.oracle.ojdbc">

       

                  <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>

       

              </driver>

       

          </drivers>

       

      </datasources>

       

      Also i have added this setting for threads.

      <bounded-queue-thread-pool name="http-executor">

          <core-threads count="14500"/>

          <queue-length count="30"/>

          <max-threads count="15000"/>

          <keepalive-time time="300" unit="seconds"/>

      </bounded-queue-thread-pool>

      <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" max-post-size="2048" max-save-post-size="0" executor="http-executor" max-connections="12000"/>

       

       

      This is datasource outcome in cli.

       

      {

       

          "outcome" => "success",

       

          "result" => {

       

              "ActiveCount" => "4",

       

              "AvailableCount" => "496",

       

              "AverageBlockingTime" => "0",

       

              "AverageCreationTime" => "805",

       

              "CreatedCount" => "4",

       

              "DestroyedCount" => "0",

       

              "MaxCreationTime" => "1102",

       

              "MaxUsedCount" => "4",

       

              "MaxWaitTime" => "0",

       

              "TimedOut" => "0",

       

              "TotalBlockingTime" => "0",

       

              "TotalCreationTime" => "3223"

       

          }

       

      }

       

      {

       

          "outcome" => "success",

       

          "result" => {

       

              "ActiveCount" => "101",

       

              "AvailableCount" => "400",

       

              "AverageBlockingTime" => "0",

       

              "AverageCreationTime" => "44052",

       

              "CreatedCount" => "101",

       

              "DestroyedCount" => "0",

       

              "MaxCreationTime" => "71020",

       

              "MaxUsedCount" => "100",

       

              "MaxWaitTime" => "1",

       

              "TimedOut" => "0",

       

              "TotalBlockingTime" => "6",

       

              "TotalCreationTime" => "4449312"

       

          }

       

      }

       

      Am I missing anything or configuring it wrong.

      Please suggest.

      Thanks

        • 1. Re: Database connection taking time in Jboss as 7.1.1
          wdfink

          Hi,

           

          the configuration looks not bad.

          How do you measure? Do you use the same application and add only the getConnection()? This might avoid other bottlenecks.

          Do you use a DB query or only connect?

          Do you have GC logging enabled that we can sure this is not the issue?

           

          From the statistics it looks like that only 100 connections are used (MaxUsedCount) and there is only less wait for a connection (AverageBlockingTime / TotalBlockingTime)

           

          You might add time statistic to your code that you are able to see where the time is spend.

          Also you might set min-pool-size==max-pool-size to avoid releasing connections and start after the pool is filled up.

          Maybe the bottleneck is the network or database?

          1 of 1 people found this helpful
          • 2. Re: Database connection taking time in Jboss as 7.1.1
            mandarv99

            Thanks Buddy,

             

            Your answer helped me to look for other options. I have used the same application having database connection and  without database connection. I checked it once again just opening connection and closing it. It was also working fine. That means there was no problem in connectivity. I restructured my code and in test enviornment it is working perfectly fine hopefully it will work in production environment.

             

            Thanks a lot for valuable information.