Use the ESBuild plug-in mechanism to implement the required functionality

Preface esbuild is a general purpose code compiler and build tool that uses golang builds, it is very fast and 1~2 orders of magnitude higher in performance than the existing js toolchain. It is not yet an out-of-the-box build tool, but with its plugin system we can already do many things. Automatically exclude all dependencies When building libs, we usually don’t want to bundle dependent modules and want to exclude

How Redis handles client requests?

I feel that this part of the code is still quite interesting, and I will try to explain it in a more general way. Overview I remember my article on the Go HTTP Standard Library, which explains how to create a Server-side application for Go. First, register the processor. Start a loop to listen for ports, and create a Goroutine for each connection. Then the Goroutine waits in a loop

Stress testing of Prometheus-compatible timing databases

For comparison between different VictoriaMetrics versions or between VictoriaMetrics and other solutions that support the Prometheus remote_write protocol, VictoriaMetrics provides a dedicated Prometheus-benchmark project. Implementation principle The implementation of this project is actually very simple. Use node_exporter as a source for production-like metrics. use nginx as a caching proxy in front of node_exporter to reduce the load on node_exporter when it crawls too many metrics. Use vmagent to grab node_exporter

Should we use TLS1.3?

Overview SSL (Socket Layer Security) and TLS (Transport Layer Security) are both security protocols whose main purpose is to ensure secure communication between the client and the server; SSL is the older protocol and TLS is the replacement for SSL. SSL versions 1.0, 2.0 and 3.0 and TLS versions 1.0, 1.2 and 1.3. SSL protocol and TLS 1.0 have been disabled due to obsolescence and TLS 1.3 is currently the

Several methods of JavaScript deep copy

0. Shallow Copy vs. Deep Copy Shallow Copy : Creates a new object that has a copy of the original object’s property values. If the property is a basic type, the copy is the value of the basic type, and if the property is a reference type, the copy is the memory address . Without a deep copy, one of the objects changes the value of the object and affects

How to dynamically import ECMAScript modules

ECMAScript (aka ES2015 or ES) modules are a way to organize cohesive blocks of code in JavaScript. The ES module system has 2 parts. import module - use import { func } from '. /myModule' export module - uses export const func = () => {} An import module is a module that imports dependencies using the import syntax. 1 2 3 import { concat } from './concatModule'; concat('a', 'b'); // => 'ab' The imported module uses the export syntax to export components from itself.

A Go developer's experience with Rust

I’ve been following the development of Rust as a language, but I haven’t actually used it. Recently, I was interested in writing something, so I implemented a basic module in both Rust and Go. This article is some of the results of this implementation. I have a long experience with Go, so this article will be relatively accurate about Go, but I have been following Rust for a long time, but the code is basically the result of the last week or so, so my opinion may be biased.

Using Go Swagger to generate OpenAPI definitions

OpenAPI (formerly known as Swagger) is the more popular protocol for defining HTTP APIs. However, the OpenAPI definition file is in a machine-friendly format that is not easy to write and read. Here is a method to generate OpenAPI definition files based on Go code using go-swagger. This method uses only Go code to define the API, and does not force the Server or Client to use Go as well.

The intern.Value property in the new Go 1.18 library netaddr

Go 1.18 introduced the new library netaddr to represent IP addresses and related operations. Its author, Brad Fitzpatrick, wrote a special blog about the design principles and final implementation of this library. The main feature of this implementation relies on the library intern.Value. Here are some of my research and observations on this library The design principle of netaddr is to have a type that can support IPv4, region-free IPv6

Use vmalert instead of Prometheus to monitor alarms

We have already introduced the possibility of using vmagent instead of prometheus to capture monitoring metrics data, to completely replace prometheus there is a very important part is the alarm module, before we are defined in prometheus alarm rules evaluation and sent to alertmanager, the same corresponds to the vm also has a special module to handle alarms: vmalert . vmalert will execute the configured alarm or logging rule for

Monitor GPU resources of Kubernetes clusters

1. Background Notes 1.1 Requirement Description For SRE team, it is critical to implement monitoring of large-scale GPU resources on AI and high performance computing platforms.SRE team can understand workload and other related performance through GPU metrics to optimize resource allocation, improve resource utilization and abnormality diagnosis to improve the overall performance of data center resources. In addition to SRE and infrastructure teams, whether you are a researcher working on GPU acceleration direction or a data center architect, you can understand GPU utilization and work saturation for capacity planning and task scheduling, etc.

Dissecting Linux container implementation principles using Go

Advantages of containers Traditional model deployments, which run multiple applications directly on a physical server, may cause performance degradation of other applications if one of them takes up most of the resources. In the era of virtualized deployments, multiple virtual machines (VMs) can be run on the CPU of a single physical server, with each VM being a complete computer running all components (including the operating system) on top of

Manage VM clusters with Victoria Metrics Operator

The Operator, as we know, is a great tool for Kubernetes, greatly simplifying the installation, configuration and management of applications, and for VictoriaMetrics there is an official counterpart to the Operator for management - vm-operator, which is inspired by prometheus-operator and is a great tool for managing application monitoring configurations. The vm-operator defines some CRDs as follows. VMCluster: defines VM clusters VMAgent : defines vmagent instances VMServiceScrape: defines the metrics

How to use threads in Python 3

1. Introduction In Python 3.9, if there are multiple computational tasks that need to be computed in parallel, they are usually done in a multithreading or coroutine fashion. This article is based on the official Python 3.9 documentation and summarizes some common applications in development. 2. Description A thread is the smallest unit of computational scheduling in the operating system. A process can have multiple threads, which share all system resources of the current process.

Python's New Proposal: "Deprecating" the Global Interpreter Lock GIL | CPython Interpreter Might Get Faster

In a recent post on the Python Foundation blog, developer Alex Waygood touched on a major Python language issue from the Python Language Summit just last week - the “deprecation” of the Python language’s Global Interpreter Lock (GIL). “Double-Edged Sword”: CPython - Interpreter and Compiler The flexibility of Python’s dynamic language is known to be a “double-edged sword”. This means that there can be different runtimes, such as Pyston, Cinder, MicroPython, pypypy, etc.

Adding swap partitions manually for Linux

Swap partition in Linux is actually virtual memory in windows, when the server memory is not enough, it will use swap partition memory. to alleviate the situation of not having enough memory. In the cloud server scenario, the servers provided to us by the cloud vendors are basically without swap partition. Creating a Swap Partition The swap partition uses the local hard disk and uses the capacity of the hard disk as memory.

Webassembly Basics

1. What is webassembly? Historically, virtual machines used to load only JavaScript, and that’s good enough for us, because JavaScript is powerful enough to solve most of the problems people have on the web today. However, when trying to apply JavaScript to areas such as 3D games, virtual reality, augmented reality, computer vision, image/video editing, and a host of other areas that require native performance, we run into performance issues

Usage of Cilium Cluster Mesh, a Kubernetes multi-cluster solution

Cluster Mesh is a multi-cluster implementation of Cilium that helps Cilium achieve multi-Kubernetes cluster management across data centers and VPCs. Cluster Mesh has the following main features. Pod IP routing between multiple Kubernetes clusters through tunneling or direct routing without any gateway or proxy. Use standard Kubernetes service discovery mechanisms. Network policies across multiple clusters. Policies can use Kubernetes native NetworkPolicy resources or the extended CiliumNetworkPolicy CRD. Transparent encryption of

ACE Cache Coherence Protocol Analysis

In recent days, we have analyzed parts of TileLink’s cache coherency protocol, see TileLink Bus Protocol Analysis, and we take this opportunity to study the ACE protocol. The following mainly refers to the IHI0022E version, which is the ACE version corresponding to AXI4. Review Let’s start by reviewing what operations a cache coherency protocol needs to support. For a higher-level Cache, it needs a few things: when reading or writing a miss, it needs to request data from this cache line and update its status, such as read to Shared, write to Modified, etc.

Learn how to add custom debug signals to the Rocket Chip

Background Recently I was trying to add the core as a Tile to the Rocket System, so I wanted to connect the custom debug signals from the core to the top level. The Rocket System comes with support for trace, which outputs instruction information for each cycle of retire, but it’s not quite the same as the custom one, so I researched how to add a custom debug signal and connect it to the top level.