随笔分类 -  os

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页

valgrind
摘要:Valgrind工具详解 1.Memcheck 最常用的工具,用来检测程序中出现的内存问题,所有对内存的读写都会被检测到,一切对malloc、free、new、delete的调用都会被捕获。所以,它能检测以下问题: 1、对未初始化内存的使用; 2、读/写释放后的内存块; 3、读/写超出malloc分 阅读全文

posted @ 2021-05-26 14:53 tycoon3 阅读(387) 评论(0) 推荐(0)

objdump segfault
摘要:#include<stdio.h> #include<stdlib.h> void main() { int *ptr = (int *)0; *ptr = 100; } root@ubuntu:~/c++# gcc seg.c -o seg root@ubuntu:~/c++# ./seg Seg 阅读全文

posted @ 2021-05-26 11:42 tycoon3 阅读(171) 评论(0) 推荐(0)

Unix Socket span docker and host
摘要:root@ubuntu:~/c++# ./u_server Listener on port /tmp/echo_socket Waiting for connections ... Welcome message sent successfully Adding to list of socket 阅读全文

posted @ 2021-05-26 09:54 tycoon3 阅读(96) 评论(0) 推荐(0)

tcp 的三个接收队列
摘要:prequeue 在linux内核中,每一个网络数据包,都被切分为一个个的skb,这些skb先被内核接收,然后投递到对应的进程处理,进程把skb拷贝到本tcp连接的sk_receive_queue中,然后应答ack。以往的内核处理这些skb的时候,是直接通过内核调度的,有数据来了,就进行进程调度,这 阅读全文

posted @ 2021-05-20 19:13 tycoon3 阅读(540) 评论(0) 推荐(0)

Boost UDP Transaction Performance
摘要:提高UDP交互性能 这是一篇个人认为非常非常厉害的文章,取自这里。讲述了如何提升UDP流的处理速率,但实际涉及的技术点不仅仅限于UDP。这篇文章中涉及的技术正好可以把前段时间了解的知识串联起来。作者:Toshiaki Makita 讲述内容 背景 提升网络性能的基本技术 如何提升UDP性能 作者介绍 阅读全文

posted @ 2021-05-20 17:10 tycoon3 阅读(302) 评论(0) 推荐(0)

perf-网络协议栈性能分析
摘要:概要 分析 Linux 网络协议栈性能有多种方式和工具。本文主要通过 Perf 生成 On-CPU 火焰图的方式,分析 Linux 内核网络协议栈在特定场景下的性能瓶颈,从而知晓当前协议栈的网络状况。 关于 On/Off-CPU 概念定义 1 2 3 On-CPU: where threads ar 阅读全文

posted @ 2021-05-20 17:06 tycoon3 阅读(532) 评论(0) 推荐(0)

coredump
摘要:root@ubuntu:~# ulimit -c unlimited root@ubuntu:~# echo 1 > /proc/sys/kernel/core_uses_pid root@ubuntu:~# mkdir /corefile root@ubuntu:~# echo /corefile 阅读全文

posted @ 2021-05-20 11:17 tycoon3 阅读(132) 评论(0) 推荐(0)

TCP- 半连接队列 -全连接队列
摘要:image.png 1. SYN_REVD, ESTABELLISHED 状态对应的队列 TCP 建立连接时要经过 3 次握手,在客户端向服务器发起连接时, 对于服务器而言,一个完整的连接建立过程,服务器会经历 2 种 TCP 状态:SYN_REVD, ESTABELLISHED。 对应也会维护两个 阅读全文

posted @ 2021-05-19 17:10 tycoon3 阅读(1152) 评论(0) 推荐(1)

重新实现reuseport逻辑,实现一致性哈希
摘要:有部分应用场景采用的仍然是无连接协议,例如 DNS、StatsD 等,都是采用的 UDP 。 UDP 不是面向连接的,所以不能像 TCP 通过建立多个连接来提高对服务器的并发访问,如果通过多线程共享一个 UDP Socket 可能会无法充分利用所有的 CPU 资源。 这里简单介绍其优化方法,当然,这 阅读全文

posted @ 2021-05-19 11:07 tycoon3 阅读(451) 评论(0) 推荐(0)

iptables
摘要:root@cloud:~# iptables -t nat -L POSTROUTING -n --line-number Chain POSTROUTING (policy ACCEPT) num target prot opt source destination 1 KUBE-POSTROUT 阅读全文

posted @ 2021-05-18 16:53 tycoon3 阅读(96) 评论(0) 推荐(0)

LISTEN 状态的 Recv-Q Send-Q
摘要:ESTAB 状态下的 Recv-Q Send-Q 分别表示内核协议栈的发送缓冲区和接受缓冲区中保存的内容字节数。 在 Linux 上,TCP 的三次握手在内核里完成。内核通过一个半连接和已连接 2 个队列来实现。 已连接队列的大小由 net.core.somaxconn 和 int listen(i 阅读全文

posted @ 2021-05-18 15:54 tycoon3 阅读(483) 评论(0) 推荐(0)

raw udp client port 50000 unreachable
摘要:^C[root@bogon raw-sockets-example]# cat raw_udp_client.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ 阅读全文

posted @ 2021-05-16 17:02 tycoon3 阅读(162) 评论(0) 推荐(0)

raw socket sniffer
摘要:#include<stdio.h> #include<stdlib.h> #include<string.h> #include<netinet/ip_icmp.h> #include<netinet/tcp.h> #include<netinet/udp.h> #include<arpa/inet 阅读全文

posted @ 2021-05-16 12:44 tycoon3 阅读(152) 评论(0) 推荐(0)

tcp raw socket
摘要:client #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <time.h> #include <arpa/inet.h> #include <sys/socket.h> 阅读全文

posted @ 2021-05-16 11:17 tycoon3 阅读(114) 评论(0) 推荐(0)

Cloudflare Blog 当TCP套接字拒绝死亡
摘要:https://blog.cloudflare.com/zh-cn/when-tcp-sockets-refuse-to-die-zh-cn/ 在我们的Spectrum服务器上工作时,我们注意到了一些奇怪的现象:我们认为应该关闭了的TCP套接字一直在徘徊。我们意识到我们并不真正了解TCP套接字何时应 阅读全文

posted @ 2021-05-15 22:03 tycoon3 阅读(350) 评论(0) 推荐(0)

nonblock connect
摘要:阻塞 connect 客户端调用 connect 发起对服务端的 socket 连接,调用 connect 函数将激发 tcp 三次握手过程.如果客户端的 socket 描述符为阻塞模式(默认),则 connect 会阻塞到连接建立成功或连接超时(linux内核中对 connect 的超时时间限制是 阅读全文

posted @ 2021-05-15 21:45 tycoon3 阅读(282) 评论(0) 推荐(0)

TCP协议的那些超时
摘要:众所周知,TCP协议是一个 可靠的 的协议。TCP的可靠性依赖于大量的 Timer 和 Retransmission 。现在咱们就来细说一下TCP协议的那些 Timer 。 1. Connection-Establishment Timer 在TCP三次握手创建一个连接时,以下两种情况会发生超时: 阅读全文

posted @ 2021-05-15 21:25 tycoon3 阅读(1104) 评论(0) 推荐(0)

Linux 建立 TCP connect 连接的超时时间分析
摘要:inux 系统默认的建立 TCP 连接的超时时间为 127 秒,对于许多客户端来说,这个时间都太长了, 特别是当这个客户端实际上是一个服务的时候,更希望能够尽早失败,以便能够选择其它的可用服务重新尝试。 socket 是 Linux 下实现的传输控制层协议,包括 TCP 和 UDP,一个 socke 阅读全文

posted @ 2021-05-15 20:57 tycoon3 阅读(1615) 评论(0) 推荐(0)

keepavlived
摘要:主机1 主机2 82节点 root@ubuntu:/etc/keepalived# systemctl start keepalived root@ubuntu:/etc/keepalived# cat keepalived.conf ! Configuration File for keepali 阅读全文

posted @ 2021-05-12 17:51 tycoon3 阅读(125) 评论(0) 推荐(0)

dpdk mbuf 深拷贝
摘要:struct rte_mbuf *mbuf_copy(struct rte_mbuf *md, struct rte_mempool *mp) { struct rte_mbuf *mc, *mi, **prev; uint32_t pktlen; uint8_t nseg; if (unlikel 阅读全文

posted @ 2021-05-12 17:08 tycoon3 阅读(661) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页

导航