justsoso Software & Middleware Notes

website·Indexed 31 days ago

https://justsoso.fun/

A collection of technical notes and guides covering Java basics, middleware, and system administration. Key topics include MySQL (InnoDB, indexing, SQL optimization, and logs), Elasticsearch (migration from 6.2.3 to 7.4.1, ELK stack, and ESRally), Redis architectural design, Kafka, Seata distributed transactions, and Java concurrency (ReentrantLock, ThreadPoolExecutor, and JVM class replacement).

Tokens
81.2K
Snippets
307
Records
549
Agent score
55%

What's inside justsoso

  1. Overview of AQS-based synchronization components

    AQS serves as the foundation for several high-level Java concurrency utilities:

    • Semaphore: Allows a specified number of threads to access a resource simultaneously.
    • CountDownLatch: A synchronization aid that allows one or more threads to wait until a set of operations (the countdown) completes.
    • CyclicBarrier: A synchronization point where a fixed number of threads must all arrive before any are allowed to proceed. Unlike CountDownLatch, it can be reused after the barrier is tripped.
    • ReentrantLock: Provides exclusive locking capabilities with support for fairness and reentrancy.
  2. Overview of Apache Hadoop Components

    Apache Hadoop is designed for the storage and processing of massive datasets. It consists of three primary components:

    • HDFS (Hadoop Distributed File System): Used for storing large amounts of data across a cluster.
    • MapReduce: A programming model for processing and analyzing large datasets using a 'divide and conquer' strategy.
    • YARN (Yet Another Resource Negotiator): The cluster management and job scheduling framework.
  3. Overview of the Java Memory Model (JMM)

    The Java Memory Model (JMM) defines the rules for how data is accessed and modified within the JVM, focusing on three core properties:

    • Visibility: Ensures that when one thread modifies a shared variable, other threads see the change immediately.
    • Ordering: Prevents instruction reordering to ensure code executes in the written sequence.
    • Atomicity: Ensures operations are indivisible.

    Key Architecture:

    • All variables are stored in the Main Memory (excluding thread-private variables).
    • Each thread has its own Working Memory containing copies of variables. Threads must operate on their local copies and synchronize via the main memory.
    • volatile variables still have local copies, but follow special access rules that make operations behave as if they are interacting directly with the main memory.
  4. Overview of Spring Cloud Microservices Solution

    Spring Cloud is a comprehensive set of solutions for the distributed deployment of microservices. It provides components to address common challenges in microservice architectures, including configuration management, service discovery, load balancing, circuit breaking, message busing, and data monitoring. A microservice is defined as a functional collection deployed as a standalone service, adhering to the Single Responsibility Principle (SRP).
  5. Overview of InnoDB Index Types

    InnoDB supports several ways of classifying indexes:

    1. By Data Structure:

      • B+ Tree Index: The most common and effective index for relational databases. It maps a key to the page containing the data row.
      • Full-Text Index: Used for searching text within large blocks of data.
      • Hash Index: In InnoDB, these are 'adaptive hash indexes'. The engine automatically generates them based on table usage; users cannot manually create or disable them.
    2. By Logical Organization:

      • Clustered Index: An index where the leaf nodes contain the actual data rows.
      • Secondary (Non-Clustered) Index: An index where the leaf nodes contain the primary key and the indexed column.
    3. By Functional Purpose:

      • Primary Key Index
      • Unique Index
      • Covering Index
      • Composite (Joint) Index
  6. Overview of SofaRaft Java implementation

    SofaRaft is a Java-based implementation of the Raft consensus protocol. It is designed to solve cluster consensus and leader election problems. In the CAP theorem, SofaRaft prioritizes Consistency and Partition Tolerance (CP). During leader election, the entire cluster is unavailable. The system ensures that only one leader exists at a time to handle read and write requests. The leader processes requests by first performing a Write Ahead Log (WAL) and waiting for a majority of nodes to synchronize the log before executing the state machine's apply operation.
  7. Overview of MySQL Lock Types

    MySQL utilizes several locking mechanisms to manage concurrency:

    • Table-level Lock: Locks the entire table.
    • Row-level Lock: Locks specific rows (used by InnoDB).
    • Shared Lock (S): Allows other transactions to read but not modify the data.
    • Exclusive Lock (X): Prevents other transactions from reading or modifying the data.
    • Intention Locks: Table-level locks that indicate a transaction's intent to acquire a row-level lock.
      • Intention Shared (IS): Indicates intent to acquire a Shared lock.
      • Intention Exclusive (IX): Indicates intent to acquire an Exclusive lock.
  8. Overview of the Raft Consensus Protocol

    Raft is a framework/algorithm for replicated state machines that allows nodes in a distributed system to reach consensus. It prioritizes Consistency and Partition tolerance (CP in CAP theorem), meaning the system may be unavailable during leader election.

    Key components include:

    • Three Roles: Leader, Follower, and Candidate.
    • Two Primary Processes: Leader Election and Log Replication.
  9. MySQL Index Data Structures Overview

    MySQL employs different data structures for indexing depending on the table and column types:

    • B-Tree: Used by the majority of indexes, including PRIMARY KEY, UNIQUE, and standard INDEX.
    • R-Tree: Used for specific spatial data types.
    • Hash Table: Supported by MEMORY storage engine tables.