zhuizhuhaomeng Blog

「记录下来,一切都会更容易理解」

为 OpenResty 编译 OpenTelemetry

使用 OTEL 官方的 nginx otel 模块,编译非常的麻烦,2023-05 以前一直编译不通过,不知道现在是否改善了。 目前 Nginx 官方的搞了 otel 模块,性能好而且编译更容易了。 编译步骤如下: 安装依赖 1 2 3 4 5 sudo apt-get install libc-ares2 libc-ares-dev sudo apt-get install ...

how does nginx http slice module work

我想分析一下 nginx_http_slice_module 的工作原理,因为自带的 OpenResty 不含该模块,因此需要自己编译。 在深入代码分析之前,我们需要先了解 HTTP bytes range 的请求 了解 HTTP bytes range 的原理 可以在点击 mozilla rnage request 查看详细的信息。 我们这里抽取一个请求响应的例子。 1 2 3 4 ...

Add gnu BuildID for Go program

我们可以使用 file 命令查看 ELF 文件的 BuildID。比如: 1 2 $ file /usr/bin/ls /usr/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l...

How to debug linux crash

总结 Linux 内核崩溃应该怎么调试呢?这篇文件挺好的,包含了分析的实例,https://wiki.whamcloud.com/display/LNet/Crash+course+on+Crash。 总结下来,关键的步骤就是: 要先配置 kdump 才能保存崩溃的现场。 需要安装 kernel-debuginfo 需要安装 crash 程序(当然也要 gdb) 使用...

Examples of Linux find command

1 2 3 4 5 6 7 #!/bin/bash for name in `find / -maxdepth 1 -type d -regex "/[0-9]+t-[a-z]"`; do for d in `find /16t-a/trace-pkg-db -maxdepth 2 -type d -regex ".*/\(rpms\|debs\)"`; do f...

An exmaple of ssl_certificate_by_lua

1. the lua code save the following code to file /usr/local/openresty/site/lualib/dynamic_cert.lua 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ...

HTTP error emulator

1. 模拟 HTTP 上游服务器不响应 (网关 504 超时) 以下 Go 程序作为源站 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 package main import ( ...

DWARF op code

elf 中 debug 相关的节 .debug_abbrev - Abbreviations used in the .debug_info section .debug_aranges - Lookup table for mapping addresses to compilation units .debug_frame - Call frame information...

systemctl examples

设置进程的调度属性 1 2 3 4 5 6 7 8 9 10 [Unit] Description=Machine Check Exception Logging Daemon [Service] ExecStart=/usr/sbin/mcelog --ignorenodev --daemon --foreground CPUSchedulingPolicy=fifo CPUSched...

gdb 读取 tls 变量

As answered in Using GDB to read MSRs, this is possible with gdb 8, using the registers $fs_base and $gs_base.