Managing an Apache Hive workload
Also available as:

Create a resource plan

As administrator, you can create resource plans that configure your cluster for different conditions, enabling you to improve parallel query execution and share queries on nodes running LLAP. You can allocate resources to a pool of users, groups, or applications and trigger actions in a plan.

You started Hive from the Beeline shell.

As administrator, you can either create a new resource plan or clone another plan and then modify it.

  1. Create a resource plan.
    • Create a new resource plan (for example, one named high_concurr_rp):
      CREATE RESOURCE PLAN high_concurr_rp;
    • Clone an existing resource plan (for example, ha_plan) and rename it high_concurr_rp:
      CREATE RESOURCE PLAN high_concurr_rp LIKE ha_plan;
    • Create a new resource plan (for example, named high_concurr_rp) and specify a query concurrency limit:
  2. Optionally, add one or more query pools to the plan.
    CREATE POOL high_concurr_rp.bi_pool
    CREATE POOL high_concurr_rp.etl_pool
    This example configuration allocates 75 percent of the LLAP cluster resources to one pool and 25 percent to the other, and allows 5 concurrent queries by users in one pool and 10 concurrent queries by users in the other.
  3. Optionally, map an application to a pool.
    CREATE APPLICATION MAPPING tableau_to_bi IN bi_pool;             
    This example mapping of the Tableau application to the bi_pool requires Tableau to connect to HiveServer using a JDBC connection string that includes applicationName="Tableau". In a mapping of a group to a pool, group authorization depends on the HDFS group configuration on the cluster. You can configure Lightweight Directory Protocol (LDAP) and other mechanisms.
  4. Optionally, create a trigger. For example, create a trigger that moves a query to the etl_pool for execution when the execution time exceeds one minute.
    CREATE TRIGGER high_concurr_rp.slow_query
    WHEN execution_time_ms > 60000
    DO MOVE TO etl_pool;                
  5. If you are running the LLAP service, add a trigger to the pool or resource plan as shown in the following example.
    ADD TRIGGER high_concurr_rp.slow_query ADD TO POOL bi_pool;
    You must add a trigger to a pool or resource plan when running under LLAP; otherwise, the trigger is considered global and runs only in Tez.