# 討論筆記 ## 2025/06/11 ### 閱讀 - 事件驅動伺服器 - 並行程式設計 ### 使用 NixOS 公司 [Ref](https://github.com/ad-si/nix-companies) [Ref](https://planetnix.com/speakers/#aneesh-agrawal) | 公司名稱 | 團隊 | 國家 | | -------- | -------- | -------- | | Google | Firebase studio | USA | | [Shopify](https://shopify.engineering/shipit-presents-how-shopify-uses-nix)| | USA| |Replit||USA| |[D.E Shaw](https://discourse.nixos.org/t/the-d-e-shaw-group-quant-systems-build-and-release-engineer/13686)|[Flox](https://jobs.ashbyhq.com/flox/b98c4b25-aeb6-4474-9da5-5ff1efe4e841)|USA| |[Arista Network](https://github.com/aristanetworks/nix-serve-ng)||USA| |[Anduril](https://discourse.nixos.org/t/nixcon-na-2024-is-getting-sponsored-by-anduril-what-to-do-about-it/41258)||USA| |Anthropic||USA| |Mercury.com||USA| ### eBPF socket轉發專案 #### 測試程式偶爾會有找不到該找的鍵值 解決方法: 增加一個usleep在發送send()函數之前 驗證過程:增加bpf_printk, tcpdump, 更改鍵值大小 猜測:可能是ebpf從未更新快取拿到資料 #### 卸載ebpf程式必須是斷網狀態 理由:只要持續有封包就會使得程式無法完整釋放資源 #### 實驗結果 結論:ktcp略優於ebpf [連結](https://github.com/Brianpan/ebpf-tcp-server/blob/main/benchmark) | 對象 | 平均數 | 標準差 | | -------- | -------- | -------- | | kecho | 479 | 371 | | tcp-ebpf| 591|437| ![Screenshot 2025-06-11 at 9.57.01 AM](https://hackmd.io/_uploads/BJLuSEvXgg.png) ##### 環境 ```bash= uname -a Linux brianpan-Aspire-A14-52MT 6.11.0-17-generic #17~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 20 22:48:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux gcc --version gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. sudo lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 42 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Vendor ID: GenuineIntel BIOS Vendor ID: Intel(R) Corporation Model name: Intel(R) Core(TM) Ultra 5 226V BIOS Model name: Intel(R) Core(TM) Ultra 5 226V To Be Filled By O.E.M. CPU @ 0.4GHz BIOS CPU family: 773 CPU family: 6 Model: 189 Thread(s) per core: 1 Core(s) per socket: 8 Socket(s): 1 Stepping: 1 CPU(s) scaling MHz: 40% CPU max MHz: 4500.0000 CPU min MHz: 400.0000 BogoMIPS: 6220.80 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge m ca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 s s ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nons top_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma c x16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt t sc_deadline_timer aes xsave avx f16c rdrand lahf_lm ab m 3dnowprefetch cpuid_fault epb intel_ppin ssbd ibrs i bpb stibp ibrs_enhanced tpr_shadow flexpriority ept vp id ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_p t sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_det ect user_shstk avx_vnni lam wbnoinvd dtherm ida arat p ln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_r eq hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqd q rdpid bus_lock_detect movdiri movdir64b fsrm md_clea r serialize pconfig arch_lbr ibt flush_l1d arch_capabi lities Virtualization features: Virtualization: VT-x Caches (sum of all): L1d: 320 KiB (8 instances) L1i: 512 KiB (8 instances) L2: 14 MiB (5 instances) L3: 8 MiB (1 instance) NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0-7 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Mitigation; Speculative Store Bypass disabled via prct l Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointe r sanitization Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditiona l; RSB filling; PBRSB-eIBRS Not affected; BHI Not affe cted Srbds: Not affected Tsx async abort: Not affected ``` ### 點子 - haproxy spoe engine with xdp to detect ai traffic - 利用VXLAN概念,用ebpf達到快速轉發 ### 筆記 https://github.com/sysprog21/kecho/blob/master/drop-tcp-socket.c