Use the curl command to analyze the time consumed by the request

I recently ran into a problem at work where the response to a request was particularly slow, so I wanted a way to analyze which step of the request was taking longer so I could find the cause of the problem further. After searching the web, I found a very useful method, the curl command, which can help you analyze the time spent on each part of the request. The curl command provides the -w parameter, which is explained in the manpage as follows

JavaScript(ECMAScript) Decorator

Decorator is just a standard in ECMAScript, JavaScript doesn’t implement this standard syntax, so we can’t use Decorator syntax directly. But because Decorator is so nice, Babel provides plugins that allow us to use the Decorator syntax in javascript. What is a Decorator? A Decorator is a normal JavaScript function (pure function is recommended) used to change the members (properties, methods) of a class and the class itself. When you

Property Descriptor for JavaScript objects

JavaScript is essentially a data structure that stores key-value pairs, but unlike maps and dictionaries, JavaScript objects are highly configurable. When an object is created and properties are added to that object, each property has a default property descriptor associated with it. A property descriptor is a javascript object that contains some information about the corresponding property, such as value. Object.getOwnPropertyDescriptor To get the property descriptor of a property, you can use the static method Object.

Emacs Package Management Guide

For Emacs users, optimizing their configuration is fun and a sure way to become an Emacs expert. Generally speaking, a novice’s configuration is pieced together, which is the fastest and most efficient way to learn. As you get deeper into Emacs, the configuration becomes more complex, and it is hard to imagine continuing to have fun with Emacs without refactoring your previously disorganized configuration. This article will introduce my personal

Trait use and principle analysis

Among Rust’s design goals, zero-cost abstraction is an important one, giving Rust the power of high-level language expression without the performance penalty. The cornerstones of zero-cost abstraction are generics and traits, which compile high-level syntax into efficient underlying code at compile time, enabling efficient runtime. This article introduces trait, including how it is used and an analysis of three common problems, to illustrate the principles of its implementation in the

Rust, I got you.

I’ve been using Rust for more than two years now, and despite countless struggles with the compiler, I still encounter problems from time to time that I can’t understand, not to mention newbies. What could be written in a few hours before may take a day with Rust, so it’s important to document some of the questions you have with Rust to deepen your understanding of the problem. RAII A

How to call Go code in Java?

The general procedure for calling Go in Java is as follows 1 go --> cgo --> jna --> java There are two main problems to be solved in the whole process. how to transform data types in both languages when to clean up the useless data The following is the process around the above call to elaborate, this article involves the full version of the code can be found in

Go struct/interface best practices

I’ve been using Go for a year now and am deeply immersed in its simplicity of design, as described on its website. Go is expressive, concise, clean, and efficient. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language. Rob Pike in Simplicity is Complicated also mentions Go’s simplicity as an important reason for its popularity. Simplicity does not mean simplicity, and Go has a

Linux File System

Reading and Writing Files Let’s start by talking about reading and writing files, and what’s going on behind the scenes when we try to write a string of characters to a file, like the following lines of Python code. 1 2 3 f = open("file.txt", "w") f.write("hello world") f.close() With the strace command, it is easy to see which system calls are used behind this line of command. 1 2 3 4 5 6 7 8 $ strace python justwrite.

Features of Modern C and the experience of using it

Even if we count from K&R C in 1978, C will be 44 years old in 2022. I don’t know what C looks like in the reader’s mind, but I have the impression that C has poor expressiveness, only two high-level data structures, arrays and pointers, a small standard library and many historical problems, and no package management mechanism. The most fatal thing is that memory needs to be managed

State Management in RisingWave

RisingWave is a recent open source Rust written cloud native streaming database product. Today a brief description of the state management mechanism in RisingWave based on the following diagram. Hummock Overview In RisingWave’s architecture, the storage of all internal state and materialized views is based on a set of stores called Hummock, which is not a storage system but a storage library. Hummock is not a storage system, but a storage library, and Hummock currently supports S3 protocol-compliant storage services as its backend.

Build Docker images with multi-system architecture support

This article documents my experience in building Docker images for multi-system architectures, as well as some of my personal understandings. Pre-requisite knowledge CPU architectures The mainstream CPU architectures are of two types: x86 and ARM, but they are not always named as such during development. For example, amd64 and x86_64 refer to the 64-bit architecture of x86, while arm64v8, aarch64, and arm64 refer to the 64-bit architecture of ARM. In the docker hub, the supported architectures are listed for all major images, and you can filter the images by Architectures.

GCC 12 introduces more C++23-oriented implementations

As with every major GCC release, GCC 12.1, which will be released this week, brings many new features, improvements, and bug fixes. In a recent blog post, Red Hat’s Marek Polacek outlines some of the C++ language improvements that have been made in this major GNU Compiler Collection update. Polacek notes that a total of several C++23 proposals are implemented in GCC 12. The default dialect in GCC 12 is -std=gnu++17; to enable C++23 features, you need to use the -std=c++23 or -std=gnu++23 command-line option, the latter of which allows GNU extensions.

libvirt Principles and Practices

Libvirt is a set of open source software tools developed by Redhat. The goal is to provide a common and stable software library to manage virtual machines on a node efficiently and securely, and to support remote operations. Libvirt shields different virtualization implementations and provides a unified management interface. Users only care about the high-level functions, and the implementation details of VMM should be transparent to end users. libvirt then

C++ Asynchronous Programming in gRPC

Overview Since gRPC’s asynchronous call code is rather convoluted, this article is mainly used to document gRPC’s asynchronous calls. Note that gRPC uses the CompletionQueue binding for RPC calls in order to implement asynchronous calls, which can feel strange when writing the actual code. The response, because it is asynchronous, calls CompletionQueue::Next to wait for the packet return operation. Leave an impression here first, it will be clearer when talking

Kubevirt Managing Virtual Machines

kubevirt connects the VM management interface to kubernetes in the form of a CRD, using libvirtd to manage VMs by means of a pod to achieve a one-to-one correspondence between pods and VMs, to manage VMs as containers do, and to do the same resource management and scheduling planning as containers do. All the code involved in this article can be found in my Github. Background CRD Design Kubevirt implements

[Network Virtualization] VLAN

Why VLANs are needed What is VLAN A LAN can be a network of a few home computers or a corporate network of hundreds of computers, and a VLAN (Virtual LAN) refers specifically to a network that is segmented using routers - that is, a broadcast domain. Let’s review the concept of a broadcast domain here. The Broadcast Domain is the range to which a broadcast frame (with a destination MAC address of all 1s) can pass, i.

[Network Virtualization] MacVLAN

Macvlan allows you to configure multiple virtual network interfaces on a single network interface of the host, these network interfaces have their own independent MAC addresses, or can be configured with IP addresses for communication. virtual machines or container networks under Macvlan are in the same network segment as the host and share the same broadcast domain. macvlan is more similar to Bridge, but because it eliminates the Bridge, it is simpler and more efficient to configure and debug.

[Network Virtualization] Vxlan

VXLAN is Virtual eXtensible Local Area Network, a virtual extensible local area network. It is an overlay technology that builds a virtual layer 2 network over a layer 3 network. rfc7348 (Ref. 1) describes it as follows. A framework for overlaying virtualized layer 2 networks over lay 3 networks. Every technology that comes out has a problem to solve, and VXLAN is no exception, so let’s take a look at what problems VXLAN is trying to solve.

[Network Virtualization] IPVlan

IPVLANs are similar to MACVLANs in that they both virtualize multiple virtual network interfaces from a single host interface. An important difference is that all virtual interfaces have the same mac address and different ip addresses. Because all virtual interfaces share a mac address, there are some things to keep in mind. The DHCP protocol generally uses the mac address as the machine identifier when assigning an ip. In this case, the client needs to configure a unique ClientID field when dynamically acquiring the ip, and the DHCP server should be properly configured to use this field as the machine identifier instead of using the mac address Ipvlan is a relatively new feature of the linux kernel.