hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brock Noland (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-4762) HMS cannot handle concurrent requests
Date Thu, 20 Jun 2013 04:24:20 GMT

    [ https://issues.apache.org/jira/browse/HIVE-4762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13688852#comment-13688852
] 

Brock Noland commented on HIVE-4762:
------------------------------------

The "Read" concurrency issue appears to be solved by placing the following in my hive-site.xml
(HIVE-3521):

{noformat}
  <property>
    <name>datanucleus.autoStartMechanism</name>
    <value>SchemaTable</value>
  </property>
{noformat}
                
> HMS cannot handle concurrent requests
> -------------------------------------
>
>                 Key: HIVE-4762
>                 URL: https://issues.apache.org/jira/browse/HIVE-4762
>             Project: Hive
>          Issue Type: Sub-task
>    Affects Versions: 0.11.0
>            Reporter: Brock Noland
>            Assignee: Brock Noland
>            Priority: Critical
>             Fix For: 0.12.0
>
>
> It appears our use of DataNucleaus is not correct or perhaps there is a bug in the ancient
version of DN we are using. On startup having multiple threads performing "show tables" results
in failures. Additionally concurrent DML will fail event after startup. I used the program
below to demonstrate this.
> {noformat}
> package org.apache.hadoop.hive.ql;
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.Statement;
> import java.util.concurrent.ExecutorService;
> import java.util.concurrent.Executors;
> import org.apache.hive.jdbc.HiveDriver;
> public class MultiThreadTest {
>   public static class QueryRunner implements Runnable {
>     int id;
>     double averageElapsedTime;
>     Connection connection;
>     Statement statement;
>     QueryRunner(int id) {
>       this.id = id;
>     }
>     @Override
>     public void run() {
>       long count = 0;
>       double elapsedTime = 0;
>       try {
>         connection = DriverManager.getConnection("jdbc:hive2://localhost:10000/default",
"brock", "password");
>         statement = connection.createStatement();
> //        statement.execute("DROP TABLE IF EXISTS t" + id);
>         for (int i = 0; i < 10; i++) {
> //          statement.execute("CREATE TABLE t" + id + " (key int)");
>           long start = System.currentTimeMillis();
> //          statement.execute("DROP TABLE t" + id);
>           statement.execute("SHOW TABLES");
>           elapsedTime += System.currentTimeMillis() - start;
>           count++;
>         }
>         if(statement != null) {
>           statement.close();
>         }
>         if(connection != null) {
>           connection.close();
>         }
>       } catch (Exception e) {
>         e.printStackTrace();
>       } finally {
>         if(count > 0) {
>           averageElapsedTime = elapsedTime / (double)count;
>         }
>       }
>     }
>   }
>   public static void main(String[] args) throws Exception {
>     int numThreads = 50;
>     Class.forName(HiveDriver.class.getName());
>     ExecutorService executor = Executors.newFixedThreadPool(numThreads);
>     QueryRunner[] queryRunners = new QueryRunner[numThreads];
>     for (int i = 0; i < numThreads; i++) {
>       queryRunners[i] = new QueryRunner(i);
>       executor.execute(queryRunners[i]);
>     }
>     executor.shutdown();
>     while(!executor.isTerminated()) {
>       System.out.println("Waiting...");
>       Thread.sleep(1000L);
>     }
>     for (int i = 0; i < numThreads; i++) {
>       System.out.println(Math.round(queryRunners[i].averageElapsedTime));
>     }
>   }
> }
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message