we are using c3p0 connection pooling in our web-application( QTI based Online Examination System ), the problem is we are unable to support more than 18 simultaneous users, for 19th user server takes lots of time to give response.
We have tried with DBCP and TOMCAT JDBC pool still we got same result.
We are using JDK 7, MYSQL v5.5.8 and apache tomcat 7.0.42.
I am creating data-source in a singleton class
here is the code snippet
public class Helper {
private static ComboPooledDataSource dataSource;
private static ResourceBundle bundle;
static {
try {
String bundleName2 = "Conf/db";
bundle = ResourceBundle.getBundle(bundleName2);
String db_name = bundle.getString("DB_NAME");
String db_user = bundle.getString("DB_USER");
String db_pass = bundle.getString("DB_PASS");
dataSource = new ComboPooledDataSource();
dataSource.setDriverClass( "com.mysql.jdbc.Driver" );
dataSource.setJdbcUrl( "jdbc:mysql://localhost:3306/"+db_name );
dataSource.setMaxPoolSize(150);
dataSource.setInitialPoolSize(30);
dataSource.setMinPoolSize(30);
dataSource.setMaxStatements(180);
dataSource.setUser(db_user);
dataSource.setPassword(db_pass);
System.out.println("-------------data scource created------------");
} catch (PropertyVetoException ex) {
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static Connection getConnection() throws SQLException {
System.out.println("=================================================");
System.out.println("Num Connections"+dataSource.getNumConnections());
System.out.println("Num Buzy Connections"+dataSource.getNumBusyConnections());
System.out.println("max pool size"+dataSource.getMaxPoolSize());
System.out.println("idle connection"+dataSource.getNumIdleConnections());
System.out.println("================================================");
return dataSource.getConnection();
}
and I am calling "Helper.getConnection();" method for getting the connection object.
Can anyone tell us what could be the reason.