Oracle 并行相关的初始化参数


Oracle数据库并行操作,特别是在RAC环境,一定程度上能够提升数据库的性能,所以对相关的初始化参数的了解是必要的,这篇文章将根据实际的案例讨论Oracle数据库的部分并行参数。

Oracle数据库相关的并行参数:

SQL> show parameter parallel


NAME                                TYPE                  VALUE

------------------------------------ ---------------------- --------------------

fast_start_parallel_rollback        string                LOW

parallel_adaptive_multi_user        boolean                TRUE

parallel_automatic_tuning            boolean                FALSE

parallel_degree_limit                string                CPU

parallel_degree_policy              string                MANUAL

parallel_execution_message_size      integer                16384

parallel_force_local                boolean                FALSE

parallel_instance_group              string

parallel_io_cap_enabled              boolean                FALSE

parallel_max_servers                integer                135

parallel_min_percent                integer                0

 


NAME                                TYPE                  VALUE

------------------------------------ ---------------------- --------------------

parallel_min_servers                integer                0

parallel_min_time_threshold          string                AUTO

parallel_server                      boolean                FALSE

parallel_server_instances            integer                1

parallel_servers_target              integer                64

parallel_threads_per_cpu            integer                2

recovery_parallelism                integer                0

下面是实际Oracle RAC环境下,Oracle并行参数的设置,我们将优先讨论这些参数:

*.parallel_adaptive_multi_user=FALSE

*.parallel_execution_message_size=16384

*.parallel_max_servers=240

*.parallel_min_servers=0

*.parallel_threads_per_cpu=1

PARALLEL_ADAPTIVE_MULTI_USER

PropertyDescription
Parameter type Boolean
Default value true
Modifiable ALTER SYSTEM
Range of values true | false

^eBVyq:A E0

PARALLEL_ADAPTIVE_MULTI_USER, when set to true, enables an adaptive algorithm designed to improve performance in multiuser environments that use parallel execution. The algorithm automatically reduces the requested degree of parallelism based on the system load at query startup time. The effective degree of parallelism is based on the default degree of parallelism, or the degree from the table or hints, divided by a reduction factor.ITPUB个人空间T(k k(gsnA2i
当PARALLEL_ADAPTIVE_MULTI_USER参数设置为TRUE,启用设计的适当算法,在多用户环境下使用并行执行提升性能。这个算法基于查询开始时的系统负载自动减少请求的并行度。有效的并行度是基于默认的并行度,或者来自表或HINT的并行度,通过减少系数进行分割。

The algorithm assumes that the system has been tuned for optimal performance in a single-user environment.
9^,{G5s4fCDH1W8g3v0算法假定系统在单用户环境下按照最优性能被调整。

Tables and hints use the default degree of parallelism.ITPUB个人空间G8["q^8VxV2B%Sd
表和HINT使用默认的并行度。

ITPUB个人空间g9G(h7]NJ%U

PARALLEL_MAX_SERVERS

PropertyDescription
Parameter type Integer
Default value PARALLEL_THREADS_PER_CPU * CPU_COUNT * concurrent_parallel_users * 5
Modifiable ALTER SYSTEM
Range of values 0 to 3600
Oracle RAC Multiple instances can have different values.

7i(QH&n-O4Q+a0

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_MAX_SERVERS specifies the maximum number of parallel execution processes and parallel recovery processes for an instance. As demand increases, Oracle Database increases the number of processes from the number created at instance startup up to this value.ITPUB个人空间%Yf?&^RJaa(Jd
PARALLEL_MAX_SERVERS指定实例最大并行执行进程和并行恢复进程数。随着增长需求,Oracle数据库需要增加进程数,从实例启动时创建的数目到增长值。

In the formula, the value assigned to concurrent_parallel_users running at the default degree of parallelism on an instance is dependent on the memory management setting. If automatic memory management is disabled (manual mode), then the value of concurrent_parallel_users is 1. If PGA automatic memory management is enabled, then the value of concurrent_parallel_users is 2. If global memory management or SGA memory target is used in addition to PGA automatic memory management, then the value of concurrent_parallel_users is 4.ITPUB个人空间+n t?)WZ\#lS
根据上面的公式,分配给concurrent_parallel_users的值,运行在实例的默认并行度依赖于内存管理设置。如果禁用自动内存管理(手动模式),那么concurrent_parallel_user的值是1,如果启用PGA自动内存管理,那么concurrent_parallel_users的值是2。如果除了PGA自动内存管理外,还使用了全局内存管理或者SGA内存target,那么concurrent_parallel_users的值是4。
Gx4xKN6nt,S$@9~0ITPUB个人空间K,S%`+xrP#A7Ey

If you set this parameter too low, then some queries may not have a parallel execution process available to them during query processing. If you set it too high, then memory resource shortages may occur during peak periods, which can degrade performance.ITPUB个人空间J/bVtZXV]2v
如果设置这个参数过小,那么某些查询在查询过程中可能没有并行执行进程活动。如果设置这个参数过大,那么在峰值期间内存资源可能不足,导致性能下降。


w*v-|[M!E3Q,N^ e0
'r'_ m c8YKI d0

PARALLEL_MIN_SERVERS

PropertyDescription
Parameter type Integer
Default value 0
Modifiable ALTER SYSTEM
Range of values 0 to value of PARALLEL_MAX_SERVERS
Oracle RAC Multiple instances can have different values.

E*V~BZU B/\Ur0

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_MIN_SERVERS specifies the minimum number of parallel execution processes for the instance. This value is the number of parallel execution processes Oracle creates when the instance is started.
kT?I|z:t7O.O?0PARALLEL_MIN_SERVERS指定实例并行执行进程数的最小值。这个值是实例在启动时,Oracle创建的并行执行进程数。

ITPUB个人空间ir L,A(^7h,`3O0Z1h-m2S

PARALLEL_THREADS_PER_CPU

PropertyDescription
Parameter type Integer
Default value Operating system-dependent, usually 2
Modifiable ALTER SYSTEM
Range of values Any nonzero number
ITPUB个人空间{ VV0[5H;[3[

Note:

This parameter applies to parallel execution in exclusive mode as well as in a Real Application Clusters environment.

PARALLEL_THREADS_PER_CPU specifies the default degree of parallelism for the instance and determines the parallel adaptive and load balancing algorithms. The parameter describes the number of parallel execution processes or threads that a CPU can handle during parallel execution.ITPUB个人空间bMA0w1IXB"Vh
PARALLEL_THREADS_PER_CPU指定实例默认的并行度,确定合适的并行和负载均衡算法。这个参数描述并行执行进程数,或者在并行执行期间CPU能处理的线程数。

The default is platform-dependent and is adequate in most cases. You should decrease the value of this parameter if the machine appears to be overloaded when a representative parallel query is executed. You should increase the value if the system is I/O bound.
2?0V8C(pRk#M v0默认值依赖于平台,在大多数情况下都是合适的。当执行一个典型的并行查询时,服务器出现过载的情况,应该减少这个参数的值。如果系统在I/O的边界应该增加这个值。


0_lu3?$f'x4@0在并行参数方面,有以下最佳实践:
CL ru8i\%@r0
Lk ^)f Uq,D;e0

  • 确保监控活动并行服务器进程的数量并计算要应用于 PARALLEL_MIN_SERVERS 的平均值。可通过以下操作完成:
Select * from v$pq_syssstat;ITPUB个人空间C%q8|L Vn`
Then: Get/save the value for row "Servers Highwater"
  • 根据您的硬件情况优化PARALLEL_MAX_SERVERS的值。最开始可以使用 (2 * ( 2 个线程 ) *(CPU_COUNT)) = 4 x CPU 计算,然后使用测试数据对更高的值重复测试。
  • 考虑设置FAST_START_PARALLEL_ROLLBACK。此参数可确定将有多少个进程用于事务恢复(在 redo 应用后执行)。为了确保在出现计划外故障后仍能获得高效的工作负载,优化事务恢复显得非常重要。只要系统不大量占用 CPU,最佳实践是将此参数设置为值“HIGH”。这会导致 Oracle 使用四倍于 CPU 个数 (4 X cpu_count) 的并行进程进行事务恢复。此参数的默认值是“LOW”,或两倍的 CPU 计数 (2 X cpu_count)。
  • 对于 11gR2 之前的版本,将PARALLEL_EXECUTION_MESSAGE_SIZE从默认值(通常为 2048)增加到 8192。对于基于数据仓库的系统(通过 PQ 传输大量数据),可以将其设置的更高。在版本 11gR2 中,PARALLEL_EXECUTION_MESSAGE_SIZE的默认值是 16K,经证明,该值在大多数情况下都能够满足要求。

ITPUB个人空间%qL3d2d7w H$@O u)KP
参考文章:《RAC 和 Oracle Clusterware 最佳实践和初学者指南(平台无关部分) [ID 1526083.1]

ITPUB个人空间@w-[,{ L$e-lvw9`$u

&J)xF.S.x9]/p0告警日志:ITPUB个人空间R+aH1m P;x
在某些数据库启动的时候还能从告警日志的最开始位置看到以下的信息:ITPUB个人空间5G!?])[9Q|&{
Tue May 07 23:38:27 2013 Adjusting the default value of parameter parallel_max_servers from 1280 to 985 due to the value of parameter processes (1000) Starting ORACLE instance (normal)ITPUB个人空间9c%k'|2|/^#{^1^
ITPUB个人空间!O%s.b1scG t.CX7U5a
出现此告警的原因是默认计算出的parallel_max_server的值1280超过了process的最大值1000,动态调整到小于process的值。!A*O#L*Y]8p"S3T0ITPUB个人空间'|L z.BKO

zw ncR3] ^m0--end--

相关内容