xiaogenban1993 Blog

website·Indexed 31 days ago

https://www.xiaogenban1993.com

A technical blog featuring tutorials and notes on a wide range of software engineering topics, including JVM tuning, Java collections and dynamic proxies, SQL and MySQL, Kubernetes (k8s) ingress and DNS, Firebase, etcd, MongoDB Atlas, GraphQL, and Linux utilities like awk, sed, and cron.

Tokens
255.5K
Snippets
969
Records
1.5K
Agent score
51%

What's inside xiaogenban1993

  1. Overview of Dynamic Programming (DP) Patterns

    Dynamic Programming (DP) is often used to find the number of ways to achieve a state or an optimal value, whereas Depth First Search (DFS) is typically used to enumerate all possible cases. DP problems are generally categorized into one-dimensional (1D) and two-dimensional (2D) arrays. 1D DP often involves finding a relationship between dp[i] and dp[i-x], and can frequently be optimized from O(n) space to O(1) if only a few previous states are needed. 2D DP requires abstracting the meaning of dp[i][j] and identifying its relationship with other elements in the matrix, often used for string processing where j represents the prefix of a string.
  2. Overview of Arthas Java analysis tool

    Arthas is an open-source Java process analysis tool developed by Alibaba. It functions as a toolkit integrating several open-source tools to provide capabilities such as heap memory analysis, thread information gathering, and bytecode enhancement. Key integrated components include async-profiler for flame graphs, apache commons-ognl for OGNL expressions, SkaETL/compiler for memory compilation, and cfr for decompilation. Two of its most useful features are watch (monitoring method parameters upon invocation) and trace (analyzing the time spent in all sub-methods of a target method).
  3. Overview of the flat CLI tool

    flat is a text-processing utility inspired by awk that allows users to process text line-by-line using JavaScript syntax. It can read input from either a specified file or a pipe (stdin). The tool provides a JavaScript execution environment where each line of text is available as a variable l. If the JavaScript expression evaluated for a line returns a value other than null or undefined, that value is printed to the output.
    # Example: Extract the first column of a log file (equivalent to awk '{print $1}')
    cat app.log | flat 'l.split(" ")[0]'
    
    # Example: Process a file directly
    flat 'l.split(" ")[0]' app.log
  4. Overview of Model Context Protocol (MCP)

    Model Context Protocol (MCP) is a standardized protocol designed to provide Large Language Models (LLMs) with external context. It acts as an adaptation layer between AI applications and data sources, standardizing how context is retrieved and how tools are invoked.

    Key components include:

    • Resources: Standardized interfaces for static, read-only data retrieval, effectively normalizing the RAG (Retrieval-Augmented Generation) process.
    • Tools: Standardized interfaces for function calling, allowing AI applications to execute specific logic via a consistent protocol regardless of the underlying model's native function-calling capabilities.

    MCP uses jsonrpc 2.0 for message formatting and supports two primary transport mechanisms: stdio and httpstream.

  5. Overview of Java Old Generation Garbage Collectors

    The Old Generation typically uses mark-sweep or mark-compact algorithms. Common collectors include:

    • Serial Old: Single-threaded, mark-compact, STW.
    • Parallel Old: Multi-threaded, mark-compact, STW. Used in throughput-focused scenarios, typically paired with Parallel Scavenge.
    • CMS (Concurrent Mark Sweep): Aims to minimize STW time. It uses a mark-sweep algorithm which can lead to memory fragmentation. It is commonly paired with ParNew.
  6. Overview of JDK 8 JVM Memory Model

    The JDK 8 JVM memory model is divided into five main areas:

    • Heap: Stores objects created via new. This is the primary area managed by Garbage Collection (GC).
    • Stack: A temporary storage area for method execution variables; memory is released automatically when the method finishes.
    • Method Area: In JDK 8, this is replaced by the Metaspace (元数据区), which stores class metadata (e.g., class loaders). Unlike the previous Permanent Generation, Metaspace uses native computer memory and is not restricted by specific JVM parameters.
    • Program Counter (PC): Thread-private; generally not managed by developers.
    • Native Method Stack: Thread-private; used for native method execution.
  7. Overview of Java Young Generation Garbage Collectors

    The Young Generation typically uses the copying algorithm. Common collectors include:

    • Serial: Single-threaded, Stop-The-World (STW). Simple and practical, often paired with Serial Old.
    • ParNew: Multi-threaded version of Serial, STW. Often paired with CMS.
    • Parallel Scavenge: Multi-threaded, STW. Focused on high throughput, often paired with Parallel Old.
  8. Overview of etcd distributed key-value store

    etcd is a distributed key-value store designed to reliably and quickly save critical data and provide access. It is used for distributed coordination through distributed locks, leader election, and write barriers. It is primarily used for storing metadata and is similar in positioning to Apache ZooKeeper, providing high availability and persistent data storage and retrieval.
  9. Overview of Redis data types and their underlying implementations

    Redis is a key-value store where keys are always strings. The values support five basic data types, each with multiple underlying encoding strategies to balance memory efficiency (for small datasets) and computational complexity (for large datasets). All values are wrapped in a redisObject containing the type, encoding, and a ptr to the actual data.
  10. Overview of Tailwind CSS

    Tailwind CSS is a utility-first CSS framework that provides low-level utility classes to build custom designs without leaving your HTML. Instead of predefined components, it provides shorthand classes (e.g., flex-1 for flex: 1 1 0% and text-xs for font-size: 0.75rem; line-height: 1rem;). It uses PostCSS and Autoprefixer to ensure cross-browser compatibility and performs tree-shaking to remove unused styles from the final CSS bundle.
  11. Overview of Java Agent loading methods

    Java Agents can be integrated into a JVM process using two primary methods:

    1. Static Loading: Specified at JVM startup using the -javaagent command-line argument. This executes the premain method before the application's main method.
    2. Dynamic Loading (Attach): Injected into an already running JVM process using the Java Attach API. This executes the agentmain method.