code.0x3f4.run Knowledge Base

website·Indexed 31 days ago

https://code.0x3f4.run/

A technical knowledge base covering backend development, including Java (JVM, GC, Collections), MySQL, Redis, Spring, Spring Cloud Alibaba, microservices (load balancing, service fuse/limit/downgrade), distributed systems, and computer science fundamentals like IO and networking. Also includes frontend notes on Next.js and interview experiences.

Tokens
124.8K
Snippets
274
Records
655
Agent score
50%

What's inside code.0x3f4.run

  1. Overview of Spring Cloud Alibaba (SCA)

    Spring Cloud Alibaba (SCA) is a one-stop solution for microservices development. It provides the necessary components for building distributed application services, allowing developers to integrate Alibaba's distributed application solutions into Spring Cloud applications using a programming model based on annotations and minimal configuration.
  2. Overview of Distributed Mutual Exclusion

    Distributed mutual exclusion ensures that when multiple nodes or programs access a shared critical resource (such as a database or file), only one program can access that resource at any given moment. This prevents data inconsistency and unexpected behavior. While local concurrency uses locks, semaphores, or CAS, distributed systems rely on specific coordination algorithms like Centralized, Distributed, and Token Ring algorithms.
  3. Overview of AbstractQueuedSynchronizer (AQS)

    AbstractQueuedSynchronizer (AQS) is a framework provided in the java.util.concurrent (JUC) package used to build locks and synchronizers. It is an abstract class that leverages CAS (Compare-And-Swap) for optimistic locking and spin-retries to ensure high efficiency. Many standard JUC components, such as ReentrantLock, ReentrantReadWriteLock, Semaphore, and CountDownLatch, are built using AQS.
  4. Overview of HTTP

    HTTP (Hyper Text Transfer Protocol) is a simple request-response protocol operating at the application layer. It is primarily used for data transmission between browsers and servers (B/S model) to transfer hypertext data, such as HTML, images, and videos. Prior to HTTP/3.0, it typically runs on top of TCP.
  5. Overview of Seata AT Mode

    Seata AT (Automatic Transaction) mode is a non-intrusive distributed transaction solution. It uses AOP-style proxy operations on the database (such as inserting/deleting undo_log and managing global locks) to ensure that multiple local transactions either commit or roll back together.

    Requirements for using AT mode:

    1. The database must support local ACID principles (e.g., MySQL).
    2. The Java application must access the database via JDBC.
    3. The business code typically uses the @GlobalTransactional annotation to enable distributed transaction functionality.
  6. Overview of Distributed Election Algorithms

    Distributed election is the process of selecting a leader (main node) in a cluster to handle scheduling, management, and coordination of other nodes. This ensures the cluster operates correctly and maintains data consistency. Common election methods include:

    • Sequence-based algorithms: e.g., Bully Algorithm.
    • Quorum-based (Majority) algorithms: e.g., Raft and ZAB algorithms.
  7. Overview of Load Balancing Algorithms

    Load balancing is used to prevent single-node overload, account for varying node performance, and ensure all available nodes are utilized. Algorithms are categorized into two types:

    1. Static Load Balancing: Based on statistical 'best fit'; cannot dynamically switch based on real-time state. Examples: Round Robin, Weighted Round Robin, Random, Weighted Random, Hash, and Consistent Hash.
    2. Dynamic Load Balancing: Real-time detection of node status to select the most suitable node. Examples: Least Connections, Least Active Requests, and Fastest Response Time.
  8. Overview of Java Collection Framework interfaces

    The Java Collection Framework is divided into two main container types: Collection (stores a set of elements) and Map (stores key-value pairs).

    Key interfaces and their characteristics:

    • List: Ordered, allows duplicate elements.
    • Set: Unordered, does not allow duplicate elements.
    • Queue: Ordered, allows duplicates, typically follows specific ordering rules (e.g., FIFO).
    • Map: Key-value storage; keys are unordered and unique, values are unordered and can be duplicated.
  9. Overview of Sentinel Traffic Governance

    Sentinel is a distributed traffic governance component designed to ensure microservice stability. It provides several mechanisms to protect services from overload and failure:

    • Flow Control: Regulates the 'shape' of incoming traffic based on system processing capacity (e.g., QPS, thread pool, system load) to prevent crashes.
    • Circuit Breaking (Degradation): Prevents cascading failures (snowball effect) by cutting off calls to unstable resources (e.g., those with high timeout or exception rates).
    • System Load Protection: Balances entry traffic with system load to ensure the system processes the maximum number of requests within its capacity, preventing cluster-wide crashes when individual nodes are at their limit.
  10. Introduction to Next.js as a React Framework

    Next.js is a React framework designed for production web development. It provides built-in solutions for common challenges encountered when building full-stack React applications from scratch, including:

    • Bundling and Compilation: Handles code bundling (e.g., via webpack) and compilation (e.g., via Babel).
    • Production Optimization: Implements optimizations such as automatic code splitting.
    • Rendering Strategies: Supports pre-rendering, Server-Side Rendering (SSR), and Client-Side Rendering (CSR) to improve performance and SEO.
    • Backend Integration: Provides the ability to write server-side code to connect the React application to data stores.
  11. Overview of Nacos Features

    Nacos (Naming and Configuration Service) is a platform providing dynamic service registration and discovery, configuration management, and service management. Key capabilities include:

    • Service Discovery & Health Monitoring: Supports DNS and RPC-based discovery. It performs real-time health checks to prevent requests from being sent to unhealthy instances.
    • Dynamic Configuration Service: Allows centralized and externalized management of application and service configurations, eliminating the need to redeploy applications when configurations change.
    • Dynamic DNS Service: Supports weight-based routing for load balancing, traffic control, and internal DNS resolution.
  12. Overview of MySQL InnoDB Row-Level Locks

    In MySQL InnoDB, row-level locking is used for 'current reads' (e.g., SELECT ... FOR UPDATE, UPDATE, DELETE, INSERT). 'Snapshot reads' (standard SELECT) use MVCC and do not require locks. There are three types of row locks:

    • Record Lock: Locks a single index record.
    • Gap Lock: Locks the gap between index records (open-open interval).
    • Next-Key Lock: A combination of a Record Lock and a Gap Lock (open-closed interval).

    By default, the basic unit of locking is the Next-Key Lock, which may degrade into a Record Lock or Gap Lock depending on the query and index type. Gap Locks only appear in the Repeatable Read (RR) isolation level.