本译文翻译自Net Services Administrator's Guide的第14章Optimizing Performance中对于SDU的介绍。 在一个典型数据库配置中,Oracle Net在通过网络发送数据前将数据按照SDU大小放进缓存。Oracle Net当缓存被填满,flushed或者当应用尝试去读取数据的时候发送。调整有关于Oracle Net发送数据的SDU大小可以优化性能、网络利用率、内存消耗。当大量的数据被传输,增大SDU大小可以优化性能和网络吞吐量。 Oracle Net发送的总数据被称作信息量。Oracle Net默认假定信息大小介于0到8192b,极少比8192b大。如果这个设定是正确的,那么大多数时间,被传送的数据为一个SDU大小。 SDU大小可以介于512-65535间。对于客户端和专用服务的默认SDU大小是8192b。对于共享服务,SDU默认大小是65535b。 实际的SDU大小在连接时取客户端及服务器设置值得最小值。如果使用的不是共享服务,那么配置不同于默认值得SDU需要同时在客户端和服务端设置。对于共享服务模式,因为服务器端默认是最大值,所以只需要设置客户端的值即可。 当分配的信息大小不是8192的时候,就需要考虑修改SDU大小了。SDU大小应该比分配的信息大小大70b。如果分配的信息大小加70b超过了最大SDU设置,那么SDU就需要调整到比每个信息大小大70b。修改默认SDU大小,在sqlnet.ora文件中改变DEFAULT_SDU_SIZE参数值。 例如,如果应用多数发送及接受到的信息小于8k,那么将70b考虑在内,将SDU设置为8k是个不错的选择。如果内存允许,那么可以使用SDU最大值以最小化对于Oracle Net Services的系统调用。 数据库设置SDU大小: 配置文件: 1.sqlnet.ora 设置DEFAULT_SDU_SIZE参数,例如: DEFAULT_SDU_SIZE=8192 2.初始化参数文件 如果使用共享服务进程,那么在初始化参数文件中设置DISPATCHERS参数值,如下: DISPATCHERS="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp))(SDU=8192))" 3.listener.ora 如果在listener.ora文件中设置了目标主机的列表,那么在独占服务进程中,该文件中的SID_LIST中的SDU参数值将覆盖在sqlnet.ora文件中的设置值。 SID_LIST_listener_name= (SID_LIST= (SID_DESC= (SDU=8192) (SID_NAME=sales))) 在客户端设置SDU值: 1.sqlnet.ora 设置DEFAULT_SDU_SIZE参数,例如: DEFAULT_SDU_SIZE=8192 2.tnsnames.ora 针对特定的连接,可以在DESCRIPTION中设置SDU参数 name= (DESCRIPTION= (SID=11280) (ADDRESS=(PROTOCOL=tcp)(HOST=host_ip)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=srv_name)) ) 因为怕翻译有问题,下面给出原文: Configuring Session Data Unit Under typical database configuration, Oracle Net encapsulates data into buffers the size of the session data unit (SDU) before sending the data across the network. Oracle Net sends each buffer when it is filled, flushed, or when an application tries to read data. Adjusting the size of the SDU buffers relative to the amount of data provided to Oracle Net to send at any one time can improve performance, network utilization, and memory consumption. When large amounts of data are being transmitted, increasing the SDU size can improve performance and network throughput. The amount of data provided to Oracle Net to send at any one time is referred to as the message size. Oracle Net assumes by default that the message size will normally vary between 0 and 8192 bytes, and infrequently, be larger than 8192 bytes. If this assumption is true, then most of the time, the data is sent using one SDU buffer. The SDU size can range from 512 bytes to 65535 bytes. The default SDU for the client and a dedicated server is 8192 bytes. The default SDU for a shared server is 65535 bytes. The actual SDU size used is negotiated between the client and the server at connect time and is the smaller of the client and server values. Configuring an SDU size different from the default requires configuring the SDU on both the client and server computers, unless you are using shared servers. For shared servers, only the client value must be changed because the shared server defaults to the maximum value. You should consider changing the SDU size when the predominant message size is smaller or larger than 8192. The SDU size should be 70 bytes larger than the predominant message size. If the predominant message size plus 70 bytes exceeds the maximum SDU, then the SDU should be set such that the message size is divided into the smallest number of equal parts where each part is 70 bytes less than the SDU size. To change the default, change the DEFAULT_SDU_SIZE parameter in the sqlnet.ora file. Configuring Session Data Unit 14-2 Oracle Database Net Services Administrator's Guide For example, if the majority of the messages sent and received by the application are smaller than 8KB, taking into account the 70 bytes for overhead, then setting the SDU to 8KB will likely produce good results. If sufficient memory is available, then using the maximum value for the SDU minimizes the number of system calls and overhead for Oracle Net Services. Note: Starting with Oracle Database 11 g, Oracle Net Services optimized bulk data transfer for components, such as Oracle SecureFiles LOBs and Oracle Data Guard redo transport services. The SDU size limit, as specified in the network parameter files, does not apply to these bulk data transfers. Setting the SDU Size for the Database To set the SDU size for the database server, configure the following files: ■ sqlnet.ora Configure the DEFAULT_SDU_SIZE parameter in the sqlnet.ora file, as follows: DEFAULT_SDU_SIZE=8192 ■ Initialization parameter file If using shared server processes, then set the SDU size in the DISPATCHERS parameter in the initialization parameter file, as follows: DISPATCHERS="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp))(SDU=8192) )" ■ listener.ora If you have configured the listener with a list of targets in the listener.ora file, then the value for SDU in the SID_LIST element overrides the current setting in the sqlnet.ora file when using dedicated server processes. SID_LIST_listener_name= (SID_LIST= (SID_DESC= (SDU=8192) (SID_NAME=sales))) The smaller value of the SDU size and the value configured for the client take precedence Setting the SDU Size for the Client To set the SDU size for the client, configure the following files: ■ sqlnet.ora For global configuration on the client side, configure the DEFAULT_SDU_SIZE parameter in the sqlnet.ora file, as follows: DEFAULT_SDU_SIZE=8192 ■tnsnames.ora For a particular connect descriptor, you can specify the SDU parameter in the DESCRIPTION parameter. sales.us.example.com= (DESCRIPTION= (SDU=11280) (ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com)) ) The SDU size applies to all Oracle Net protocols for the particular connect descriptor.
时间: 2024-10-06 00:12:30