[ https://issues.apache.org/jira/browse/DRILL-4170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sudheesh Katkam resolved DRILL-4170. ------------------------------------ Resolution: Fixed Fixed in [e4725ea|https://github.com/apache/drill/commit/e4725ea53dce58499974be93b3da87388e7df51c] through DRILL-3714. > how many concurrent users can be supported > ------------------------------------------ > > Key: DRILL-4170 > URL: https://issues.apache.org/jira/browse/DRILL-4170 > Project: Apache Drill > Issue Type: Test > Components: Client - JDBC > Affects Versions: 1.3.0 > Environment: drill1.3 JDBC SCRIPTS > Reporter: david_hudavy > Fix For: 1.7.0 > > > import java.sql.Connection; > import java.sql.Statement; > import java.sql.DriverManager; > import java.sql.ResultSet; > import java.sql.SQLException; > import java.util.ArrayList; > import java.util.List; > public class MultiThreadTestDrill { > > public static void main(String[] args) throws InterruptedException { > int threadNum = 200; > long tStart = System.currentTimeMillis(); > > System.out.println(Thread.currentThread().getName() + "START"); > for (int ii = 0; ii < threadNum; ii++) { > Thread t = new WorkerThread(); > t.start(); > } > while (true) { > if (!WorkerThread.hasThreadRunning()) { > break; > } > Thread.sleep(500); > } > > System.out.println(Thread.currentThread().getName() + "END"); > long tEnd = System.currentTimeMillis(); > System.out.println("TOTAL TIME:" + (tEnd - tStart)/1000 + "seconds"); > } > > public static class WorkerThread extends Thread { > private static List<Thread> runningThreads = new ArrayList<Thread>(); > > public WorkerThread() { > } > > @Override > public void run() { > regist(this); > // PRINT START INFORMATION > System.out.println(Thread.currentThread().getName() + "START..."); > connectToDrill(); > unRegist(this); > // PRINT END INFORMATION > System.out.println(Thread.currentThread().getName() + "END"); > } > > public void regist(Thread t) { > synchronized (runningThreads) { > runningThreads.add(t); > } > } > > public void unRegist(Thread t) { > synchronized (runningThreads) { > runningThreads.remove(t); > } > } > > public static boolean hasThreadRunning() { > return (runningThreads.size() > 0); > } > > private void connectToDrill() { > // TODO Auto-generated method stub > > String driver = "org.apache.drill.jdbc.Driver"; > > String url = "jdbc:drill:drillbit=localhost"; > String sql = "SELECT count(*) FROM mysql.datamart.StaticInf"; > try { > > Class.forName(driver); > // connect drill > Connection conn = (Connection) > DriverManager.getConnection(url); > if (!conn.isClosed()) > System.out.println("Succeeded connecting to the Drill!"); > > Statement statement = (Statement) conn.createStatement(); > > ResultSet rs = statement.executeQuery(sql); > > while (rs.next()) { > System.out.println(rs.getString(1)); > } > rs.close(); > conn.close(); > } catch (ClassNotFoundException e) { > System.out.println("Sorry,can`t find the Driver!"); > e.printStackTrace(); > } catch (SQLException e) { > e.printStackTrace(); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > } > mysql.datamart.StaticInf has 2144781 rows -- This message was sent by Atlassian JIRA (v6.3.4#6332)