关于UNIX DOMAIN SOCKET和普通udp socket的对比
在TX1(4核A57 1.7GHz)的板卡上进行测试,每个包大小设置为1024,全速收发,UDS的速度在90Mbps左右,UDP在120Mbps左右(略有丢包)
CPU占用率,UDS比UDP低10%,但是实际上,如果码率相近时,CPU占用率是差不多的
 
下面是UDP的CPU占用:
top - 08:44:46 up  3:04,  5 users,  load average: 1.78, 1.70, 1.66
Threads: 195 total, 3 running, 192 sleeping, 0 stopped, 0 zombie
%Cpu(s): 15.4 us, 31.3 sy, 0.0 ni, 51.3 id, 0.0 wa, 0.0 hi, 2.1 si, 0.0 st
KiB Mem : 4078676 total, 3061964 free, 399460 used, 617252 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 3180808 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1397 root -88 0 487920 156364 2100 R 65.9 3.8 2:04.03 udp_send
1396 root -91 0 487920 156364 2100 R 56.3 3.8 1:48.16 udp_recv
1395 root rt 0 487920 156364 2100 S 38.7 3.8 1:15.88 data_out
1398 root -81 0 487920 156364 2100 S 29.8 3.8 0:58.27 data_in
915 nvidia 20 0 9020 3280 2568 S 0.7 0.1 1:25.59 top
7 root 20 0 0 0 0 S 0.3 0.0 0:43.18 rcu_preempt
146 root rt 0 0 0 0 S 0.3 0.0 0:26.44 cfinteractive
327 systemd+ 20 0 77312 1952 1740 S 0.3 0.0 0:06.22 sd-resolve
1393 root 20 0 487920 156364 2100 S 0.3 3.8 0:01.00 test_udp.out
1400 admin 20 0 8932 3304 2632 R 0.3 0.1 0:00.07 top
1 root 20 0 7044 5452 3524 S 0.0 0.1 0:02.68 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 2:52.41 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_sched
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
11 root rt 0 0 0 0 S 0.0 0.0 0:00.22 watchdog/0

  

 这个是UDS的CPU占用率:

top - 08:45:22 up  3:05,  5 users,  load average: 1.64, 1.68, 1.65
Threads: 195 total, 1 running, 194 sleeping, 0 stopped, 0 zombie
%Cpu(s): 12.9 us, 28.2 sy, 0.0 ni, 58.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 4078676 total, 3061868 free, 399532 used, 617276 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 3180712 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1406 root -88 0 487916 156400 2136 S 53.5 3.8 0:05.85 udp_send
1405 root -91 0 487916 156400 2136 S 41.6 3.8 0:04.57 udp_recv
1407 root -81 0 487916 156400 2136 S 34.0 3.8 0:03.77 data_in
1404 root rt 0 487916 156400 2136 S 29.7 3.8 0:03.24 data_out
915 nvidia 20 0 9020 3280 2568 S 0.7 0.1 1:25.79 top
1402 root 20 0 487916 156400 2136 S 0.7 3.8 0:00.41 test.out
146 root rt 0 0 0 0 S 0.3 0.0 0:26.49 cfinteractive
1400 admin 20 0 8932 3304 2632 R 0.3 0.1 0:00.27 top
1403 root rt 0 487916 156400 2136 S 0.3 3.8 0:00.01 trace_tsk
1 root 20 0 7044 5452 3524 S 0.0 0.1 0:02.68 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 2:52.41 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 0:43.20 rcu_preempt
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_sched
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
11 root rt 0 0 0 0 S 0.0 0.0 0:00.22 watchdog/0
12 root rt 0 0 0 0 S 0.0 0.0 0:00.20 watchdog/1
13 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
14 root 20 0 0 0 0 S 0.0 0.0 0:00.29 ksoftirqd/1
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0
16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
17 root rt 0 0 0 0 S 0.0 0.0 0:00.21 watchdog/2
18 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/2
19 root 20 0 0 0 0 S 0.0 0.0 0:00.20 ksoftirqd/2
21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/2:0H
22 root rt 0 0 0 0 S 0.0 0.0 0:00.22 watchdog/3
23 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/3
24 root 20 0 0 0 0 S 0.0 0.0 0:00.31 ksoftirqd/3
26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/3:0H

  

理论上UDS不经过协议栈,不用计算校验和,但是为什么实际UDP速度还要快一些,那么UDS存在的价值在哪?

UNIX DOMAIN SOCKET效率的更多相关文章

  1. Unix domain socket 简介

    Unix domain socket 又叫 IPC(inter-process communication 进程间通信) socket,用于实现同一主机上的进程间通信.socket 原本是为网络通讯设 ...

  2. 【转】PHP实现系统编程(四)--- 本地套接字(Unix Domain Socket)

    原文:http://blog.csdn.net/zhang197093/article/details/78143687?locationNum=6&fps=1 --------------- ...

  3. (unix domain socket)使用udp发送>=128K的消息会报ENOBUFS的错误

    一个困扰我两天的问题, Google和Baidu没有找到解决方法! 此文为记录这个问题,并给出原因和解决方法. 1.Unix domain socket简介 unix域协议并不是一个实际的协议族,而是 ...

  4. 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

    错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...

  5. ndk学习16: unix domain socket

    一.UNIX Domain Socket 概念: UNIX Domain Socket是在socket架构上发展起来的用于同一台主机的进程间通讯(IPC) 特点: 1. 它不需要经过网络协议栈,不需要 ...

  6. Unix Domain Socket 域套接字实现

    主要注意流程: STREAM SOCKET: Server :  socket() --->  bind() ---> listen()  ---> accept() Client: ...

  7. 由一个简单需求到Linux环境下的syslog、unix domain socket

    本文记录了因为一个简单的日志需求,继而对linux环境下syslog.rsyslog.unix domain socket的学习.本文关注使用层面,并不涉及rsyslog的实现原理,感兴趣的读者可以参 ...

  8. libpqxx接口的在linux下的使用,解决psql:connections on Unix domain socket "/tmp/.s.PGSQL.5432"错误

    在项目中使用postgresql数据库时要求在windows和linux双平台兼容.于是在windows下使用的接口在linux下爆出异常: psql:connections on Unix doma ...

  9. nginx、php-fpm默认配置与性能–TCP socket还是unix domain socket【转】

    原文地址:https://www.cnxct.com/default-configuration-and-performance-of-nginx-phpfpm-and-tcp-socket-or-u ...

随机推荐

  1. HTML 练习淡入淡出

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. 第九周LINUX 学习笔记

    基于GTID的mysql主从简单复制 一.简单主从模式配置步骤1.配置主从节点的服务配置文件1.1.配置master节点:[mysqld]binlog-format=ROWlog-bin=master ...

  3. BASE64编码原理分析脚本实现及逆向案例

    在互联网中的每一刻,你可能都在享受着Base64带来的便捷,但对于Base64的基础原理你又了解多少?今天小编带大家了解一下Base64编码原理分析脚本实现及逆向案例的相关内容.   01编码由来 数 ...

  4. 从壹开始前后端分离 [ Vue2.0+.NET Core2.1] 二十一║Vue实战:开发环境搭建【详细版】

    缘起 哈喽大家好,兜兜转转终于来到了Vue实战环节,前边的 6 篇关于Vue基础文章我刚刚简单看了看,感觉写的还是不行呀,不是很系统,所以大家可能看上去比较累,还是得抽时间去润润色,修改修改语句和样式 ...

  5. .NET Core微服务之基于Steeltoe使用Hystrix熔断保护与监控

    Tip: 此篇已加入.NET Core微服务基础系列文章索引 =>  Steeltoe目录快速导航: 1. 基于Steeltoe使用Spring Cloud Eureka 2. 基于Steelt ...

  6. ubuntu文件系统分区调整(解决目录空间不足、分配不均问题)

    1. 安装 tuxboot (ubuntu下烧写工具) sudo apt-add-repository ppa:thomas.tsai/ubuntu-tuxboot sudo apt-get upda ...

  7. docker~docker-compose的使用

    回到目录 docker-compose是用来在Docker中定义和运行复杂应用的工具,比如在一个yum文件里定义多个容器,只用一行命令就可以让一切就绪并运行. 使用docker compose我们可以 ...

  8. k8s源码分析准备工作 - 源码准备

    本文原始地址:https://farmer-hutao.github.io/k8s-source-code-analysis/ 项目github地址:https://github.com/farmer ...

  9. SpringCloud微服务如何优雅停机及源码分析

    目录 方式一:kill -9 java进程id[不建议] 方式二:kill -15 java进程id 或 直接使用/shutdown 端点[不建议] kill 与/shutdown 的含义 Sprin ...

  10. 从PRISM开始学WPF(三)Prism-Region-更新至Prism7.1

    [7.1update]在开始前,我们先看下版本7.1中在本实例中的改动. 首先,项目文件中没有了Bootstrapper.cs,在上一篇的末尾,我们说过了,在7.1中,不见推荐使用Bootstrapp ...