Learning
Optimizing Go Applications in Containers
· β˜• 3 min read
1. Memory Alignment Arrange the fields inside a struct from largest to smallest. This reduces memory footprint. Install the fieldalignment tool 1 go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest Analyze and fix memory alignment 1 2 3 4 5 6 7 8 9 fieldalignment -fix ./... /Users/shaowenchen/Code/app/config/config.go:136:14: struct with 32 pointer bytes could be 24 /Users/shaowenchen/Code/app/config/config.

Source Code Analysis of Kubernetes Pod IP Management
· β˜• 7 min read
1. Subnet Management by kube-controller-manager kube-controller-manager has many controllers; the one related to Pod IP is NodeIpamController. The NodeIpamController mainly manages the podcidr of nodes: when a new node joins the cluster, it allocates a subnet to that node; when a node is deleted, it reclaims the subnet. The subnets

A Simple Tutorial on Using FFmpeg
· β˜• 2 min read
1. Installing FFmpeg Run this command on macOS: 1 brew install ffmpeg 2. Using FFmpeg 1 ffmpeg {1} {2} -i {3} {4} {5} The five parts of the arguments are, in order: Global arguments, such as -y, -loglevel, -preset, which control the overall behavior Input file arguments, such as -i, -ss, -t, -stream_loop, which control how the input file is read Input file, the path to the audio/video input file to process Output file arguments, such as -c:v, -c:a, -vf, -af, which control the encoding and filtering of the output Output file, the path to the processed output audio/video file Common output arguments:

Some Tips for Optimizing Program Builds
· β˜• 3 min read
Continuously updated… 1. Golang Use trimpath to remove the build path, avoiding exposure of build path information 1 go build -gcflags="all=-trimpath=${PWD}" -asmflags="all=-trimpath=${PWD}" -o ./bin/opscli ./cmd/cli/main.go Before adding it, a panic prints the path /Users/shaowenchen/Code/Github/ops/main.go; after adding it, a panic prints main.go. -ldflags “-w -s” removes debug information and reduces the binary size 1 go build -ldflags "-w -s" -o .

Transformer Learning Notes
· β˜• 5 min read
1. Why Transformer Fully connected self-attention In earlier RNN models, each word could only relate to its neighboring words, whereas with the Attention mechanism in the Transformer model, a word can relate to a word at any position, so it can capture global context information. No vanishing gradient problem An RNN applies repeatedly to the same weight matrix, so when its largest eigenvalue is less than 1 the vanishing gradient problem appears.