Deploying a production cluster using the Loki microservice model

We mentioned earlier the monolithic and read-write separation modes of Loki deployment, and when your daily log size exceeds terabytes, then we may need to use the microservice mode to deploy Loki. The microservice deployment pattern instantiates Loki’s components as distinct processes, each of which is invoked and assigned a target, and each of which generates a gRPC server for internal requests and an HTTP service for external API requests.

Why is eBPF so popular?

The eBPF is a register-based virtual machine originally designed to filter network packets, and is known as the Extended Berkeley Packet Filter (eBPF) since the original paper was written at the Lawrence Berkeley National Laboratory. This paper will explain why eBPF is so popular in easy-to-understand language. Introduction to eBPF In layman’s terms, eBPF is a custom program that runs in the kernel of the operating system when triggered by an event.

HTTP/3 Principles and Practices

After the HTTP/2 standard was published in 2015, most major browsers also supported the standard by the end of that year. Since then, with the advantages of multiplexing, header compression, server push, HTTP/2 has been favored by more and more developers. Unknowingly, HTTP has already reached its third generation. Tencent also follows the technology trend, and many projects are gradually using HTTP/3. In this article, we talk about the principle of HTTP/3 and the way of business access.

Resolving K8s scheduling imbalances

1. Preface In our recent work, we found that some nodes in the K8s cluster had high resource usage and some nodes had low resource usage. We tried to redeploy the application and evict the Pod, but found that it did not effectively solve the load imbalance problem. After learning the Kubernetes scheduling principle, we retooled the Request configuration and introduced the scheduling plugin to finally solve the problem. This

What happens when you delete namespace in k8s

1. Overview Namespace is an important concept in kubernetes, an abstraction of a set of resources and objects, often used to isolate different users. namespace has many resources under it, such as our common deployment, pods, service, ingress, configmap, and so on. Of course, the focus of this article is on what happens when namespace is deleted. A typical scenario is when executing kubectl delete ns test in the terminal, we will observe that after executing the command, the test namespace will immediately enter the terminating state, and will only be actually deleted after a few seconds.

Garbage collection mechanism in kubernetes

1. Overview A running kubernetes cluster stores a lot of interrelated resources, such as deployment, replicaset and pod, which are a set of related resources that we commonly use. When we create a deployment, the relevant controller automatically creates the replicaset, and then the controller of the replicaset creates the pod to run the service we deployed. This mechanism is called garbage collection (hereinafter referred to as GC). In earlier

Recovering mysql data via binlog

binlog is a binary file saved by mysql, which can be used to recover data, synchronize data, etc. If you want Mysql to generate binlog automatically, you need to turn it on in the configuration file. If you don’t know where your mysql default configuration file is? You can find it with the following command. 1 2 3 mysql --help | grep 'Default options' -A 1 /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf vim /etc/my.

Mv and Rename

I had an interesting question today: “What happens if I Ctrl C in the middle of an mv operation? Will the file be corrupted?” Without considering error handling, this question needs to be discussed in separate cases. Is it on the same file system? Is the object of the mv a file or a folder? First, the simplest case: mv a file on the same filesystem, where mv is done using rename syscall.

Dynamic Password Algorith

Dynamic password, also known as One Time Password (OTP), is an efficient, simple and relatively secure password generation algorithm, which can be found everywhere in our lives and work, and as developers, we have more or less integrated two-step authentication mechanism in our business systems. So, what is the principle of dynamic password algorithm? Pre-reading guide With this article, you can learn about the following. Background knowledge of dynamic passwords

Beware of monkey patches and tips for troubleshooting monkey patches in Python

Background Two nights ago, the online system suddenly broke down, and after immediately opening the online error log, I only got a bunch of meaningless program call stack (traceback) output, so the team members were caught in a long and blind problem solving process. The problem was fortunately solved, but I couldn’t figure out why the call stack printed in the log was meaningless when, as a rule of thumb,

Gulp for front-end automated builds

The core of this post is an introduction to Gulp, a powerful taskflow tool. The reason why it is titled “Gulp for front-end automated builds” is that Gulp itself is an npm package written in JS that runs in a Node environment, and most developers also use it as an automated front-end project build tool for front-end projects. However, essentially, Gulp is not just for front-end build automation, but also

Linus Torvalds: Rust For Linux may be merged into the Linux 5.20 kernel

At the recent LINUX Foundation-Open Source Summit, Linus Torvalds, talking about “The Possibility of Rust in the LINUX Kernel”, said that he expects to merge the Rust infrastructure in the kernel soon (maybe even in the next version of Linux 5.20). While no Rust requests for Linux have been sent in or merged yet, the Linux kernel has seen initial support for Rust in terms of basic implementations, such as some basic example drivers and so on.

Detecting goroutine leaks with goleak

As we all know, the design of gorourtine is a core component of the concurrent implementation of the Go language, easy to get started, but also encounter a variety of difficulties, of which goroutine leakage is one of the major problems, and its appearance often requires a long time to troubleshoot. Some people say you can use pprof to troubleshoot, but although it can serve the purpose, these performance analysis

Data Race Detection and Data Race Patterns in Golang

uber, an early adopter of the Go language, is also a “heavy user” of the Go technology stack. uber’s internal Go code repository has 5000w+ lines of Go code and 2100 Go-implemented standalone services, so the scale of Go applications is estimated to be among the top 3 in the world. ber not only uses Go, but often exports their experiences and lessons learned from using Go. The blogs of uber engineers are a vehicle for these high-quality Go articles, which are worth reading and experiencing again and again for gophers who want to “go deeper”.

Design specifications for the Open API

Background Recently, due to business requirements, I participated in the development of the cloud product CSB need to open the Open API to the public, originally it was not a difficult task, because our internal Open API open mechanism has been very mature, there is no need for me to design, but this time the demand is mainly for some independent deployment scenarios, the need to design a set of specifications, that means, the need for Open API for That means that there is a need for some specification constraints on the Open API, so I have this article.

Can Podman Desktop replace Docker Desktop?

Podman is an open source container management tool released by RedHat, originally intended to be an alternative to Docker. It is similar to Docker in use, but has significant differences. The biggest difference between it and Docker is the architecture. Docker is run on a C/S architecture, we usually use the docker command is just a command-line front-end, it needs to call dockerd to complete the actual operation, and dockerd by default is a daemon with root privileges.

Meta's "Transparent Memory Offload" feature unveiled: 20%-32% memory savings for Linux servers

Just now, a team of Meta (formerly Facebook) engineers blogged about a new Linux kernel feature called Transparent Memory Offloading (TMO), which can save 20% to 32% of memory per Linux server. to 32% of memory per Linux server. The feature is said to be available in Facebook/Meta servers in 2021, and the team has successfully upgraded the operating system components of TMO to the Linux kernel. Transparent Memory Offload (TMO) is Meta’s solution for heterogeneous data center environments, introducing a new Linux kernel mechanism that measures in real time the work lost due to resource shortages between CPU, memory and I/O.

How to safely handle decimal type data in Go + Mysql

In e-commerce or finance-related scenarios, data such as product prices involve the representation or calculation of decimals, and there is a risk of precision loss if you use the built-in floating-point types of programming languages. In the application area, the decimal type was created, and the MySQL database has built-in support for the decimal data type, while programming languages generally have standard libraries or third-party libraries that provide implementations of the decimal type.

4 common ideas of database data encryption

Recently, due to work requirements, I did research and study on the European General Data Protection Regulation, in which there is a very important point, which is also common sense, is the need to do a good job of encrypting and storing the user’s personal privacy data to avoid the leakage of the user’s private plaintext data. Solution Analysis Thinking about how to do a good job of encrypting user privacy data can start with an analysis of a typical data read/write link.

Workqueue in Kubernetes

Generic Queues In kubernetes, using go’s channel can’t satisfy kubernetes application scenarios, such as delaying, rate-limiting, etc.; there are three kinds of queues in kubernetes: common queue, delaying queue, and rate limiters queue. Inferface Interface is defined as an abstraction of all queues. 1 2 3 4 5 6 7 8 type Interface interface { Add(item interface{}) Len() int Get() (item interface{}, shutdown bool) Done(item interface{}) ShutDown() ShuttingDown() bool }