Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

rekharaghuram
from rekharaghuram More from this publisher
05.11.2015 Views

CHAPTER 5 ■ ORACLE PROCESSES 169 everybody (including the last person) gets through the door, the queued model (shared server) performs better than a free-for-all approach (even with polite people; but conjure up the image of the doors opening when a store has a large sale, with everybody pushing very hard to get through). Reduces the Memory Needed on the System This is one of the most highly touted reasons for using shared server: it reduces the amount of required memory. It does, but not as significantly as you might think, especially given the new automatic PGA memory management discussed in Chapter 4, where work areas are allocated to a process, used, and released—and their size varies based on the concurrent workload. So, this was a fact that was truer in older releases of Oracle but is not as meaningful today. Also, remember that when you use shared server, the UGA is located in the SGA. This means that when switching over to shared server, you must be able to accurately determine your expected UGA memory needs and allocate appropriately in the SGA, via the LARGE_POOL_SIZE parameter. So, the SGA requirements for the shared server configuration are typically very large. This memory must typically be preallocated and, thus, can only be used by the database instance. ■Note It is true that with a resizable SGA, you may grow and shrink this memory over time, but for the most part, it will be “owned” by the database instance and will not be usable by other processes. Contrast this with dedicated server, where anyone can use any memory not allocated to the SGA. So, if the SGA is much larger due to the UGA being located in it, where do the memory savings come from? They comes from having that many fewer PGAs allocated. Each dedicated/shared server has a PGA. This is process information. It is sort areas, hash areas, and other process-related structures. It is this memory need that you are removing from the system by using shared server. If you go from using 5,000 dedicated servers to 100 shared servers, it is the cumulative sizes of the 4,900 PGAs (excluding their UGAs) you no longer need that you are saving with shared server. Dedicated/Shared Server Wrap-Up Unless your system is overloaded, or you need to use a shared server for a specific feature, a dedicated server will probably serve you best. A dedicated server is simple to set up (in fact, there is no setup!) and makes tuning easier. ■Note With shared server connections, a session’s trace information (SQL_TRACE=TRUE output) may be spread across many individual trace files, and reconstructing what that session has done is made more difficult.

170 CHAPTER 5 ■ ORACLE PROCESSES If you have a very large user community and know that you will be deploying with shared server, I would urge you to develop and test with shared server. It will increase your likelihood of failure if you develop under just a dedicated server and never test on shared server. Stress the system, benchmark it, and make sure that your application is well behaved under shared server. That is, make sure it does not monopolize shared servers for too long. If you find that it does so during development, it is much easier to fix than during deployment. You can use features such as the Advanced Queuing (AQ) to turn a long-running process into an apparently short one, but you have to design that into your application. These sorts of things are best done when you are developing. Also, there have historically been differences between the feature set available to shared server connections versus dedicated server connections. We already discussed the lack of automatic PGA memory management in Oracle 9i, for example, but also in the past things as basic as a hash join between two tables were not available in shared server connections. Background Processes The Oracle instance is made up of two things: the SGA and a set of background processes. The background processes perform the mundane maintenance tasks needed to keep the database running. For example, there is a process that maintains the block buffer cache for us, writing blocks out to the data files as needed. Another process is responsible for copying an online redo log file to an archive destination as it fills up. Yet another process is responsible for cleaning up after aborted processes, and so on. Each of these processes is pretty focused on its job, but works in concert with all of the others. For example, when the process responsible for writing to the log files fills one log and goes to the next, it will notify the process responsible for archiving that full log file that there is work to be done. There is a V$ view you can use to see all of the possible Oracle background processes and determine which ones are currently in use in your system: ops$tkyte@ORA9IR2> select paddr, name, description 2 from v$bgprocess 3 order by paddr desc 4 / PADDR NAME DESCRIPTION -------- ---- ------------------------------------------------------------ 5F162548 ARC1 Archival Process 1 5F162198 ARC0 Archival Process 0 5F161A38 CJQ0 Job Queue Coordinator 5F161688 RECO distributed recovery 5F1612D8 SMON System Monitor Process 5F160F28 CKPT checkpoint 5F160B78 LGWR Redo etc. 5F1607C8 DBW0 db writer process 0 5F160418 PMON process cleanup 00 DIAG diagnosibility process 00 FMON File Mapping Monitor Process 00 LMON global enqueue service monitor

170<br />

CHAPTER 5 ■ ORACLE PROCESSES<br />

If you have a very large user community <strong>and</strong> know that you will be deploying with shared<br />

server, I would urge you to develop <strong>and</strong> test with shared server. It will increase your likelihood<br />

of failure if you develop under just a dedicated server <strong>and</strong> never test on shared server. Stress<br />

the system, benchmark it, <strong>and</strong> make sure that your application is well behaved under shared<br />

server. That is, make sure it does not monopolize shared servers for too long. If you find that it<br />

does so during development, it is much easier to fix than during deployment. You can use features<br />

such as the Advanced Queuing (AQ) to turn a long-running process into an apparently<br />

short one, but you have to design that into your application. These sorts of things are best<br />

done when you are developing. Also, there have historically been differences between the<br />

feature set available to shared server connections versus dedicated server connections. We<br />

already discussed the lack of automatic PGA memory management in <strong>Oracle</strong> 9i, for example,<br />

but also in the past things as basic as a hash join between two tables were not available in<br />

shared server connections.<br />

Background Processes<br />

The <strong>Oracle</strong> instance is made up of two things: the SGA <strong>and</strong> a set of background processes. The<br />

background processes perform the mundane maintenance tasks needed to keep the database<br />

running. For example, there is a process that maintains the block buffer cache for us, writing<br />

blocks out to the data files as needed. Another process is responsible for copying an online<br />

redo log file to an archive destination as it fills up. Yet another process is responsible for cleaning<br />

up after aborted processes, <strong>and</strong> so on. Each of these processes is pretty focused on its job,<br />

but works in concert with all of the others. For example, when the process responsible for<br />

writing to the log files fills one log <strong>and</strong> goes to the next, it will notify the process responsible<br />

for archiving that full log file that there is work to be done.<br />

There is a V$ view you can use to see all of the possible <strong>Oracle</strong> background processes <strong>and</strong><br />

determine which ones are currently in use in your system:<br />

ops$tkyte@ORA9IR2> select paddr, name, description<br />

2 from v$bgprocess<br />

3 order by paddr desc<br />

4 /<br />

PADDR NAME DESCRIPTION<br />

-------- ---- ------------------------------------------------------------<br />

5F162548 ARC1 Archival Process 1<br />

5F162198 ARC0 Archival Process 0<br />

5F161A38 CJQ0 Job Queue Coordinator<br />

5F161688 RECO distributed recovery<br />

5F1612D8 SMON System Monitor Process<br />

5F160F28 CKPT checkpoint<br />

5F160B78 LGWR Redo etc.<br />

5F1607C8 DBW0 db writer process 0<br />

5F160418 PMON process cleanup<br />

00 DIAG diagnosibility process<br />

00 FMON File Mapping Monitor Process<br />

00 LMON global enqueue service monitor

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!