How to monitor Linux UDP buffer available space?

You are trying to solve the wrong problem. UDP is unreliable communication, period. If packet loss is a problem for you, you should either implement your own retransmission/error control algorithm or not using UDP in the first place. Drop it entirely in favor of TCP, or perhaps something more advanced like SCTP or even DCCP.

UDP is datagram-based, socket buffers should be bigger than the maximum length of an UDP datagram that your application may receive, up to 64kiB. If your application may transmit datagrams larger than this, then it is another reason you should not be using UDP. And it really doesn‘t matter how big is the buffer, you still may lose packets if your application can‘t read the socket faster than packets arrive.

You say that you want to know how full the UDP buffer is. This is the sort of thing that doesn‘t really matter. Just read everything that is waiting on the buffer and you can be sure that when it blocks the buffer will be empty.

If you still want to know how full the buffer is, read the file /proc/net/udp,

1. column rx_queue. But if you see any value different than zero in that column, it just means that your application is not reading the socket fast enough.

2. column tx_queue is the same to rx_queue

/proc/net/tcp  is  tcp info

时间: 2024-11-10 06:56:27

How to monitor Linux UDP buffer available space?的相关文章

ARM32 Linux kernel virtual address space

http://thinkiii.blogspot.jp/2014/02/arm32-linux-kernel-virtual-address-space.html The 32-bit ARM CPU can address up to 2^32 = 4GB address*. It's not big enough in present days, since the size of available DRAM on computing devices is growing fast and

Linux msgget返回no space left

linux msgget返回no space left 首先要说的是此类标准函数应该养成查看man手册了解其用法及返回值的习惯. 返回no space left 分为两种情况: 1,创建的msg queue个数超过整个系统限制,通过ipcs -l查看系统对msg queue限制的具体个数,通过ipcs -q查看当前已经创建的所有消息队列.我自己遇到的就是这种情况,是因为在可执行程序退出时没有销毁已经创建的msg queue,在反复多次运行后导致达到上限无法再创建成功. 说明需要注意一点,对于可用

use entire drive|replace existing linux system|use free space

use entire drive|replace existing linux system|use free space 在装 Linux 的时候,到分割硬盘及格式化硬盘这步的时候,有几个选项,他们的意思及将执行的操作分别是: ( 1 ) Use entire drive (使用整个磁盘) 这个方案会删除硬盘上所有分割区,然后再重新分割硬盘.如果您硬盘上有您想保留的操作系统,请不要选择此项. ( 2 ) Replace exiting Linux system (替换掉现有的 Linux 系统

[转帖]How use Nmon and "Java Nmon Analyzer" for Monitor Linux Performance

How use Nmon and "Java Nmon Analyzer" for Monitor Linux Performance https://linoxide.com/monitoring-2/install-nmon-monitor-linux-performance/ Updated May 9, 2018By Pungki AriantoMONITORING, OPEN SOURCE TOOLS Nmon is a  resource monitoring tools

Linux UDP严重丢包问题的解决

测试系统在Linux上的性能发现丢包率极为严重,发210000条数据,丢包达110000之巨,丢包率超过50%.同等情形下Windows上测试,仅丢几条数据.形势严峻,必须解决.考虑可能是因为协议栈Buffer太低所致,于是先看看默认情况: sysctl -a |grep net.core 发现 net.core.rmem_max = 131071 net.core.rmem_default = 112640 修改吧,变大一点,变成10M,然后reboot(应该重启某个服务即可) 然后查网卡收包

Linux中buffer/cache,swap,虚拟内存和page ++

1.Buffer 和 cache Free 命令相对于top 提供了更简洁的查看系统内存使用情况: [[email protected] ~]$ free -m               --以MB为单位                     total         used       free     shared    buffers     cachedMem:            32109      30133      1975          0        472

Linux中Buffer和Cache的区别

1. Cache:缓存区,是高速缓存,是位于CPU和主内存之间的容量较小但速度很快的存储器,因为CPU的速度远远高于主内存的速度,CPU从内存中读取数据需等待很长的时间,而  Cache保存着CPU刚用过的数据或循环使用的部分数据,这时从Cache中读取数据会更快,减少了CPU等待的时间,提高了系统的性能. Cache并不是缓存文件的,而是缓存块的(块是I/O读写最小的单元):Cache一般会用在I/O请求上,如果多个进程要访问某个文件,可以把此文件读入Cache中,这样下一个进程获取CPU控制

linux服务器报No space left on device错误的解决过程记录

起因 今天在本地提交了点代码,但到服务器上git pull的时候提示No space left on device,第一反应是猜想可能硬盘满了(很有可能是log导致的),不过想想又觉得不太可能,这台服务器上只部署了一个应用,查看项目占用空间也不大. 解决过程 1.作为一个linux菜鸟,第一时间百度查关于查看硬盘使用情况的命令 [[email protected] ~]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/hda1 20G   2.4G  18G 13%  /tmpf

linux page buffer cache深入理解

Linux上free命令的输出. 下面是free的运行结果,一共有4行.为了方便说明,我加上了列号.这样可以把free的输出看成一个二维数组FO(Free Output).例如: FO[2][1] = 24677460 FO[3][2] = 10321516 1          2          3          4          5          61              total       used       free     shared    buffers