Understanding Kubernetes' Service Account

Kubernetes’ Service Account is a type of account managed by Kubernetes, which is particularly convenient to manage, but it is not easy to understand the application context when you are new to this type of account. This article is a complete overview that I have read after reading many documents, and I believe it can provide a certain level of understanding of service accounts. Account Types There are two types of Kubernetes accounts.

Three good gRPC testing tools

Recently, we are using Golang to implement microservices, and the communication interface is gRPC. In addition to writing client-side tests in third-party languages supported by gRPC, are there any good tools to verify the interface implemented by gRPC? This year, we saw that Postman announced that it started to support gRPC, so I believe that you are not too unfamiliar with Postman tool, after all, we rely on this tool to test Websocket or RESTful API.

Signing Git commit records using SSH

Git supports using GPG to sign commit records, but GPG is complicated to use. Git started supporting SSH signatures in 2.34, and since we all have SSH keys, it’s time to turn on signatures. But GitHub didn’t support displaying SSH signatures for a long time after this feature was released, so I didn’t push it forward. Yesterday GitHub announced that it officially supports SSH signatures. I’m going to share a little bit about it with you today.

Reflection in Golang

Let’s start with a simple piece of code logic to warm up. What do you think should be printed in the following code? 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 46 47 type OKR struct { id int content string } func getOkrDetail(ctx context.

Talking about the design of processes and threads

The concept of concurrency has been around for a long time, and the main idea is to allow multiple tasks to be executed in the same time period in order to get faster results. The first language that supported concurrent programming was assembly language, but there was no theoretical basis for this type of programming, and a small programming error could make the program very unstable and testing of the program almost impossible.

Talking about synchronization in concurrent programming

Interaction inside concurrent programs Why should we consider the problem of synchronization? In many cases, we need multiple processes or threads to cooperate with each other to complete a task, and multiple serial programs may all have to access a shared resource, or pass some data to each other. In this case, we need to coordinate the execution of the programs. The role of synchronization is to avoid possible conflicts during concurrent access to shared resources, as well as to ensure the orderly passing of information.

Why process fork uses copy-on-write

fork is the most widely used process creation mechanism, where a process can create several new processes, the former called parent processes and the latter called child processes, through the system call fork. In order to reduce the process creation overhead, modern operating systems use copy-on-write techniques, where the parent and child processes share the same memory space, thus enabling a “copy” of the data, which will be analyzed in this article.

Redis Slowlog

Redis’ slow query logging feature is used to log command requests that take longer than a given amount of time to execute, which can be used to analyze and optimize query speed. In this article, we will analyze how Redis’ slow query logging feature is implemented. Redis provides two configuration options for slow logging. slowlog-log-slower-than: specifies how many microseconds a command request will be logged if it takes longer than 10,000 microseconds to execute, the default is 10,000 microseconds.

Redis RDB and AOF Persistence

Redis is an in-memory database that stores data in memory in exchange for faster read speeds. However, because memory is volatile, Redis stored data can be lost once a process quits or a hardware device fails. To solve the data persistence problem, Redis provides two solutions, RDB snapshot and AOF write operation logging, and this article analyzes the implementation of these two sub-cases. The so-called persistence is to back up the server data at a certain point in time to a disk file, so that when the program exits or the server is down, the data can be recovered at the next restart using the previously persisted file.

How Redis achieves high performance with "single thread"

Redis has long been known for its high performance, yet Redis runs as a single thread, which is often contrary to perception. So what mechanisms does Redis use to keep up with the huge volume of processing required? How to achieve high performance with “single threadedness” is the main question explored in this article. The word “single-threaded” is in quotes in the title because Redis is single-threaded in the sense

Implementation principle of cryptographic hash algorithm

Hash function, also known as a hash algorithm, is a method for creating small numerical “fingerprints” from any data (files, characters, etc.). Hash algorithms only need to satisfy the need to map a hash object to another interval, so they can be divided into cryptographic hashes and non-cryptographic hashes depending on the usage scenario. Overview Cryptographic hashes are considered one-way functions, meaning that it is extremely difficult to extrapolate back from the output of a hash function to what the input data is.

Principles of Raft, a distributed consistency protocol

Raft is a consistency protocol based on a message-passing communication model for managing log replication, which allows a group of machines to work as a whole and provide services even if some of them have errors. The Paxos protocol was the first proven consistency algorithm before Raft was proposed, but the principles of Paxos were difficult to understand and engineer. Raft is an implementation of Paxos that aims to provide a better understood algorithm and has been shown to provide the same fault tolerance and performance as Paxos.

A few notable changes in Go 1.19

We know that the Go team redefined the team’s release cadence in 2015, setting the frequency of major Go releases to twice a year, with release windows set for February and August each year. The Go 1.5 release, which implements the bootstrap, is the first release under this cadence. Generally, the Go team releases releases in the middle of these two windows, but there have been accidents in the past few years, for example, Go 1.

Implementing Progressive Release with Argo Rollouts

Argo Rollouts is a Kubernetes Operator implementation that provides more advanced deployment capabilities for Kubernetes, such as Bluegreen, Canary, Canary Analytics, Experimentation, and Progressive Delivery capabilities. Enables automated, GitOps-based incremental delivery for cloud-native applications and services. The following features are supported. Bluegreen update strategy Canary update policies More fine-grained, weighted traffic splitting Automatic rollback Manual judgment Customizable metric queries and business KPI analysis Ingress controller integration: NGINX, ALB Service Grid

Health check for docker containers

Since version 1.12, Docker has introduced a native health check implementation. The simplest health check for containers is the process-level health check, which verifies whether a process is alive or not; Docker Daemon automatically monitors the PID1 process in the container and can restart the ended container according to the restart policy if specified in the docker run command. In many practical scenarios, it is not enough to use the process-level health check mechanism.

Implementation principle of BoltDB

BoltDB is an embedded K/V database implemented in Go language with the goal of providing a simple, fast and reliable embedded database for projects that do not require full database services such as Postgres or MySQL. boltDB has been implemented as the underlying database in projects such as etcd, Bitcoin, etc. This article provides a brief analysis of the design principles of BoltDB. BoltDB is currently archived by the original author, so the version analyzed in this article is the one maintained by etcd: etcd-io/bbolt .

Calculating SLI and SLO with PromQL

Use PromQL to query the Error budget used in the past month, and then display the current SLI. The effect is shown in the following figure. The difficulty of this query is that the contents of the PromQL query are all the values of the time series. For example, the query of memory > 0.6 finds the correspondence of the time and value of all the time series that satisfy the condition.

Linkerd Service Mesh Quick Start

Linkerd is a fully open source Service Grid implementation of Kubernetes. It makes running services easier and safer by providing you with runtime debugging, observability, reliability, and security, all without requiring any changes to your code. Linkerd works by installing a set of ultra-light, transparent agents next to each service instance. These agents automatically handle all traffic to and from the service. Because they are transparent, these agents act as highly instrumented out-of-process network stacks, sending telemetry data to and receiving control signals from the control plane.

Why shouldn't you use useEffect in React to get data from the API directly?

React is a JavaScript library open-sourced by Facebook that can be used to build UI on any platform. A common pattern in React is to use useEffect with useState to send requests, sync state from the API (outside React) to inside React, and use it to render UI, and this article shows you exactly why you shouldn’t do that directly. TL; DR Most of the reasons for triggering network requests

MySQL and InnoDB Storage Engine Summary

MySQL is a widely used relational database, and understanding the internal mechanism and architecture of MySQL can help us better solve the problems we encounter in the process of using it. Therefore, I have read some books and materials related to MySQL InnoDB storage engine, and summarize them in this article. MySQL Architecture Two terms that are easily confused in the database world are database and instance. As common database