上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 69 下一页

2025年8月28日

go http实现长连接

摘要: 服务端 package main import ( "net/http" "time" ) func handler(w http.ResponseWriter, r *http.Request) { f := w.(http.Flusher) for { w.Write([]byte("1\n") 阅读全文

posted @ 2025-08-28 22:32 王景迁 阅读(18) 评论(0) 推荐(0)

Linux Ubuntu上安装helm

摘要: apt update apt install -y apt-transport-https curl -fsSL https://baltocdn.com/helm/signing.asc | sudo apt-key add - apt install -y software-properties 阅读全文

posted @ 2025-08-28 22:08 王景迁 阅读(25) 评论(0) 推荐(0)

2025年8月24日

kubelet自注册

摘要: v1.19.0 kubelet是否自注册由参数register-node决定,默认是true。 pkg/kubelet/kubelet_node_status.goregisterWithAPIServer不断尝试创建node,直到成功。 阅读全文

posted @ 2025-08-24 15:14 王景迁 阅读(9) 评论(0) 推荐(0)

2025年8月17日

go http trace分析耗时

摘要: package main import ( "crypto/tls" "fmt" "log" "net/http" "net/http/httptrace" "time" ) func main() { req, _ := http.NewRequest("GET", "https://www.ba 阅读全文

posted @ 2025-08-17 20:45 王景迁 阅读(13) 评论(0) 推荐(0)

2025年8月5日

ZooKeeper和Redis对比

摘要: 对比项 ZooKeeper Redis 设计初衷 分布式协调服务(树状层次结构) 高性能内存数据库(KV键值对) 一致性 基于ZAB协议保证强一致性 不支持 通知机制 可靠的一次性通知,需要重新注册watch 非可靠的通知 分布式锁 支持可重入和公平性 支持高性能 阅读全文

posted @ 2025-08-05 07:25 王景迁 阅读(6) 评论(0) 推荐(0)

2025年7月27日

查看Linux所有crontab定时任务

摘要: 查看单个用户的crontab定时任务 crontab -l -u username 查看所有用户的crontab任务 cat /etc/passwd | cut -f 1 -d : |xargs -I {} crontab -l -u {} 阅读全文

posted @ 2025-07-27 08:28 王景迁 阅读(28) 评论(0) 推荐(0)

fatrace查看磁盘io

摘要: fatrace无法查看到执行磁盘IO进程的父进程。 apt install -y fatrace fatrace -c -t 阅读全文

posted @ 2025-07-27 08:17 王景迁 阅读(9) 评论(0) 推荐(0)

go select选择case分析

摘要: 场景 条件 执行default 存在default,且无case满足。 阻塞 没有default,且无case满足。 选择单个case执行 如果只有1个case满足,那么直接执行;如果有多个case满足,那么随机选择执行,通过随机来保证公平性。 阅读全文

posted @ 2025-07-27 07:53 王景迁 阅读(9) 评论(0) 推荐(0)

2025年7月18日

go map不能使用指针作为key

摘要: package main import "fmt" type student struct { name string age int } func main() { m := make(map[*student]bool) s1 := &student{ name: "a", age: 17, } 阅读全文

posted @ 2025-07-18 08:16 王景迁 阅读(14) 评论(0) 推荐(0)

go 设置http请求超时时间

摘要: 10.11.12.13不真实存在,ping会超时。 使用 http.Client 设置全局超时 package main import ( "net/http" "time" ) func main() { client := &http.Client{ Timeout: 5 * time.Seco 阅读全文

posted @ 2025-07-18 08:09 王景迁 阅读(55) 评论(0) 推荐(0)

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 69 下一页

导航