zoukankan      html  css  js  c++  java
  • 对udp dns的思考2

    上一篇文章写道了udp 使用reuseport 多线程编程!!!

    但是有几个问题需要考虑一下:

    • 之前hash使用sip sport dip dport为key, 很正常同一个客户端回hash到同一个socket上。。但是其中一个线程挂了呢????????????对于TCP而言,hash的不一致仅仅影响新建连接三次握手的瞬间,而对于UDP,将会影响整个四元组的整个生命周期!
    • 数据发送端的IP/Port 变化,毕竟udp是非连接的,udp组播啥的,断开重连, udp发包可是只管dstip port。 使用sendto (connect+send)发包的。。。

    1、对线程挂了问题, 是不是可以让线程挂了 但是socket不要关闭啊????也就是 起一个进程处理保证不会down掉。。专门管理socket!!!!!额貌似有点搓a搓啊

    2、或者生成唯一的session id 使用mac ip port啥的! 用session id 作为key, 即使前面报文到了msocket ,m挂了后,hash到n, nsocket手打报文后根据ip port啥的找到session id,找到处理逻辑。

    多线程继续处理!!!!但是session id 唯一性 怎么玩 !!需要么?

    3、目前看到https://lwn.net/Articles/762101/  新的内核已经添加了ebpf  BPF_MAP_TYPE_REUSEPORT_SOCKARRAY  &&BPF_PROG_TYPE_SK_REUSEPORT  

    For example, in UDP, the bpf prog can peek into the payload (e.g.
    through the "data" pointer introduced in the later patch) to learn
    the application level's connection information and then decide which sk
    to pick from a bpf map.  The userspace can tightly couple the sk's location
    in a bpf map with the application logic in generating the UDP payload's
    connection information.  This connection info contact/API stays within the
    userspace.
    又是ebpf!!! 目前正在写!!! 写完了在测试一波, 顺便分析下quic------明天下载一波源代码
  • 相关阅读:
    史上最详细 Linux 用户与用户组知识
    MySQL -2- 体系结构--随笔小记
    MySQL -2- 体系结构
    MySQL -1- 简介及安装
    MySQL -0- 课程大纲及课程链接
    探索Windows命令行系列(4):通过命令操作文件和文件夹
    探索Windows命令行系列(3):命令行脚本基础
    探索Windows命令行系列(2):命令行工具入门
    探索Windows命令行系列(1):导航目录
    Oracle 分页方法研究
  • 原文地址:https://www.cnblogs.com/codestack/p/12775600.html
Copyright © 2011-2022 走看看