Using Prometheus to extend the kubernetes scheduler

This article will explain in depth how to extend the Kubernetes scheduler with each extension point, and the principles of extending the scheduler, which are required as knowledge points for extending the scheduler. Finally, an experiment will be done to record the scheduler for network traffic. kubernetes scheduling configuration Multiple different schedulers are allowed to run in a kubernetes cluster, and it is also possible to specify different schedulers for

Consistency Problems and Consensus Algorithms for Distributed Databases

When it comes to distributed databases, whether they are centralized databases like Etcd/Zookeeper or decentralized databases like Ethereum blockchain, there are two keywords that cannot be avoided: “consistency” and “consensus”. This article is the notes recorded by me when learning “consistency” and “consensus” and related theoretical knowledge, which can help us understand the difference between Etcd/Zookeeper/Consul/MySQL/PostgreSQL/DynamoDB/Cassandra/MongoDB/CockroachDB/ TiDB, etc., understand the advantages and limitations of each database, understand the meaning of database isolation level and how it should be set, and enable us to choose the applicable database in various application scenarios.

When using Dockerfile to build container images, you should pay more attention to the impact of "line breaks".

NET 6 and SQL Server development environment into a Docker container using Visual Studio Code’s Remote Development today. Although it went smoothly with the documentation, the problem arose after the project was versioned. I think the point of this article is that in today’s containerized, cross-platform era, line breaks actually have to be confronted, or else you’ll be at a loss for what to do. Experience the feeling of developing

PostgreSQL is becoming increasingly popular

Timescale has released a new State of PostgreSQL Survey 2022, which ran from June 6 to June 30, 2022. The survey, which ran from June 6 to June 30, 2022, received 992 responses from developers around the world, and the State of PostgreSQL Survey provides some key insights into PostgreSQL functionality and the broader PostgreSQL community. The first version of the report released in 2019 collected feedback from more than 500 developers, and the second version of the report in 2021 also sampled nearly 500 participants.

What is DevOps

1. The Cause I am a “DevOps engineer”, so I always get asked: “What is DevOps?” This question seems very basic, so basic that many people don’t bother to answer. But in fact, calm down for a second and ask yourself “What is DevOps?” and every DevOps engineer probably knows “what is DevOps”, but they give different answers. So how would I answer this? Let’s talk about it below. 2. Memories I first saw the term DevOps around the fall of 2016.

Linux tree-structured file system

For every Linux learner, understanding the directory structure of the Linux file system is a crucial step to learn Linux well. An in-depth understanding of the standards of the Linux file directory structure and the detailed functions of each directory is very important for us to use the Linux system well. The file system’s are used to organize and arrange file access, so it is visible, in Linux, we can view its structure through tools such as ls, in Linux, we see a tree structure; for example, the operating system is installed in a file system, he behaves as a tree structure starting from /.

Getting started with stimulus.js

The stimulus.js framework is a lightweight JavaScript framework developed by the big name Basecamp, the company that developed the core Ruby on Rails framework. I’ve heard of the stimulus.js framework for a long time, but I’ve never actually used it. Recently, I just had the opportunity to practice in a small project of my own, and have some experience, so I’d like to share a summary. Reminder: If you want to quickly experience the demo made by stimulus.

Getting Started with Service Worker - Rapid Development of Service Worker with Workbox

For optimizing front-end loading performance, many people use http-cache, asynchronous loading, 304 status codes, file compression, CDN and other methods to solve the problem. In fact, in addition to these methods, there is one more powerful than all of them, and that is Service Worker. We can use Google Chrome team’s Workbox to implement Service Worker for rapid development. Registering a Service Worker Add the following to the page to

Python 3.10 native coroutine asyncio in practice

We have always believed that coroutines are a more efficient way to work concurrently than multithreading, and that they are completely controlled by the program itself, i.e., executed in the user state. coroutines avoid the context switching that occurs with thread switching, resulting in significant performance gains. But in fact, coroutines are much more complex than most people think. Because of their “user state” nature, task scheduling is in the

Digital Signing with ECDSA in Golang

ECDSA ECDSA is the famous elliptic curve signature algorithm that provides security comparable to RSA3072 with a 256-bit private key size. The Golang standard library provides crypto/ecdsa, which provides the ability to sign, verify and generate public and private keys. However, in general we do not use Go to generate and save public-private keys, but rather OpenSSL to do so. For the OpenSSL command to generate public-private keys, we generally use prime256v1 or secp384r1, the two recommended curve parameters, here we choose prime256v1.

Solve 2502/2503 error when installing golang on windows

Golang 1.19 was just released and I couldn’t wait to update to the latest version. My OS is Win10 and when I installed it there was an exception. 1 The installer has encountered an unexpected errorinstalling this package. This may indicate a problem withthis package. The error code is 2502. 1 The installer has encountered an unexpected errorinstalling this package. This may indicate a problem withthis package. The error code is 2503.

Using GitHub Actions as a VPN Server

In regions where the Internet is strictly regulated (e.g. China), direct access to well-known websites such as Google, youtube, Twitter, etc. is not available. This article introduces a technique to break through network blocks based on the GitHub Actions service, which allows you to watch YouTube 4k videos smoothly, with unlimited traffic, completely free! GitHub Actions is a free build tool provided by Microsoft for developers. Whenever a task needs to run, GitHub creates a virtual machine (2C4G) in the Azure cloud.

NGINX Dynamic and static mixed path Overlay

I recently came across a requirement to implement something like Overlay FS with NGINX when deploying MediaWiki. Specifically, I was using the Git version of MediaWiki and needed to add some custom files to the directory (such as logos, favicon.ico, various verification files, etc.). I wanted to keep these files separate from the source code in order not to pollute Git and to reduce the hassle when upgrading. To abstract the problem, NGINX needed to serve from /srv/foo/orig, and now it needs to additionally try to search for files from /srv/foo/overlay in addition to the original path (note that unlike Overlay FS, the original path is used first).

Golang Generics in HTTP API

Golang started to support generic types from version 1.8 start, and I believe many people are in the same wait-and-see state as me. Now that Golang has been released to version 1.19, I think it’s a good idea to give it a try. Example of adding two numbers together One of the most common examples of previous calls for Golang to introduce generics is a scenario like adding two numbers together.

How to implement hot reload config

Sometimes some processes must inevitably have the problem that restarting is too costly. For example, there are processes with long connections where restarting will disconnect and then all clients will need to reconnect, or processes that already have a lot of content cached in memory that will need to be rewarmed if restarted. But then there are configurations where we want to modify the configuration of the process without restarting it.

Compiling Rust projects with Nix

Rust projects are generally managed with Cargo, but it has the disadvantage of having to recompile all dependencies once per project, taking up a lot of hard disk space, and not being able to share the build cache across projects. After some research, there are several Nix-based Rust build tools: cargo2nix: https://github.com/cargo2nix/cargo2nix carnix: no longer updated crane: https://github.com/ipetkov/crane crate2nix: https://github.com/kolloch/crate2nix naersk: https://github.com/nix-community/naersk nocargo: https://github.com/oxalica/nocargo I’ll try out each of these tools below.

From .go text files to executable files

Go is a compiled language, and the *.go text files we write are called source files, and the contents of the source files are our source code. For the source code to run on the target machine, it must be compiled into a binary machine code file, or executable, that is directly recognized by the operating system using the Go compiler (abbreviated gc, which stands for Go compiler). The operating

volatile in C

When learning C language there is a strange keyword volatile, what exactly is the use of this? volatile and the compiler First look at a piece of code like this. 1 2 3 4 5 6 7 int busy = 1; void wait() { while(busy) { ; } } Compile it and note that O2 optimization is used here: Let’s take a closer look at this generated assembly. 1 2 3 4 5 6 7 8 9 wait: mov eax, DWORD PTR busy[rip] .

void_t in C++17

I recently discovered an interesting feature: void_t. void_t is a new feature introduced in C++17, and its definition is simple (some compiler implementations may not be, but they are broadly similar). 1 2 template< class... > using void_t = void; It looks simple, but with SFINAE it can be very useful in template metaprogramming. For example, determining at compile time whether a class has a certain type using. 1 2 3 4 5 6 template <class, class = std::void_t<>> struct has_type : std::false_type {}; template <class T> struct has_type<T, std::void_t<typename T::type>> : std::true_type {}; For example, to determine if a member is present.

DNS Query Principle Explained

The IP address of the domain name is obtained by DNS lookup in order to access the website. So, how exactly does a DNS lookup work? This article describes the steps behind it in detail with examples. 1. DNS Servers The IP addresses corresponding to domain names are stored in DNS servers. When we enter a domain name, the browser will automatically send a request to the DNS server in the background to get the corresponding IP address.