zoukankan      html  css  js  c++  java
  • UDP VS TCP 规格严格

    Mostly buffer space. Say you're sending a constant 10MB/second , and you're only able to consume 5MB/second, the OS and network stack can't keep up, so it will drop the packets - this should be rather obvious. (Which, naturally is different from TCP which provides flow control and retransmission to handle such a situation).

    Even if you're normally keeping up with consuming the data, there might be small time slices where you're not. e.g. a garbage collector kicks in, the OS decided to schedule another process instead of your consumer for 0.5 seconds, etc - and the system will drop packets.

    This can be extended to any network devices in between. If you're running on a network instead of just locally, an ethernet switch, router, etc. will also drop packets if its queues are full (e.g. you're sending a 10MB/s stream through an 100MB/s ethernet switch, and a few seconds in the middle of the night someone else tries to cram 100MB/sec through the same path, some packets will lose.)

    Try increasing the socket buffers size, often you have to increase this on the OS level as well.

    (e.g. on linux, the default socket buffer size is often only 128k or less, which leaves very little room for pausing the data processing , you can try to increase them by setting the sysctl net.core.wmem_max,net.core.wmem_default, net.core.rmem_max, net.core.rmem_default)

    http://stackoverflow.com/questions/47903/udp-vs-tcp-how-much-faster-is-it

    http://stackoverflow.com/questions/11994086/receiving-real-time-gps-data-via-udp
     

  • 相关阅读:
    IO—》字节流&字符流
    IO—》递归
    IO—》File类
    IDEA快速升级模块版本号
    redis使用Jackson2JsonRedisSerializer序列化问题
    git 创建管理多用户
    linux后台启动程序脚本实例
    linux 安装配置kafka脚本
    linux 安装配置zookeeper脚本
    linux安装配置JDK脚本
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/2687362.html
Copyright © 2011-2022 走看看