Re: udp packet loss even with large socket buffer

From: Paulo Marques (pmarques_at_grupopie.com)
Date: 03/02/04

  • Next message: Mihai RUSU: "Re: epoll and fork()"
    Date:	Tue, 02 Mar 2004 12:58:26 +0000
    To: johnny zhao <filamoon2@hotmail.com>
    
    

    johnny zhao wrote:

    > hi,
    >
    > Since my program is coping with MSN, it's not easy to post a small
    > example. But I will try :)
    >
    > I use the following code to initialize the socket:
    >
    > *****************************
    > session->rtp.loc_addr.sin_family = AF_INET;
    > session->rtp.loc_addr.sin_addr.s_addr = INADDR_ANY;
    > session->rtp.loc_addr.sin_port = htons (port);
    > session->rtp.socket = socket (PF_INET, SOCK_DGRAM, 0);

                                                             ^^^
    This should really be IPPROTO_UDP as defined in <netinet/in.h>

    > g_return_val_if_fail (session->rtp.socket > 0, -1);
    > err = bind (session->rtp.socket,
    > (struct sockaddr *) &session->rtp.loc_addr,
    > sizeof (struct sockaddr_in));
    > /* set the address reusable */
    > err = setsockopt (session->rtp.socket, SOL_SOCKET, SO_REUSEADDR,
    > (void*)&optval, sizeof (optval));
    >
    > optval = 8388608;

    You are right, this is really a huuuuuge buffer. If you are getting a 1.5kb
    packet every 80 ms on average, this is about 20kb/second. Even a 64kb buffer
    should be much more than enough.

    My advice is just request a 64kb buffer, and stop messing with the rmem_default
    and rmem_max parameters.

    -- 
    Paulo Marques - www.grupopie.com
    "In a world without walls and fences who needs windows and gates?"
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Mihai RUSU: "Re: epoll and fork()"

    Relevant Pages

    • Re: [PATCH] speed up SATA
      ... write-cache-off queueing will be slightly slower than ... since most drives have slightly stricter ... but an 8MB buffer doing 4K random-ops could ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: A problem about DIRECT IO on ext3
      ... fails if the offset or buffer is NOT filesystem blocksize ... So, its possible that your buffer is atleast 512byte aligned, ... > soft/hard sector sizes. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Lockless file reading
      ... > a 3-byte sequence to not be written when both ... > a buffer of such data is controlled so a write ... writes aren't always in processor order (see ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: x86, ARM, PARISC, PPC, MIPS and Sparc folks please run this
      ... write buffer and it isn't doing that. ... I'm saying that the bug can't be that, because such a bug would affect ... > performance isn't viable in such many embedded environments. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] PPC64: lockfix for rtas error log
      ... > forward it to the main 2.6 kernel maintainers. ... > This patch moves the location of a lock in order to protect ... a race existed whereby the buffer ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)