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------明天下载一波源代码
  • 相关阅读:
    监考
    初步确定五一粤东出行计划
    煤矿粉尘监控系统中心站软件3层设计
    c# 程序调用代码生成数据库
    Socket 一个服务器监听多个客户端 功能实现
    软件开发进度表
    sql server日期时间格式转换字符串简介
    Sql建表和sql语句的注意事项
    分布式设计与开发(一)宏观概述
    分布式设计与开发(四)数据拆分
  • 原文地址:https://www.cnblogs.com/codestack/p/12775600.html
Copyright © 2011-2022 走看看