dreamjz Knowledge Base

website·Indexed 30 days ago

https://dreamjz.github.io/

A personal collection of technical notes and study materials covering Go (Golang) design and implementation, data structures and algorithms (including stacks, heaps, and dynamic programming), Japanese language learning, and DevOps topics such as Docker, Nginx, and GitHub Actions.

Tokens
344.2K
Snippets
1.6K
Records
2.1K
Agent score
75%

What's inside dreamjz

  1. Overview of Redis Data Types and Application Scenarios

    Redis provides several data types, each suited for specific use cases. The core types are implemented using various underlying data structures to optimize for time and space complexity based on the volume of data.
  2. Overview of Go pprof profiling types

    Go provides several types of performance profiling to identify bottlenecks in an application:

    • CPU Profiling: Records the stack traces of running goroutines every 10ms to identify 'hot paths' where the most execution time is spent.
    • Memory Profiling: Records stack traces for heap memory allocations. It is sampling-based (default 1 sample per 1000 allocations) and ignores stack allocations.
    • Block Profiling: A Go-specific profile that records time spent waiting on shared resources, such as unbuffered channels, empty/full channels, or exclusive locks.
    • Mutex Profiling: Similar to block profiling but focuses specifically on delays caused by lock contention.
  3. Overview of GeeRPC features

    GeeRPC is a framework implemented based on Go's standard net/rpc library. It extends the basic RPC functionality by adding the following features:

    • Protocol Exchange: Ability to swap or customize the communication protocol.
    • Registry: A central system to track available services.
    • Service Discovery: Mechanisms for clients to find service providers.
    • Load Balancing: Distributing requests across multiple service instances.
    • Timeout Processing: Handling request timeouts to ensure system stability.
  4. Overview of Knapsack Problem variations

    The Knapsack Problem involves selecting items with specific prices and weights to maximize total price within a weight limit. There are three primary variations:

    • 0-1 Knapsack Problem: Each item is unique; it must either be included or not.
    • Bounded Knapsack Problem (Multiple Knapsack): Each item has a limited quantity.
    • Unbounded Knapsack Problem (Complete Knapsack): Each item is available in infinite quantity.
  5. Overview of the Go GMP Scheduling Model

    The Go scheduler uses the GMP model to manage concurrency by decoupling goroutines from OS threads. This design minimizes the overhead of thread creation and context switching while maximizing CPU utilization.

    • G (Goroutine): A lightweight user-space thread. Each G starts with a small stack (a few KiB) that grows and shrinks dynamically. They are managed by the Go runtime rather than the OS.
    • M (Machine/Thread): An OS kernel thread. M is the actual entity that executes code. To run a goroutine, an M must be associated with a P.
    • P (Processor): A logical processor that represents a resource required to execute Go code. P holds a local run queue of goroutines. The number of Ps is determined by GOMAXPROCS.
  6. Overview of Disjoint Set Union (DSU)

    A Disjoint Set Union (DSU), or Union-Find, is a tree-based data structure used to represent a collection of non-overlapping (disjoint) sets. Each set is represented as a tree where each node has a pointer to its parent. If a node is the root of the tree, its parent pointer points to itself.

    It supports two primary operations:

    1. Union (Merge): Combines two disjoint sets into one by making the root of one tree point to the root of the other.
    2. Find: Determines which set a node belongs to by traversing up the parent pointers until the root node is reached.
  7. Overview of Vuex State Management

    Vuex is a centralized state management pattern for Vue.js applications. It uses a single state tree to serve as the 'Single Source of Truth' (SSOT), ensuring that state changes are predictable. Unlike a plain global object, Vuex state is reactive, and changes must be made explicitly via mutations to allow for better tracking and debugging (e.g., time-travel debugging via Vue devtools). It is recommended for medium-to-large single-page applications where multiple components need to share and synchronize state.
  8. Overview of Viper configuration solution

    Viper is a complete configuration solution for Go applications. It supports multiple configuration formats (JSON, TOML, YAML, HCL, envfile, properties), can listen for configuration file changes to automatically reload, and can read configurations from environment variables, command-line flags, io.Reader, and remote systems like etcd or Consul.
  9. Overview of the Go Runtime System Monitor (sysmon)

    The system monitor (sysmon) is a critical component of the Go runtime that runs in a background loop to ensure the program does not enter an abnormal state. It operates independently of the standard P (Processor) model, running on its own dedicated thread. Its primary responsibilities include:

    • Deadlock Detection: Checking if the runtime has entered a deadlock state.
    • Timer Management: Monitoring and triggering timers when they expire.
    • Network Polling: Checking for ready file descriptors and waking up associated Goroutines.
    • Processor Preemption: Preempting Goroutines that have run for too long or are stuck in system calls.
    • Garbage Collection: Triggering GC when specific conditions are met.
  10. Overview of gRPC Architecture

    gRPC is a remote procedure call (RPC) framework that allows a client application to directly call a method on a server application on a different machine as if it were a local object. It uses a service definition to specify methods, parameters, and return types.

    Key architectural components:

    • Server: Implements the service interface and runs a gRPC server to handle calls.
    • Client Stub: A local object on the client side that provides the same methods as the server, handling the wrapping of parameters and communication with the server.
    • Interoperability: Supports multiple languages, allowing a server in one language (e.g., Java) to communicate with clients in others (e.g., Go, Python, Ruby).