Managing an Apache Hive workload
Also available as:
PDF

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 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:
      CREATE RESOURCE PLAN high_concurr_rp WITH QUERY_PARALLELISM=15;
  2. Optionally, add one or more query pools to the plan.
    CREATE POOL high_concurr_rp.bi_pool
    WITH ALLOC_FRACTION=75 AND QUERY_PARALLELISM=5;
                        
    CREATE POOL high_concurr_rp.etl_pool
    WITH ALLOC_FRACTION=25 AND QUERY_PARALLELISM=10;              
    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 users to a pool.
    CREATE APPLICATION MAPPING tableau_to_bi IN bi_pool;             
    This example mapping of Tableau users to the bi_pool requires Tableau users to connect to HiveServer using a JDBC connection string that includes applicationName="Tableau".
  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.