You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ok...@apache.org on 2017/11/09 15:45:30 UTC

[trafficserver] branch master updated: Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes

This is an automated email from the ASF dual-hosted git repository.

oknet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new e8ed1d1  Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes
e8ed1d1 is described below

commit e8ed1d1eec44a4641029da9efd0be0bc47fc1d61
Author: Oknet Xu <xu...@skyguard.com.cn>
AuthorDate: Thu Nov 9 18:54:31 2017 +0800

    Optimize: Within udp_read_from_net, change the receive IOBufferBlock size to 2048 bytes
    
    Generally, an UDP packet length is less than MTU size to avoid IP
    Fragmentation. In order to optimize the use of memory, set the buffer
    length to 2048 bytes which is the smallest buffer size greater than
    1500. The range of 1300 to 1500 is a common Ethernet MTU size.
---
 iocore/net/UnixUDPNet.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 18004cf..4223ceb 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -116,14 +116,14 @@ UDPNetProcessorInternal::udp_read_from_net(UDPNetHandler *nh, UDPConnection *xuc
   // don't call back connection at this time.
   int64_t r;
   int iters         = 0;
-  unsigned max_niov = NET_MAX_IOV;
+  unsigned max_niov = 32;
 
   struct msghdr msg;
   Ptr<IOBufferBlock> chain, next_chain;
-  struct iovec tiovec[NET_MAX_IOV];
-  int64_t size_index  = BUFFER_SIZE_INDEX_4K;
+  struct iovec tiovec[max_niov];
+  int64_t size_index  = BUFFER_SIZE_INDEX_2K;
   int64_t buffer_size = BUFFER_SIZE_FOR_INDEX(size_index);
-  // The max length of receive buffer is NET_MAX_IOV (16) * buffer_size (4096) = 65536 bytes.
+  // The max length of receive buffer is 32 * buffer_size (2048) = 65536 bytes.
   // Because the 'UDP Length' is type of uint16_t defined in RFC 768.
   // And there is 8 octets in 'User Datagram Header' which means the max length of payload is no more than 65527 bytes.
   do {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].