Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Programming PL SQL.doc
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
5 Мб
Скачать
☆

20.7.2 The Symmetric Multiprocessor (smp) Variation

the next level of sophistication in server hardware is to have two or more CPUs inside a single computer, but with the CPUs sharing memory, disk, and other I/O pathways. In this arrangement, a single operating system manages all processors, which share access to disks, memory, and other input/output devices. It's called symmetric because any CPU can perform any task assigned by the operating system.[9]

[9] Asymmetric computers, which assign different tasks such as disk I/O or network I/O to different processors, are virtually nonexistent these days.

As it turns out, though, some kinds of tasks are much more likely than others to benefit from parallel processing. If your PL/SQL program includes a SQL statement that sorts a million-row table, that is a good candidate, but one that retrieves one record via an indexed lookup is not. In general, good candidates are operations that are common in decision support systems (DSS) as opposed to those in online transaction processing (OLTP).

So, let's say that you've purchased an SMP machine that includes an SMP-aware operating system, licensed Oracle's Enterprise edition or Personal edition, and built a very large data warehouse. Now you write a PL/SQL program. Will this program enjoy all the benefits of symmetric multiprocessing? It depends. Your program must meet some very specific requirements:

  • The program must be a function, not a procedure or an anonymous block.

  • You must call the function from a SQL statement that the Oracle optimizer would otherwise want to execute in parallel.

  • The function must not attempt to change data in the database via INSERT, UPDATE, or DELETE statements (and no, you can't get around this requirement by having it call another program to do so).

  • The function must not read or modify any package data. This is because there is no way to share state information among the multiple instances of the program that are running in parallel.

The bottom line is that, yes, Oracle can distribute portions of a PL/SQL program to run on multiple processors, but only if it's a computational program that runs as a "helper" to a SQL statement. Chapter 16 contains more details about parallelizing stored funtions.

20.7.3 The Clustered Variation

Clustering is a way to join multiple computers, each with its own CPU and memory, so that they can divide and conquer large jobs. Prior to Oracle9i, the optional feature for this was named Oracle Parallel Server (OPS). As of Oracle9i, the new and improved technology is known as Real Application Clusters (RAC). With both technologies, Oracle runs separate instances on each machine in the cluster, and these instances communicate among themselves to respond to application requests while sharing a common database on disk.

One of Oracle's advertised improvements of RAC over OPS is the ease with which applications can take advantage of the extra hardware. Oracle marketing literature asserts that you can "scale up your applications without changing a line of code." However, the fine print says that you may first need to do two things:

  • Design the database to take advantage of RAC

  • Partition the application to distribute the workload

Then, as the database grows in size, you should be able to scale by adding another node to the cluster. If the number of users grows, though, you may need to repartition the application. To tell you the truth, I have not had a chance to test any of Oracle's claims in this area.

Another advertised benefit of running Oracle on clustered computers is increased availability—the database will keep running even if one of the computers in the cluster goes belly-up. With OPS or RAC, some of these benefits are available automatically, while deeper support (such as transparently preserving a user's session and even preserving incomplete transactions) requires configuring additional database features. Through Oracle8i, the relevant feature was called Oracle Parallel Fail Safe, but in Oracle9i it was replaced by Real Application Clusters Guard. These topics, while extremely important to some sites, are outside the scope of this book, so check Oracle's documentation for more information.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]