I first learned about the concept of Web Components in 2019 and only recently started trying to use it, this will be a brief introduction to Web Components, understanding its standards, what problems it solves and its advantages, the interface API it provides, the level of compatibility This article will briefly introduce Web Components, learn about its standard, what problems it solves and its advantages, the interface API it provides,
Using ref to get dom elements in Vue3's setup
Background question How to get focus for input in vue3? How does vue3 setup syntactic sugar get the dom element? The vue2 approach In vue2, after setting the ref property on a component, you can access the corresponding DOM element via this.$refs.ref. 1 <input type="text" ref="inputRef" /> In JavaScript you can access. 1 this.$refs.usernameInput If you need to focus on the input box. 1 this.$refs.usernameInput.focus() vue3 There are no $refs
Protocol Buffers Encoding
In today’s cloud era gRPC is very popular, and the default serialization encoding of gRPC Protocol Buffers is also popular. It is said that Protocol Buffers is very efficient, but what is it? Today we will discuss the coding rules of Protocol Buffers. There are basically two types of objects in the code, one with a fixed length, such as int32 occupying 32 bits and double occupying 64 bits, and
Understanding the gRPC Protocol
gRPC is Google’s open source RPC protocol framework. Because it comes with the aura of a big company, the use of gRPC is also becoming more and more widespread. So should we use gRPC when we make technology choices? This requires consideration of both positive and negative aspects. If gRPC is good, what is it good for? What does it sacrifice for this good? What problems do we face in
Implementing a simple gRPC client using Golang
I recently mentioned the gRPC protocol in a discussion with a friend, and I’ve written about gRPC before. People usually use the official grpc library to communicate directly. But as far as I can see, most of them are Unary requests and very few are stream calls. Unary requests of gRPC are not much different from ordinary http/2 calls, so we can write a simple gRPC client by ourselves. Today,
Zero-Copy Optimization in the Golang
Anyone familiar with the Go language should be familiar with interfaces and methods such as io.Copy()/io.CopyN()/io.CopyBuffer()/io.ReaderFrom. They are APIs that are often used to transfer data using Go to manipulate various types of I/O. The TCP-based socket makes use of Linux’s zero-copy technologies sendfile and splice when transferring data using these interfaces and methods.
splice After looking through Linux zero-copy techniques, splice is more suitable as a general-purpose zero-copy method than other techniques such as mmap, sendfile and MSG_ZEROCOPY in terms of cost, performance and applicability.
Lifecycle Management Design Patterns in K8s
Containerized applications managed by cloud-native platforms have no control over their lifecycle, and to be good cloud-native , they must listen to events issued by the management platform and adjust their lifecycle accordingly. The hosted lifecycle model describes how applications can and should react to these lifecycle events. Existence of problems health probes we explain why containers provide APIs for different health checks. health check APIs are read-only endpoints that
Centralized data management of multiple Prometheus instances with Thanos
1. layering of monitoring As shown above, two strategies are used when building a monitoring system:
The advantage of separating IaaS, MySQL middleware, and App tier monitoring is that the systems are highly available and fault-tolerant to each other. When the App tier monitoring does not work, the IaaS tier monitoring will immediately show up. Separation of long and short term metrics. Short-term metrics are used to provide alerting systems with high frequency queries for recent data, and long-term metrics are used to provide people with queries for data sets that span a larger period of time.
Automatic scheduling design pattern in K8s
Automated Placement is a core feature of the Kubernetes scheduler that is used to assign new Pods to nodes that meet container resource requests and comply with the scheduling policy. This pattern describes the principles of Kubernetes’ scheduling algorithm and the way it influences scheduling decisions from the outside. Problems A reasonably sized microservices-based system consists of dozens or even hundreds of independent processes. Containers and Pods do provide good
Timed Job Design Pattern in K8s
The Timed Job mode extends the Batch Job mode by adding a time dimension and allows a unit of work to be executed triggered by an event at that time.
Existence of problems In the world of distributed systems and microservices, real-time and event-driven application interaction using HTTP and lightweight messaging is a clear trend. However, regardless of the latest trends in software development, Job scheduling has a long history and it is still relevant.
Daemon Service Design Pattern in K8s
Daemon Service mode allows for scheduling and running high-priority, infrastructure-focused Pods on target nodes. administrators primarily use it to run node-specific Pods to enhance the Kubernetes platform. Existence of problems The concept of daemon processes in software systems exists at many levels. At the operating system level, a daemon is a long-running, self-recovering computer program that runs as a background process. In Unix, daemon names end with a “d”, such
Single Service Design Pattern in K8s
The Singleton service pattern ensures that only one instance of an application is active at a time, yet highly available. This pattern can be implemented from within the application, or can be delegated entirely to Kubernetes.
Existence of problems One of the main features provided by Kubernetes is the ability to easily and transparently scale applications. pods can be forced to scale with a single command (e.g. kubectl scale), or declaratively with a controller definition (e.
How to switch from Webpacker to CSS/JS bundling
One of the notable features of the recent Rails 7 release is CSS/JS bundling, which replaces Rails 6’s Webpacker.
Rails now creates projects that will add two parameters.
1 2 -j, [--javascript=JAVASCRIPT] # Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup] -c, [--css=CSS] # Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass...] For example, to use esbuild and sass you can use the following command.
1 $ rails new myapp -j esbuild -c sass But most people are probably concerned about how to switch from an existing project to a new solution, as explained further below.
Rails on Docker: Build a development environment with Docker Compose
Why use Docker First of all, why should I use Docker in a development environment when it’s better to build it directly on my local system? Using Docker in a development environment provides the following benefits. Solidify the development environment into a configuration file, which makes it easy for new developers to start. Isolating system dependencies across projects to avoid interactions. Make the development environment as close to the production
Lifetimes in Rust
The things that make the lifetime annotation syntax awkward for me are
it’s not a real type because it can’t be instantiated like a real type, but it can be passed into the type parameter of a generic type like a real type, and it does have covariant inversion for real subtyping it can also be used as a type constraint like Trait, in addition to other lifetime annotations like 'a: 'b, it can also be constrained with normal types like T: 'a.
Can you answer this Go question correctly?
Bartłomiej Płotka, chief software engineer at Redhat and maintainer of projects such as Prometheus, asked a Go question on twitter with the following title.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 func aaa() (done func(), err error) { return func() { print("aaa: done") }, nil } func bbb() (done func(), _ error) { done, err := aaa() return func() { print("bbb: surprise!
How to Distribute Files and Scripts to Vm Under Kubernetes
1. What this article is about Growth in business volume and evolution of business forms require solid and robust IT systems to support them. Business content is transparent to the market, but IT systems can’t be built overnight. The competition between companies in the future will mainly come from the competition between IT systems, and the ability to respond quickly to business needs is the key to victory.
IT systems are constantly evolving.
Kubernetes, cluster federation, and resource distribution
Kubernetes has claimed to support 5,000 nodes in a single cluster since an earlier release, and there are no plans to increase the number of nodes supported by a single Kubernetes cluster in the near future. If you need to support more than 5,000 nodes in Kubernetes, Federation is the preferred method of cluster federation.
People frequently ask how far we are going to go in improving Kubernetes scalability. Currently we do not have plans to increase scalability beyond 5000-node clusters (within our SLOs) in the next few releases.
Commonly used encryption algorithms in programming
Preface There are several common encryption algorithms in programming, and they each have applications in different scenarios. All encryption methods except the message digest algorithm will require a key. Message digest algorithm Symmetric encryption algorithm Asymmetric encryption algorithm Key A key (key, also often called golden key) is some secret information used to accomplish encryption, decryption, integrity verification, and other cryptographic applications. Key classification Keys in encryption and decryption: share
How to Configure NetworkPolicy for NodePort in Kubernetes
1. Background of requirements As shown above, the business side needs to isolate the namespae’s service by disabling load access to the bar space and allowing users to access the service from the Load Balancer (LB) via NodePort. A network policy can be easily written.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: test-network-policy namespace: foo spec: podSelector: matchLabels: {} policyTypes: - Ingress ingress: - from: - ipBlock: cidr: 10.