search
HomeDatabaseMysql Tutorial用Oracle并行查询发挥多CPU的威力

用Oracle并行查询发挥多CPU的威力

正在看的ORACLE教程是:用Oracle并行查询发挥多CPU的威力。参数

  让我们进一步看看CPU的数量是如何影响这些参数的。

  参数fast_start_parallel_rollback

  Oracle并行机制中一个令人兴奋之处是在系统崩溃时调用并行回滚得能力。当Oracle数据库发生少有的崩溃时,Oracle能自动检测未完成的事务并回滚到起始状态。这被称为并行热启动,而Oracle使用基于cpu_count的fast_start_parallel_rollback参数来决定未完成事务的秉性程度。

  并行数据操纵语言(DML)恢复能够在Oracle数据库崩溃后极大地加快其重新启动的速度。此参数的默认值是系统CPU数量的两倍,但是一些DBA们认为应该将这个值设置为cpu_count的四倍。

  参数parallel_max_servers_parameter

  Oracle一个显著的加强是自动决定OPQ并行的程度。由于Oracle清楚服务器中CPU的数量,它会自动分配合适的子进程的数量来提升并行查询的响应时间。当然,会有其它的外部因素,比如表的划分以及磁盘输入/输出子系统的布局等,但是根据cpu_count来设置parallel_max_servers参数将给Oracle一个合理的依据来选择并行的程度。

  由于Oracle的并行操作严重依赖服务器上CPU的数量,parallel_max_servers会被设置成服务器上CPU的数量。如果在一台服务器上运行多个实例,则默认值太大了,会导致过度的页面交换和严重的CPU负担。并行的程度还依赖于目标表中分区的数量,因此parallel_max_servers应该设置成足够大以允许Oracle为每个查询选择最佳数量的并行子查询。

  参数log_buffer

  参数log_buffer定义了供即刻写入redo日志信息的保留RAM的数量,这个参数受cpu_count的影响。Oracle推荐log_buffer最大为cpu_count乘以500KB或128KB。CPU的数量对于log_buffer来说非常重要,因为Oracle会生成多日志写入(LGWR)进程来异步释放redo信息。

  log_buffer是Oracle中最易误解的的RAM参数之一,通常存在下面几个配置错误:

log_buffer被设置得太高(例如,大于1MB),这回引起性能问题,因为大容量的结果会使得写入同步进行(例如,日志同步等待事件非常高)。

log_buffer 在一个单独的服务器中安装更多的CPU成为目前的一个趋势。使用对称多处理服务器(SMP)的情况下,一个Oracle服务器拥有8个、16个或32个CPU以及几吉比特RAM的SGA都不足为奇。

  Oracle跟上了硬件发展的步伐,提供了很多面向多CPU的功能。从Oracle8i开始,Oracle在每个数据库函数中都实现了并行性,包括SQL访问(全表检索)、并行数据操作和并行恢复。对于Oracle专业版的挑战是为用户的数据库配置尽可能多的CPU。

  在Oracle环境中实现并行性最好的方法之一是使用Oracle并行查询(OPQ)。我将讨论OPQ是如何工作的和怎样用它来提升大的全表检索的响应时间以及调用并行事务回滚等等。

  使用OPQ

  当在Oracle中进行一次合法的、大型的全表检索时,OPQ能够极大地提高响应时间。通过OPQ,Oracle将表划分成如A所示的逻辑块。

  图 A



  由OPQ划分的表

  一旦表被划分成块,Oracle启用并行的子查询(有时称为杂务进程),每个子查询同时读取一个大型表中的一块。所有子查询完毕以后,Oracle将结果会传给并行查询调度器,它会重新安排数据,如果需要则进行排序,并且将结果传递给最终用户。OPQ具有无限的伸缩性,因此,以前需要花费几分钟的全表检索现在的响应时间却不到1秒。

  OPQ严重依赖于处理器的数量,通过并行运行之所以可以极大地提升全表检索的性能,其前提就是使用了N-1个并行进程(N=Oracle服务器上CPU的数量)。

  必须注意非常重要的一点,即Oracle9i能够自动检测外部环境,包括服务器上CPU的数量。在安装时,Oracle9i会检查服务器上CPU的数量,设置一个名为cpu_count的参数,并使用cpu_count作为默认的初始化输入参数。这些初始化参数会影响到Oracle对内部查询的处理。

  下面就是Orale在安装时根据cpu_count而设置的一些参数:
  • fast_start_parallel_rollback
  • parallel_max_servers
  • log_buffer
  • db_block_lru_latches

[NextPage]


不是db_block_size的倍数。在的Oracle9i中,log_buffer应该是2048字节的倍数。

  参数db_block_lru_latches

  LRU锁的数量是在Oracle数据库内部用来管理数据库缓冲的,这严重依赖于服务器上CPU的数量。

  很多聪明的Oracle9i的DBA使用多冲数据缓冲(例如db_32k_cache_size),他们推荐将这个未公开声明的参数重设置为默认的最大值。db_block_lru_latches参数在Oracle8i中使用得很多,但是在Oracle9i中变成了一个未公开声明的参数,因为Oracle现在根据数据库拥有的CPU数量设置了一个合理的默认值。

  db_block_lru_latches默认被设置为服务器上cpu_count的一半(例如服务器上只有一个Oracle数据库)。Oracle推荐db_block_lru_latches千万不要超过cpu_count的两倍或三倍,或db_block_buffers的五十分之一。

  如果使用多缓冲池则这种计算方法有一个问题,因为不能控制分配给每个数据缓冲池的锁的数量。如果db_writers参数大于1,则默认值或许显得太小。

  加强服务器

  Oracle数据库总是在提升性能,根据外部服务器环境检测cpu_count和基本参数设置的能力对于Oracle软件来说是一个重要的加强。

  随着更多的Oracle系统转移到SMP上来,当客户要采取增强措施并将众多的数据库转移到拥有32个或64个CPU的巨大服务器上来的时候,这些参数显得愈发重要。

上一页

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.