In-depth learning of the Python import mechanism

When I was learning Python, I basically skimmed over how to import modules and packages. The reason for this is not only that the syntax of importing is very simple, but also that at the early stage of learning, you will not be involved in large projects, nor will you be writing your own modules and packages, so you will not encounter any problems here. In the process of using

Python Iterators and Generators

We all know that in Python we can for loop to iterate through a list, tuple or range object. So what is the underlying principle? In understanding Python’s data structures, containers (container), iterable objects (iterator), iterators (iterator), generators (generator), lists/sets/dictionary comprehensions (list, set, dict comprehension), and many other concepts are mixed together to make beginners confused. The relationship between them. container A container is a data structure that organizes multiple

Load Balancing Technology for LVS

LVS is the abbreviation of Linux Virtual Server, which means Linux Virtual Server, a virtual server clustering system. LVS is a free software project initiated by Dr. Wen-Song Zhang, and is mainly used for load balancing of multiple servers. It works at the network layer and can achieve high performance, high availability server clustering technology. It is cheap and can combine many low performance servers together to form a super server.

Unsafe and ByteBuffer things

Starting with the constructor of DirectBuffer The off-heap memory opened by DirectBuffer is actually allocated through Unsafe, take a look at the constructor of DirectBuffer. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 DirectByteBuffer(int cap) { // package-private super(-1, 0, cap, cap); boolean pa = VM.isDirectMemoryPageAligned(); int ps = Bits.pageSize(); long size = Math.max(1L, (long)cap + (pa ?

Running a highly available Kafka cluster on Kubernetes

Apache Kafka is the most popular distributed messaging publish-subscribe system available today. While Kafka is very powerful, it is equally complex and requires a highly available and robust platform to run. In a world where microservices are prevalent and most companies are adopting distributed computing, it is still very advantageous to use Kafka as a core messaging system. If you run your microservices in a Kubernetes cluster, it makes sense to run a Kafka cluster in Kubernetes to take advantage of its built-in resiliency and high availability, and we can easily interact with Kafka Pods within the cluster using the built-in Kubernetes service discovery.

How to understand Python decorators

Introduction to Decorators A decorator is a high-level Python syntax. It can be used to process a function, method, or class. In Python, we have several ways to process functions and classes. Compared to other ways, decorator syntax is simple and the code is highly readable. As a result, decorators have a wide range of applications in Python projects. Decorators are often used in scenarios with tangential requirements, some classic

Redis Large Cluster Scaling Performance Optimization Practices

Background In the existing network environment, some businesses using Redis clusters often need to perform node expansion operations as their business volume rises. I have previously learned that after some operations and maintenance students expanded Redis clusters with a large number of nodes, the business side reported a decrease in cluster performance, as evidenced by a significant increase in access latency. Some businesses are sensitive to Redis cluster access latency,

How to hot load jars for Spring Boot to implement dynamic plugins?

Background Dynamic plug-in programming is a cool thing to achieve decoupling of business functions for easy maintenance, in addition to enhance scalability can be extended at any time without stopping the server, but also has a very good openness in addition to their own R & D staff can develop features, but also to accept third-party developers in accordance with the specifications of the development of plug-ins. The common implementation of dynamic plug-ins are SPI, OSGI and other solutions, which cannot be injected into the main program’s bean objects in the plug-in because they are not managed by Spring IOC.

Python GUI framework PyQt5

There is not really much software that uses Python to develop graphical interfaces. Compared to GUI interfaces, probably Web way applications are more popular. But for other programming languages like me you such as C# or WPF may not be a good tool. Common GUI frameworks PyQt5: Qt is a cross-platform C++ GUI library. QT was once owned by Nokia and then sold to Digia, a Finnish software company. Oyj.

Pandas read and export Excel, CSV files

When you use Pandas to process data, it is common to read data from Excel or CSV files, and sometimes you need to export the processed data to Excel or CSV files. Today, we will learn how to read and export common Pandas files. Loading Excel files In Pandas, the Excel file reading method is: pd.read_excel(). The specific passable parameters are. 1 pandas.read_excel(io, sheet_name=0, header=0, names=None, index_col=None, usecols=None, squeeze=False, dtype=None, engine=None, converters=None, true_values=None, false_values=None, skiprows=None, nrows=None, na_values=None, parse_dates=False, date_parser=None, thousands=None, comment=None, skipfooter=0, convert_float=True, **kwds) Where.

TypeScript Enumeration Guide

Enumerations are data types that are supported by TypeScript. Enumerations allow you to define a set of named constants. Use them to more easily document intent or create a different set of cases. Mostly used in object-oriented programming languages such as Java and C#, enumerations are now also available in TypeScript. They are one of the few features of TypeScript that is not a type-level extension of JavaScript. Next I

Golang - About Pointers and Performance

A pointer is an address value that points to the start of an area of memory. So you need to have a good knowledge of computer composition principles. Generally speaking, it is important to maintain a deep memory of what is told in this course and then accumulate it day by day to really reach an understanding. The concept of a pointer in a high-level language is not fundamentally different from a pointer on a low-level interface.

golang from kernel to epoll

Basic implementation of linux networking In the TCP/IP network hierarchy model, the entire protocol stack is divided into physical layer, link layer, network layer, transport layer, and application layer. The physical layer corresponds to the grid card and the grid line, and the application layer corresponds to various applications such as Nginx, FTP, etc. Linux implements the link layer, the grid layer, and the transport layer. In the Linux kernel

Shopee ClickHouse Cold and hot data separation storage architecture and practice

Shopee ClickHouse is a highly available distributed analytical database based on the open source database ClickHouse for secondary development and architectural evolution. This article will focus on Shopee ClickHouse’s hot and cold storage architecture and the practices that support the company’s business. Shopee ClickHouse’s hot and cold storage architecture uses JuiceFS clients to mount remote object storage to the local machine path, and uses remote object storage as if it were multi-volume storage by writing ClickHouse storage policies.

CSS content's new replacement element specification behavior explained

Can a normal element become a replacement element By replacement elements, we usually mean elements such as images, videos, etc., corresponding to HTML tags <img> and <video>, while elements such as <div>, <p>, <span>, etc., which are normally used for layout, are non-replacement elements. In fact, from 2019 onwards, the above rule has become inaccurate, or a rule that only holds under constraints. In other words, elements such as <div>,

Talk about some tips for using Unsafe

I remember when I first learned Java, just after learning the syntax basics, I came across reflection, a feature provided by Java, although it seems to be a very basic knowledge point now, but at that time, I was undoubtedly excited, and I instantly felt that I was out of the “Java beginner” team. As I gained experience, I gradually learned a lot of similar points that I was excited about, and the Unsafe technique was definitely one of them.

Illustrating Kubernetes Ingress

Kubernetes Ingress is just a common resource object in Kubernetes that requires a corresponding Ingress Controller to resolve Ingress rules and expose the service to the outside, such as ingress-nginx, which is essentially just an Nginx Pod that then redirects requests to This Pod itself is also exposed through the Kubernetes service, most commonly through LoadBalancer. Again, this article wants to give you a simple and clear overview of what’s behind Kubernetes Ingress to make it easier for you to understand the Ingress in use.

Write a do-it-yourself Kubernetes YAML templating tool

When we write resource manifest files with Kubernetes, we often use tools like Helm or Kustomize for templating, both to improve the flexibility of resource manifests and to really lower the threshold for installing complex Kubernetes applications. In this article we try to implement a YAML resource manifest file templating solution ourselves using Golang. Golang’s Templating Golang has a standard library text/template that supports templated text files. This library allows

Understanding Linux network namespaces

In this article I will demonstrate how to use the command to connect processes in different subnets of the network namespace through a pair of veth interfaces. Network Namespaces We know that the container runtime uses the namespace (namespace) kernel function to partition system resources for some form of process isolation, so that changes to resources in one namespace do not affect resources in other namespaces, including process IDs, host

Adding DNS records to Pods

We all know that Pods in a StatefulSet have separate DNS records. For example, if a StatefulSet is named etcd and its associated Headless SVC is named etcd-headless, CoreDNS will resolve an A record for each of its Pods as follows. etcd-0.etcd-headless.default.svc.cluster.local etcd-1.etcd-headless.default.svc.cluster.local …… So can other Pods besides the one managed by StatefulSet also generate DNS records? As shown below, we only have a Headless SVC here, not a Pod managed by StatefulSet, but a Pod managed by ReplicaSet, and we can see that it seems to generate resolution records similar to those in StatefulSet.