CSXiaotang Computer Science Notes

website·Indexed 30 days ago

https://www.csxiaotang.com

A comprehensive collection of technical notes covering the SSM (Spring, SpringMVC, MyBatis) stack, microservices architecture (Nacos, Sentinel, Dubbo, MQ), database internals (InnoDB, MVCC, WAL, Redo/Undo Logs), and general software engineering practices including CI/CD and REST API design.

Tokens
23.1K
Snippets
62
Records
202
Agent score
50%

What's inside CSXiaotang

  1. Overview of the Java Collections Framework

    The Java Collections Framework provides data structures that allow for dynamic storage of an arbitrary number of elements, overcoming the fixed-size limitation of arrays which make additions and deletions inconvenient. The framework is primarily divided into three main interfaces: List, Set, and Map.

    • List: An ordered collection that allows duplicate elements. Common implementations include ArrayList, LinkedList, and Vector.
    • Set: A collection that contains no duplicate elements. Common implementations include HashSet and TreeSet.
    • Map: An object that maps keys to values, where each key must be unique.
  2. Overview of the four usages of the static keyword in Java

    The static keyword in Java is applied in four primary contexts:

    1. Static Variables: Fields shared by all instances of a class.
    2. Static Methods: Methods that can be invoked without creating an instance of the class.
    3. Static Code Blocks: Blocks of code that run once when the class is first loaded into memory.
    4. Static Inner Classes: Nested classes that do not require a reference to an instance of the outer class.
  3. Understand MyBatis ORM mapping concepts

    MyBatis implements Object Relationship Mapping (ORM) to bridge Java entity classes and relational databases. The mapping relationship is as follows:

    • Class maps to Table
    • Property maps to Field/Column
    • Object maps to Row
  4. Understand the role of the Disk Space Manager in a DBMS

    The Disk Space Manager is the lowest layer of a Database Management System (DBMS). Its primary responsibilities are to map pages to the physical disk, load pages from disk into memory, and write pages back to disk to ensure persistence. Higher layers interact with this component to read, write, allocate, or deallocate logical pages.
  5. Use Message Queues for asynchronous non-blocking communication in microservices

    In microservices, synchronous interfaces can lead to blocking calls that exhaust thread pools, causing the system to reject new requests. Message Queues (MQ) provide an asynchronous, non-blocking alternative. This architecture enables 'eventual consistency' and 'peak shaving' (削峰填谷), allowing the system to handle high-burst traffic (e.g., 10,000 QPS) by leveraging the high sequential write speed of MQ disks, which can handle significantly more throughput than a traditional database.
  6. Implement a Three-Tier Architecture (Controller, Service, Dao)

    The three-tier architecture is a software design pattern used to separate concerns and maintainability in applications. It consists of the following layers:

    1. Controller (Control Layer): Responsible for receiving requests from the frontend, processing the initial request, and returning the response data.
    2. Service (Business Logic Layer): Responsible for implementing the specific business logic and rules of the application.
    3. Dao (Data Access Object / Persistence Layer): Responsible for all data access operations, including Create, Read, Update, and Delete (CRUD) operations against the database.
  7. Understand MySQL Index Fundamentals and B+ Tree Efficiency

    Indexes in MySQL are data structures used to quickly locate rows with specific values, avoiding full table scans. The essence of an index is trading additional storage space (typically 2-3x) for significantly faster query speeds (100-1000x).

    MySQL uses B+ trees to achieve this efficiency through four key design choices:

    1. Low tree height (typically 3-4 layers/log n depth).
    2. Leaf node linked lists for efficient range queries.
    3. Page alignment.
    4. Internal nodes store only pointers, not actual data records.
  8. Understand SpringMVC Architecture (MVC Pattern)

    SpringMVC follows the Model-View-Controller (MVC) design pattern to separate concerns in a web application:

    • Model (M): Classes responsible for processing data and business logic.
    • View: The presentation layer that interacts with the end-user.
    • Controller: The control layer that receives requests from the browser and returns responses.
  9. Understand the role and core functions of a Service Registry

    A Service Registry (such as Nacos or Eureka) acts as a central directory that maintains the real-time status of all service instances in a microservices architecture. It solves the problem of hard-coding IP addresses and ports, allowing services to discover each other dynamically.

    Core problems solved:

    • Service Discovery: Callers dynamically obtain a list of provider addresses without hard-coding.
    • Health Checking: Unhealthy instances are automatically removed via heartbeat mechanisms.
    • Load Balancing Base: Provides a list of multiple instances that can be used for round-robin, random, or weighted request distribution.
    • Elastic Scaling: New instances register automatically and offline instances are removed, making scaling transparent to the caller.
    • Fault Isolation: If one instance fails, only its traffic is affected, not the entire system.
  10. Define RESTful API resource paths

    In a RESTful architecture, API paths (endpoints) must represent resources. Paths should contain only nouns and no verbs. Typically, these nouns correspond to the names of the tables in the underlying database.
  11. Understand the purpose of Undo Logs in databases

    Undo logs are logical logs that record 'reverse operations' for every change made to the database. They serve two primary purposes: enabling the rollback of transactions to a previous state and supporting Multi-Version Concurrency Control (MVCC) by maintaining historical versions of data records.
  12. Understand Database Page and Table concepts

    In a database, a Table is conceptually similar to a spreadsheet sheet, consisting of rows and columns. The Page is the fundamental unit of I/O. Pages are managed by the BufferManager in memory and by the Disk Space Manager on disk. A page typically contains a page number, data, a dirty bit, locks, and a page cache. The Page Header is located at the top of the page.