Every Programmer Should Know

Every Programmer Should Know Introduction Map of Computer Science A couple of notes on this video: Originally scientists build computers to solve arithmetic, but they turned out to be incredibly useful for may other things as well. runing the entire internet, artificial brains or simulating the Universe. but amazingly all of boils down to just flipping zeros and ones. Computer science is the subject that studies what computers can do. It si diverse and overlapping field to split it into three parts:
Read more →

Kubernetes in Action FAQ

Kubernetes Utilities Helm Step 1: Install Helm 3 from source using a script $ curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash Step 2: Add the stable repository $ helm repo add stable https://charts.helm.sh/stable $ helm repo list Kubeadm Cert-Manager ExternalDNS (External DNS) NFS, GlusterFS (Persistent Volume) Traefik (Ingress Controller - reverse proxy, HTTP router) MetalLB (External Load Balancer for K8s Services) Kubernetes 不为裸机集群提供网络负载均衡器的实现. Kubernetes附带的Network LB的实现都是调用各种IaaS平台(GCP, AWS, Azure等)的粘合代码。如果你为在受支IaaS平台(GCP,AWS,Azure等)上运行,则LoadBalancers在创建后将无期限保持"pending"状态. matallb is a network load-balancer implementation for Kubernetes using standard routing protocols.
Read more →

Istio in Action Notes

Part 1 - Understanding Istio Istio is an open source service mesh that helps solve service-to-service connectivity challenges in your cloud and microservice environment regradless of what language or framework you use. Chapter 1 - Introducing the Istio service mesh What’s a service mesh? A service mesh architecture with co-located applicaton-later proxies (data plane) and management components (control plane) Istio plays a supporting role to the application layer and sits abover the lower-level deployment layer.
Read more →

Managing Connections in Golang

Connection Pool Database Connection Pool What is a Database Connection? The Database connection is nothing but a way for the application software to interact with the database server software and we use the connection to send commands(SQL) to the database and obtain the response from the database in the form of a Result Set.
Read more →

A TCP IP Tutorial

Basic TCP/IP Structure Figure 1. Basic TCP/IP Network Node —————————- | network applications | | | |… \ | / .. \ | / …| | —– —– | | |TCP| |UDP| | | —– —– | | \ / | | ——– | | | IP | | | —– -*—— | | |ARP| | | | —– | | | \ | | | —— | | |ENET| | | —@– | ———-|—————– | ———————-o——— Ethernet Cable The boxes represent processing of the data as it passes through the computer, and the lines connecting boxes show the path of data.
Read more →

Rethinking Cron in Golang

Rethinking Cron Cron is a trusty tool in the unix toolbox for scheduling work to run at periodic intervals. Cron Weaknesses cron is per-machine once you scale to multiple app servers you’ll need locks stored in a shared locatioon (database or memcache) to avoid scheduling the same job twice. Locks require maintenance on those locks - cleaning up stale locks from cronjobs that exited abnormally or got stuck in an infinite loop.
Read more →

Strace the System Microscope

Strace – The system-call tracer A system call, or syscall, is where a program crosses the boundary between user code and the kernel.
通用监控 htop – 现实当前运行进程的多种统计信息
进程排序 t: 现实树状结构 iotop - 现实实时I/O占用信息 lsof - 列出被进程打开的文件信息 ss - 监视网络包的收发情况,以及网络接口的显示信息 专用工具 hyperfine - 快速进行基准测试 参考资料 Strace – The Sysadmin’s Microscope
Read more →

Performance Measuring Profiling Optimizing Tips for Golang

pprof Memory Leaks Memory leaks, or memory pressure, can come in many forms throughout the system. Usually we address them as bugs, but sometimes their root cause may be in design decisions. some common examples of memory pressure issue Too many allocations, incorrect data representation Heavy usage of reflection or strings Using globals Orphaned, never-ending goroutines. Go has several built in profiles for us to use in common cases: goroutine - stack traces of all current goroutines heap - a sampling of memory allocations of live objects.
Read more →

Build Open Source Mirror

Build Open Source Mirror
Build Open Source Mirror Build Google Mirror configure Nginx reverse proxy for the Google search engine. Prerequisties Install Nginx on Ubuntu Secure Nginx with Let’s Encrypt Install two Nginx modules ngx_http_google_filter_module and ngx_http_substitutions_filter_module Install Nginx on Ubuntu Step 1 - Installing Nginx $ sudo apt update $ sudo apt install nginx Step 2 - Adjusting the Firewall $ sudo ufw app list Available applications: Nginx Full - This profile opens both path 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic) Nginx HTTP - This profile opens only port 80 (normal, unencrypted web traffic) Nginx HTTPS - This profile opens only port 443 (TLS/SSL encrypted traffic) OpenSSH Samba Step 3 - Checking your Web Server
Read more →