maclean
2011-05-23
<ul>
<li><strong>What is the purpose of I/O slaves?</strong></li>
</ul>
<dl>
<dd>I/O Slaves are specialized processes whose only function is to perform I/O . In Oracle7, all File I/O OSDs are blocking. The only exception is the OSD used by the direct loader. In this case, the direct loader asks for asynchronous I/O. In case the platform does not support asynchronous I/O, the direct loader has to revert to synchronous I/O.<br>
</dd>
<dd>In Oracle8, the file I/O interface was reworked to provide non-blocking I/O calls for its clients. I/O slaves can be used to provide non-blocking I/O requests even if the platform does not support asynchronous I/O. Many platforms that do support asynchronous I/O for disk devices, may not do so for tape devices. Even in this case, I/O slaves can be used to do non-blocking I/O to tape devices. Under heavy loads, the Database Writer may need additional processes to do some of the I/O. In Oracle7, DBWR would use multiple processes to do I/Os on its behalf. In Oracle8, DBWR would use I/O slaves instead. I/O slaves can be deployed by the DBWR, LGWR, ARCH or the processes doing Backup. </dd>
</dl>
<ul>
<li><strong>Why the change from Oracle7?</strong></li>
</ul>
<dl>
<dd>In Oracle7, "I/O slaves" were implemented at the OSD level specifically for DBWR in the form of multiple db_writers. The need existed to make the feature more general. This prompted the design of Oracle8 I/O slaves, which can be used theoretically by any server process. However, access to I/O slaves is restricted to DBWR, LGWR, ARCH and processes performing Backups, since it is not clear if any other process can take advantage of the I/O slaves.</dd>
</dl>
<ul>
<li><strong>What are initialization parameters that control I/O slave deployment?</strong></li>
</ul>
<dl>
<dd>In Oracle8, the following parameters are significant:<br>
</dd>
</dl>
<center>
<table border="3" cellpadding="3">
<tbody>
<tr>
<th>Parameter</th>
<th>Possible Values</th>
<th>Default</th>
</tr>
<tr>
<td>dbwr_io_slaves</td>
<td>0..>100</td>
<td>0</td>
</tr>
<tr>
<td>lgwr_io_slaves</td>
<td>0..>100</td>
<td>0</td>
</tr>
<tr>
<td>arch_io_slaves</td>
<td>0..>100</td>
<td>0</td>
</tr>
<tr>
<td>backup_disk_io_slaves</td>
<td>0..>100</td>
<td>0</td>
</tr>
<tr>
<td>backup_tape_io_slaves</td>
<td>TRUE/FALSE</td>
<td>FALSE</td>
</tr>
<tr>
<td>_io_slaves_disabled</td>
<td>TRUE/FALSE</td>
<td>FALSE</td>
</tr>
<tr>
<td>disk_asynch_io</td>
<td>TRUE/FALSE</td>
<td>TRUE</td>
</tr>
<tr>
<td>tape_asynch_io</td>
<td>TRUE/FALSE</td>
<td>TRUE</td>
</tr>
</tbody>
</table>
</center>
<ul>
<li><strong>What is the purpose of the parameters disk_asynch_io and tape_asynch_io?</strong></li>
</ul>
<dl>
<dd>It may be necessary to turn off the OS provided asynchronous I/O facility. For example, if the platform's asynchronous I/O code has bugs or is not efficient. Asynchronous I/O can be disabled on a "per device type" basis. These parameters are now generic parameters, and replace all platform-specific parameters from Oracle7, such as use_async_io, async_read, and async_write.</dd>
</dl>
<ul>
<li><strong>Are slaves allocated dynamically as needed, or at instance startup?</strong></li>
</ul>
<dl>
<dd>I/O slaves for DBWR are allocated immediately following database open when the first I/O request is made. For example, if the parameter dbwr_io_slaves=4, four I/O slaves will be spawned for the DBWR. Other I/O slaves (for LGWR, ARCH, and backup processes) are dynamically allocated on an as needed basis. This deployment method may change in the future, such that I/O slaves may be deployed upon Instance startup.</dd>
</dl>
<ul>
<li><strong>If dynamic, once allocated, do they ever exit?</strong></li>
</ul>
<dl>
<dd>I/O slaves for DBWR and LGWR do not exit. Inactive I/O slaves for ARCH and backup processes exit.</dd>
</dl>
<ul>
<li><strong>How is a slave determined to be "inactive"? Is there a timeout value?</strong></li>
</ul>
<dl>
<dd>An I/O slave determines that it is inactive if it has been idle for 60 seconds.</dd>
</dl>
<ul>
<li><strong>Are they sent a signal from another process, or do they exit on their own?</strong></li>
</ul>
<dl>
<dd>If an I/O slave finds that it has reached the threshold of inactive period, then it exits on its own by signalling OER(448).</dd>
</dl>
<ul>
<li><strong>What is the max number of slaves?</strong></li>
<li><strong>Whose responsibility is it to spawn a slave?</strong></li>
</ul>
<dl>
<dd>Whoever is issuing the I/O. For example, DBWR, or a foreground process.</dd>
</dl>
<ul>
<li><strong>How does the file I/O subsystem "recognize" the need for a slave?</strong></li>
</ul>
<dl>
<dd>The I/O issuing process looks for an idle I/O slave. If one is available, that I/O slave will get a post. If there are no idle slaves, then the I/O issuer will spawn one. If the allowed number of slaves have been spawned, then the issuer waits and tries again to find an idle slave. </dd>
</dl>
<ul>
<li><strong>Given a DBWR slave, does the DBWR process do any work, or just the slave(s)?</strong></li>
</ul>
<dl>
<dd>DBWR continues to do all the DBWR related work. Further, the DBWR process initiates the I/O. The DBWR's I/O slave simply does the I/O on DBWR's behalf. </dd>
</dl>
<ul>
<li><strong>What is the slave process naming convention?</strong></li>
</ul>
<ul>
<dt>The slave process name is <em>ora_<strong>iNnn</strong>_<SID></em> where:</dt>
<center>
<table border="3" cellpadding="3">
<tbody>
<tr>
<th><em>iNnn</em></th>
<th>Description</th>
<th>Possible Values</th>
</tr>
<tr align="CENTER">
<td>i</td>
<td align="LEFT">Denotes this is an I/O slave</td>
<td>"i"</td>
</tr>
<tr align="CENTER">
<td>N</td>
<td align="LEFT">I/O adaptor number</td>
<td>1..F</td>
</tr>
<tr align="CENTER">
<td>nn</td>
<td align="LEFT">Slave number</td>
<td>01..0z,<br>
10..zz</td>
</tr>
</tbody>
</table>
</center>
<p>Once slave number 0z is spawned, the next slaves are 10, 11, 12, ... As an example, if dbwr_io_slaves=15, the following process will be started:</p>
<p>ora_i101_SID ora_i102_SID ora_i103_SID ora_i104_SID<br>
ora_i105_SID ora_i106_SID ora_i107_SID ora_i108_SID<br>
ora_i109_SID ora_i10a_SID ora_i10b_SID ora_i10c_SID<br>
ora_i10d_SID ora_i10e_SID ora_i10f_SID</p>
</ul>
<ul>
<li><strong>Will a process like DBWR always use the same adaptor number? Or rephrased, given a process ora_i031_<SID>, what process is this slave doing I/O for?</strong></li>
</ul>
<dl>
<dd>A process may not necessarily always use the same adaptor number.</dd>
</dl>
<ul>
<li><strong>What mechanism do the slaves use to communicate with the master?</strong></li>
</ul>
<dl>
<dd>If a process wants to use I/O slaves to do its I/O, then the I/O buffers must be in shared memory.</dd>
</dl>
<ul>
<li><strong>Is there a need for I/O slaves if async I/O is available?</strong></li>
</ul>
<dl>
<dd>The short answer is no. However, if the system is very large, and the DBWR is falling behind, then one could consider using the I/O slaves.</dd>
<dd>Note, I/O slaves can do asynchronous I/O. In other words, the deployment of I/O slaves is orthogonal to availability of asynchronous I/Os in the system.</dd>
</dl>
<ul>
<li><strong>What concerns are there running I/O slaves even if async I/O is available?</strong></li>
</ul>
<ul>
<li>You end up using shared memory, when you could have used process private memory</li>
<li>Communication overheads </li>
<li>Processing overheads (plus context switches)</li>
</ul>
<ul>
<li><strong>Will each slave use async I/O individually?</strong></li>
</ul>
<dl>
<dd>Yes</dd>
</dl>
<ul>
<li><strong>If a platform supports async I/O to raw devices only, will I/O to raw be done async, and I/O to the filesystem be done sync?</strong></li>
</ul>
<dl>
<dd>IO slaves use the same algorithm as direct IO adaptor. If the platform supports asynchronous IO to the target device (or file) then IO will be done asynchronously.</dd>
</dl>
<ul>
<li><strong>Can I/O slaves be used with List I/O?</strong></li>
</ul>
<dl>
<dd>Yes.</dd>
</dl>
<ul>
<li><strong>What part of the SGA is used for backup/restore slaves?</strong></li>
</ul>
<dl>
<dd>The variable part of the SGA.</dd>
</dl>
<ul>
<li><strong>I'm most interested in the "separate 'pool' of SGA memory". How large will this pool be and how will it affect the size of the SGA?</strong></li>
</ul>
<dl>
<dd>Backup process will use PGA memory if it is not using any IO slaves. However, the backup process will use SGA, if it were to use IO slaves. In either case, the size of the memory used is proportional to: </dd>
</dl>
<ul>
<li>number of files that are opened at any time </li>
<li>number of files being backed up</li>
</ul>
<ul>
<li><strong>Does it depend on the number of possible I/O slaves?</strong></li>
</ul>
<dl>
<dd>No.</dd>
</dl>
<ul>
<li><strong>Is this separate pool allocated when the slave(s) is allocated, or at instance startup?</strong></li>
</ul>
<dl>
<dd>The pool is allocated when the backup process is ready to do IO.</dd>
</dl>
<ul>
<li><strong>Are there any concerns in using I/O slaves if using MTS?</strong></li>
</ul>
<dl>
<dd>No.</dd>
</dl>
<ul>
<li><strong>What's the recommended settings for <adaptor>_io_slaves?</strong></li>
</ul>
<dl>
<dd>The general recommendation is: set the value to 2, if the I/O activity is expected to be moderate. Set it to 4, if you expect a lot of I/O activity. Simulating asynchronous I/O behavior is not free. So, deployment of I/O slaves should be done carefully. I cannot stress this point enough.</dd>
</dl>
<ul>
<li><strong>How can the performance of I/O slaves be monitored?</strong></li>
</ul>
<dl>
<dd>Use v$sesstat, looking at physical writes, physical reads, logical reads, write requests. Use v$sess_io and v$filestat to correlate these numbers.</dd>
</dl>
<ul>
<li><strong>How do backup_io_slaves work with multiple channels?</strong></li>
</ul>
<dl>
<dd>Each channel will get its own set of slaves, because each channel has its own Oracle session. Within each channel, there may be separate ksfq contexts allocated for reading and writing, both of which will share the same ksfh context and the same set of I/O slaves.</dd>
</dl>
<ul>
<li><strong>How are they used to improve backup performance?</strong></li>
</ul>
<dl>
<dd>If the platform does not provide async I/O, then slaves are used to simulate async I/O. Rather than blocking on each file read, backup can process the buffers for one file while the slaves are filling the buffers for other files. If there are enough files and enough slaves, then we should be able to keep a tape streaming. If we have neither slaves nor async I/O, then there is no performance benefit to multi-plexing datafiles.</dd>
</dl>
<ul>
<li><strong>Are they used for restore and application of incrementals?</strong></li>
</ul>
<dl>
<dd>Yes, for both restore and application. Both reading to tape and writing to disk will share the same set of I/O slaves.</dd>
</dl>