Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005
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
- Page 164 and 165: CHAPTER 4 ■ MEMORY STRUCTURES 119
- Page 166 and 167: CHAPTER 4 ■ MEMORY STRUCTURES 121
- Page 168 and 169: CHAPTER 4 ■ MEMORY STRUCTURES 123
- Page 170 and 171: CHAPTER 4 ■ MEMORY STRUCTURES 125
- Page 172 and 173: CHAPTER 4 ■ MEMORY STRUCTURES 127
- Page 174 and 175: CHAPTER 4 ■ MEMORY STRUCTURES 129
- Page 176 and 177: CHAPTER 4 ■ MEMORY STRUCTURES 131
- Page 178 and 179: CHAPTER 4 ■ MEMORY STRUCTURES 133
- Page 180 and 181: CHAPTER 4 ■ MEMORY STRUCTURES 135
- Page 182 and 183: CHAPTER 4 ■ MEMORY STRUCTURES 137
- Page 184 and 185: CHAPTER 4 ■ MEMORY STRUCTURES 139
- Page 186 and 187: CHAPTER 4 ■ MEMORY STRUCTURES 141
- Page 188 and 189: CHAPTER 4 ■ MEMORY STRUCTURES 143
- Page 190 and 191: CHAPTER 4 ■ MEMORY STRUCTURES 145
- Page 192 and 193: CHAPTER 4 ■ MEMORY STRUCTURES 147
- Page 194 and 195: CHAPTER 4 ■ MEMORY STRUCTURES 149
- Page 196 and 197: CHAPTER 4 ■ MEMORY STRUCTURES 151
- Page 198 and 199: CHAPTER 4 ■ MEMORY STRUCTURES 153
- Page 200 and 201: CHAPTER 5 ■ ■ ■ Oracle Proces
- Page 202 and 203: CHAPTER 5 ■ ORACLE PROCESSES 157
- Page 204 and 205: CHAPTER 5 ■ ORACLE PROCESSES 159
- Page 206 and 207: CHAPTER 5 ■ ORACLE PROCESSES 161
- Page 208 and 209: CHAPTER 5 ■ ORACLE PROCESSES 163
- Page 210 and 211: CHAPTER 5 ■ ORACLE PROCESSES 165
- Page 212 and 213: CHAPTER 5 ■ ORACLE PROCESSES 167
- Page 216 and 217: CHAPTER 5 ■ ORACLE PROCESSES 171
- Page 218 and 219: CHAPTER 5 ■ ORACLE PROCESSES 173
- Page 220 and 221: CHAPTER 5 ■ ORACLE PROCESSES 175
- Page 222 and 223: CHAPTER 5 ■ ORACLE PROCESSES 177
- Page 224 and 225: CHAPTER 5 ■ ORACLE PROCESSES 179
- Page 226 and 227: CHAPTER 5 ■ ORACLE PROCESSES 181
- Page 228 and 229: CHAPTER 6 ■ ■ ■ Locking and L
- Page 230 and 231: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 232 and 233: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 234 and 235: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 236 and 237: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 238 and 239: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 240 and 241: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 242 and 243: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 244 and 245: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 246 and 247: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 248 and 249: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 250 and 251: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 252 and 253: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 254 and 255: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 256 and 257: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 258 and 259: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 260 and 261: CHAPTER 6 ■ LOCKING AND LATCHING
- Page 262 and 263: CHAPTER 6 ■ LOCKING AND LATCHING
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