kubanzz Technical Notes
website·Indexed 30 days ago
https://kubanzz.github.io/A collection of technical notes and guides covering backend development and infrastructure. Topics include Spring Framework (IOC, Spring Boot, Spring Cloud), MySQL (InnoDB, indexing, transaction isolation), Redis (data structures, high availability, caching strategies), distributed systems (CAP, BASE, Paxos, 2PC/3PC/TCC, XA), Hadoop 2.x, Docker, and software engineering principles like RESTful API design and UML.
What's inside kubanzz
- Java 8 HashMap is a key-value data collection that uses a combination of an array, linked lists, and red-black trees for storage. The array stores the primary Node objects (containing key and value). Linked lists are used to handle hash collisions. When a linked list grows beyond a specific threshold (TREEIFY_THRESHOLD = 8), it is converted into a red-black tree to maintain fast access times.
Overview of Oozie Core Components
Apache Oozie consists of three primary components for managing Hadoop jobs:
- Workflow: A directed acyclic graph (DAG) of jobs. It includes Control Flow Nodes (e.g., start, end, kill, branch, join) and Action Nodes.
- Coordinator: A trigger mechanism used to schedule jobs based on time or data availability.
- Bundle Job: A mechanism to group and manage multiple Coordinator jobs.
Overview of Python built-in data structures
Python provides several built-in data structures with different properties regarding order and mutability:
- List: Ordered and mutable. Example:
['a', 'b'] - Tuple: Ordered and immutable. Example:
('a', 'b') - Dictionary: Unordered and mutable. Example:
{'x': 'a', 'y': 'b'} - Set: Unordered and mutable. Example:
{'a', 'b'} - String: Ordered and immutable. Example:
"abc" - Range: Ordered and immutable. Example:
range(10)
- List: Ordered and mutable. Example:
Key features of Java 10
Java 10 introduced:
- Local Variable Type Inference: The
varkeyword for local variable declarations (cannot be used in other contexts, including Lambdas). - Security: Default root certificate authentication (CA certificates).
- JVM: Parallel Garbage Collector G1.
- Release Model: Transition to a time-based release pattern (incremental versioning, e.g., 1.8 became 8).
- Local Variable Type Inference: The
Understand software testing fundamentals and definitions
Software is defined as a collection consisting of three parts: documentation, programs, and data. Software testing is the process of reviewing software documentation, checking software data, and executing program code to discover defects (bugs) before delivery. In a broad sense, software testing encompasses all inspection, review, and confirmation activities throughout the software product lifecycle, including design reviews, document audits, unit testing, integration testing, system testing, and acceptance testing.Understand Flume Core Components
Apache Flume consists of three primary components that form a data pipeline:
- Source: Monitors data sources and receives incoming data (the entry point).
- Channel: Acts as a transport pipeline to move events from the source to the sink.
- Sink: The output point where events are delivered to a destination.
Quartz Distributed Scheduling Framework Overview
Quartz is a distributed job scheduling framework written in Java. It uses a database to store job and scheduling information and implements distributed locks via database primary/unique keys to prevent the same task from being created or executed multiple times across different nodes in a distributed environment.Understand Netty core concepts and features
Netty is an asynchronous event-driven network application framework used for developing high-performance protocol servers and clients. It is essentially a wrapper around Java NIO and utilizes the Reactor thread model (consisting of Selector, Acceptor, and Handler) and zero-copy technology to optimize socket communication performance.
Key characteristics include:
- High Concurrency: Built on Non-blocking IO (NIO), providing significantly better concurrency performance compared to Blocking I/O (BIO).
- Fast Transmission: Leverages zero-copy features to minimize unnecessary memory copying.
- Simplified API: Encapsulates the complex details of NIO operations into easy-to-use interfaces.
Understand Dockerfile basic concepts and structure
A Dockerfile is a script containing a series of instructions used to automatically build and customize a Docker image. It allows for rapid environment setup and configuration of environment variables without manual command-line operations. A typical Dockerfile consists of four main parts: base image information, maintainer information, image operation instructions, and container startup execution instructions.# 1. Base image FROM ubuntu # 2. Maintainer info MAINTAINER docker_user docker_user@email.com # 3. Image operation instructions RUN echo "deb http://archive.ubuntu.com/ubuntu/ raring main universe" >> /etc/apt/sources.list RUN apt-get update && apt-get install -y nginx RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf # 4. Container startup command CMD /usr/sbin/nginxUse Docker Repositories and Tags
A Docker Registry is a service used to store and distribute images.
- Repository: A collection of related images (e.g., a specific software project).
- Tag: Used to version images within a repository. A specific image is identified by
<repository-name>:<tag>. If no tag is specified, Docker defaults tolatest.
Common registries include Docker Hub, Aliyun, and others.
Software development and architecture fundamentals
Software Architecture
- Layered Architecture (Embedded): Two primary issues are that errors in the bottom layer can cause the entire system to fail, and communication mechanisms between layers can degrade performance.
- 4+1 View Model: Describes software from five perspectives: Logical View, Development View, Process View, Physical View, and Scenarios. This allows different stakeholders (users, developers, engineers, managers) to evaluate functional and non-functional requirements.
Development Process
- Requirement Development: Follows the flow:
Requirement Document$\rightarrow$Review$\rightarrow$Requirement Baseline. The baseline prevents major changes from causing architectural issues and serves as an agreement between customers and developers. - Documentation: Divided into User Documentation (functions and usage) and System Documentation.
Analyze the Java program execution lifecycle
Java programs transition through three primary stages: Compilation, Loading, and Execution.
- Compilation:
.javasource files are compiled into.classbytecode files. These files contain the constant pool and method bytecode. - Loading: The JVM loads the bytecode into memory (e.g., the Method Area). If dependent classes are not yet loaded, the JVM loads them first.
- Execution: The JVM creates threads to execute the code. Each thread is allocated private resources:
- JVM Stack: Contains stack frames for each method call, utilizing a local variable table and an operand stack.
- Program Counter (PC): Tracks the current bytecode instruction position.
- Memory Area: Dedicated space for the thread.
# Compile a Java file javac Demo1.java # Decompile a class file to view JVM instructions javap -v Demo1.class > Demo1.txt- Compilation: