Hai i am new to hadoop and hive. My app cannot handle multiple connections now. When the number connections increasing(more than 4) it gets slow. Can any one figure it out.The code is given below.
public static void setupDriver(String connectURI) throws Exception {
ObjectPool connectionPool = new GenericObjectPool(null);
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
connectURI, username, password);
@SuppressWarnings("unused")
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
connectionFactory, connectionPool, null, null, false, true);
Class.forName(poolingDriver);
PoolingDriver driver = (PoolingDriver) DriverManager.getDriver(poolConnection);
driver.registerPool(poolName, connectionPool);
}
stmt = connection.createStatement();
String queryString = "select feed_date,count(feed_date) from twitter_stats where tweet like '%" + searchRequest.getWord() + "%' ";
if (null != searchRequest.getFromDate()) {
queryString += "and feed_date >= '" + searchRequest.getFromDate() + "' ";
}
You really should not use a LIKE condition which is starting by %. In most case, this will lead to performance trouble !
Try to suppress it, and then tell us if it solve your issue.
There is some clues here : LIKE work-around in SQL (Performance issues), even if don’t deal with this subject.