Change Native App Compute Pool: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
(Created page with "By default, QPR ProcessAnalyzer Native App uses the CPU_X64_S size compute pool. The compute pool size can be changed (for example to CPU_X64_XS) using the following instructions. The instructions use procedure '''public.set_compute_pool''' which is part of the Native App and it recreates application service in a specified compute pool. Application role ADMINISTRATOR is required to run the procedure. The procedure will drop and recreate the application service. Data in...")
 
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
By default, QPR ProcessAnalyzer Native App uses the CPU_X64_S size compute pool. The compute pool size can be changed (for example to CPU_X64_XS) using the following instructions.
QPR ProcessAnalyzer Native App uses by default either the CPU_X64_XS or CPU_X64_S size Snowflake compute pool, depending when the Native App has been installed. The current compute pool size can be checked in Snowsight in '''Compute''' > '''Compute pools''' where the '''QPR_PROCESSANALYZER_COMPUTE_POOL''' compute pool can be found.


The instructions use procedure '''public.set_compute_pool''' which is part of the Native App and it recreates application service in a specified compute pool. Application role ADMINISTRATOR is required to run the procedure. The procedure will drop and recreate the application service. Data in QPR ProcessAnalyzer database will be lost - use the snapshot to save and restore data.
The compute pool can be changed using the instructions in this article. The instructions use the '''public.set_compute_pool''' procedure which is part of the Native App. It recreates the Native App application service to a specified compute pool. In the process, QPR ProcessAnalyzer configuration database will be lost, so it's important to use a snapshot to save and restore data. The application role ADMINISTRATOR is required to run the procedure.
 
To change the compute pool size, follow these step-by-step instructions by executing the commands in a Snowflake worksheet. This guide will switch the compute pool to the CPU_X64_XS size. If you prefer to change the compute pool size to CPU_X64_S, replace the INSTANCE_FAMILY with that value. Additionally, update the compute pool name to reflect its new size.


<pre>
<pre>
-- stop application service
-- 1. Stop application service
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);


-- take snapshot
-- 2. Create a database and schema for snapshots and take a snapshot
CREATE DATABASE QPRProcessAnalyzerBackups;
USE DATABASE QPRProcessAnalyzerBackups; 
CREATE SCHEMA Backups;
CREATE SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot
CREATE SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot
   FROM SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE
   FROM SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE
Line 14: Line 19:
   INSTANCE 0;
   INSTANCE 0;


-- create new compute pool for application
-- 3. Create new compute pool for application
CREATE COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_S
CREATE COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_XS
       FOR APPLICATION QPR_PROCESSANALYZER
       FOR APPLICATION QPR_PROCESSANALYZER
       MIN_NODES = 1
       MIN_NODES = 1
       MAX_NODES = 1
       MAX_NODES = 1
       INSTANCE_FAMILY = CPU_X64_S
       INSTANCE_FAMILY = CPU_X64_XS
       AUTO_RESUME = true;
       AUTO_RESUME = true;


-- wait until compute pool is in status IDLE
-- 4. Wait until compute pool is in status IDLE by usin the following command
SHOW COMPUTE POOLS LIKE 'QPR_PROCESSANALYZER_COMPUTE_POOL_S';


-- grant permissions to application
-- 5. Grant permissions to application
GRANT USAGE ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_S TO APPLICATION QPR_PROCESSANALYZER;
GRANT USAGE ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_XS TO APPLICATION QPR_PROCESSANALYZER;


-- call the procedure
-- 6. Call the SET_COMPUTE_POOL procedure
CALL QPR_PROCESSANALYZER.PUBLIC.SET_COMPUTE_POOL('QPR_PROCESSANALYZER_COMPUTE_POOL_S');
CALL QPR_PROCESSANALYZER.PUBLIC.SET_COMPUTE_POOL('QPR_PROCESSANALYZER_COMPUTE_POOL_XS');


-- now in Snowflake UI go to application and press 'Activate'
-- 7. In Snowsight, go to application Native App and press 'Activate'. Wait until activation is finished.
-- wait until activation finished


-- stop application service again to restore snapshot
-- 8. Stop application service again to restore snapshot
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);


-- restore snapshot
-- 9. Restore snapshot
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESTORE
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESTORE
   VOLUME "data"
   VOLUME "data"
Line 43: Line 48:
   FROM SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot;
   FROM SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot;


-- start service
-- 10. Start service
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESUME;
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESUME;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('RUNNING', 600);
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('RUNNING', 600);


-- remove old compute pool
-- 11. Remove old compute pool
GRANT OWNERSHIP ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL TO ROLE ACCOUNTADMIN;
GRANT OWNERSHIP ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL TO ROLE ACCOUNTADMIN;
DROP COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL;
DROP COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL;
</pre>
</pre>
More information about Snowflake compute pools: https://docs.snowflake.com/en/developer-guide/snowpark-container-services/working-with-compute-pool.

Latest revision as of 14:42, 1 October 2025

QPR ProcessAnalyzer Native App uses by default either the CPU_X64_XS or CPU_X64_S size Snowflake compute pool, depending when the Native App has been installed. The current compute pool size can be checked in Snowsight in Compute > Compute pools where the QPR_PROCESSANALYZER_COMPUTE_POOL compute pool can be found.

The compute pool can be changed using the instructions in this article. The instructions use the public.set_compute_pool procedure which is part of the Native App. It recreates the Native App application service to a specified compute pool. In the process, QPR ProcessAnalyzer configuration database will be lost, so it's important to use a snapshot to save and restore data. The application role ADMINISTRATOR is required to run the procedure.

To change the compute pool size, follow these step-by-step instructions by executing the commands in a Snowflake worksheet. This guide will switch the compute pool to the CPU_X64_XS size. If you prefer to change the compute pool size to CPU_X64_S, replace the INSTANCE_FAMILY with that value. Additionally, update the compute pool name to reflect its new size.

-- 1. Stop application service
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);

-- 2. Create a database and schema for snapshots and take a snapshot
CREATE DATABASE QPRProcessAnalyzerBackups;
USE DATABASE QPRProcessAnalyzerBackups;  
CREATE SCHEMA Backups;
CREATE SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot
  FROM SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE
  VOLUME "data"
  INSTANCE 0;

-- 3. Create new compute pool for application
CREATE COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_XS
      FOR APPLICATION QPR_PROCESSANALYZER
      MIN_NODES = 1
      MAX_NODES = 1
      INSTANCE_FAMILY = CPU_X64_XS
      AUTO_RESUME = true;

-- 4. Wait until compute pool is in status IDLE by usin the following command
SHOW COMPUTE POOLS LIKE 'QPR_PROCESSANALYZER_COMPUTE_POOL_S';

-- 5. Grant permissions to application
GRANT USAGE ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL_XS TO APPLICATION QPR_PROCESSANALYZER;

-- 6. Call the SET_COMPUTE_POOL procedure
CALL QPR_PROCESSANALYZER.PUBLIC.SET_COMPUTE_POOL('QPR_PROCESSANALYZER_COMPUTE_POOL_XS');

-- 7. In Snowsight, go to application Native App and press 'Activate'. Wait until activation is finished.

-- 8. Stop application service again to restore snapshot
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE SUSPEND;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('SUSPENDED', 600);

-- 9. Restore snapshot
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESTORE
  VOLUME "data"
  INSTANCES 0
  FROM SNAPSHOT QPRProcessAnalyzerBackups.Backups.MySnapshot;

-- 10. Start service
ALTER SERVICE QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE RESUME;
CALL QPR_PROCESSANALYZER.METADATA.QPR_PROCESSANALYZER_SERVICE!SPCS_WAIT_FOR('RUNNING', 600);

-- 11. Remove old compute pool
GRANT OWNERSHIP ON COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL TO ROLE ACCOUNTADMIN;
DROP COMPUTE POOL QPR_PROCESSANALYZER_COMPUTE_POOL;

More information about Snowflake compute pools: https://docs.snowflake.com/en/developer-guide/snowpark-container-services/working-with-compute-pool.