cancel
Showing results for 
Search instead for 
Did you mean: 

load testing connection pooling

luisalves00
Champ in-the-making
Champ in-the-making
Hello,

My load test seem to fail because of some kind of connection starvation (still not sure).

O configure the engine programmaticaly:


org.apache.commons.dbcp.BasicDataSource bds = new org.apache.commons.dbcp.BasicDataSource();
            bds.setDefaultAutoCommit(false); //FIXME: make me configurable
            bds.setUsername(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.username"));
            bds.setPassword(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.password"));
            bds.setDriverClassName(ApplicationConfig.getConfigParam("activiti.driverClassName"));
            bds.setUrl(ApplicationConfig.getConfigParam("activiti.url"));



            ProcessEngine processEngine = ProcessEngineConfiguration
                    .createStandaloneProcessEngineConfiguration()
                    .setDataSource(bds)
                    .setJdbcMaxActiveConnections(100)            
                    .setJdbcMaxIdleConnections(25)
                    .setDatabaseType(ApplicationConfig.getConfigParam("activiti.databaseType"))
                    .setDatabaseSchemaUpdate(ApplicationConfig.getConfigParam("activiti.databaseSchemaUpdate"))
                    .setHistory(ApplicationConfig.getConfigParam("activiti.history"))
                    .setProcessEngineName(ACTIVITI_ENGINE_NAME)
                    .setJobExecutorActivate(false) //FIXME: make me configurable
                    .buildProcessEngine();

            ProcessEngines.registerProcessEngine(processEngine);

only see 8 connections to the db, with 15 parallel request.

any idea?
23 REPLIES 23

luisalves00
Champ in-the-making
Champ in-the-making
now I can't start any workflow….

java.lang.NumberFormatException: For input string: "d5d5dc0b-f005-11e0-8a7c-542ac8f06f0b"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Long.parseLong(Long.java:410)
        at java.lang.Long.valueOf(Long.java:525)


I'm doing:  pa.setIdWorkflow(BigInteger.valueOf(Long.valueOf(execution.getProcessInstanceId())));
but now this is not a number…so I need to do some changes on my DB

this will fix this exception, right?:

29-09-2011 06:30:16 CommandContext [ERROR] Error while closing command context
org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). Requested setting: false.  Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 86.321.988 milliseconds ago.  The last packet sent successfully to the server was 86.321.988 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
   at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:47)

marcus1
Champ in-the-making
Champ in-the-making
Actually that exception does not look related to me. It seems like you have some old connections in your pool (i.e. they haven't been used for a long time). The exception message explains it pretty well:

"You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem."

In tomcat, testing connection validity is done as follows:

    <Resource name="…"
              auth="Container"
              type="javax.sql.DataSource"
              username="…"
              password="…"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://…"
              testOnBorrow="true"             <!– add this –>
              validationQuery="SELECT 1+1"/>  <!– and this –>

luisalves00
Champ in-the-making
Champ in-the-making
I'm setting the "resource" like this:

.setJdbcUrl(ApplicationConfig.getConfigParam("activiti.url"))
.setJdbcDriver(ApplicationConfig.getConfigParam("activiti.driverClassName"))
.setJdbcUsername(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.username"))
.setJdbcPassword(ApplicationConfig.getEncryptedConfigParamDecrypted("activiti.password"))

how to get that done in here?

pec.setJdbcPingQuery("SELECT 1+1");
pec.setJdbcPingEnabled(true);

will work?

marcus1
Champ in-the-making
Champ in-the-making
That's worth a try. Only one way to find out whether it will work Smiley Happy