StoryXC Technical Blog

website·Indexed 31 days ago

https://blog.storyxc.com

A collection of technical guides and notes covering frontend development (JavaScript, TypeScript, Vue, CSS, HTML), DevOps and environment configuration (Docker, Docker Compose, GitHub Actions, WSL, macOS), and software design patterns such as Chain of Responsibility and Strategy patterns. Includes practical tutorials on tool configuration for Rclone, Git, iTerm2, and SwiftUI development.

Tokens
150.6K
Snippets
722
Records
909
Agent score
49%

What's inside StoryXC Blog

  1. Overview of MySQL InnoDB Indexes

    In the InnoDB storage engine, indexes are primarily B+Tree structures stored on disk that contain reference pointers to all records in a data table. They are used to quickly locate rows with specific values in one or more columns. Using indexes is the most effective way to improve query performance by reducing disk I/O operations.
  2. Overview of logrotate functionality

    logrotate is a Linux utility used to manage the automatic rotation, compression, and removal of log files. It prevents logs from growing indefinitely and filling up disk space. Key features include:

    • Rotation: Periodically creating new logs and renaming old ones.
    • Compression: Using gzip to compress rotated logs.
    • Removal: Automatically deleting logs older than a specified number of days.
    • Size-based Rotation: Triggering rotation when a log reaches a specific size.
    • Post-rotation Scripts: Executing commands (like restarting Nginx or MySQL) after rotation to ensure services start writing to new files.
  3. Overview of Poetry for Python Dependency Management

    Poetry is a Python packaging and dependency management tool that replaces traditional requirements.txt and setup.py with a single pyproject.toml file (following PEP 518). Unlike pip, Poetry automatically resolves dependency relationships during both installation and removal, manages project-specific virtual environments, and handles packaging and publishing.
  4. Overview of Docker macvlan networking

    The macvlan network driver allows Docker containers to be assigned a unique MAC address and IP address on the physical network. This enables containers to appear as physical devices on the network, providing a direct connection to the physical network without requiring port mapping or Network Address Translation (NAT).
  5. Overview of XXL-JOB Distributed Task Scheduling

    XXL-JOB is a lightweight, easy-to-extend distributed task scheduling platform designed to decouple scheduling from task execution. It prevents duplicate task execution in clustered environments by using database-level locking, making it a suitable alternative to Spring's @Scheduled (which runs on every node in a cluster) or Quartz.
  6. Overview of Apache Kafka Architecture and Terminology

    Apache Kafka is a distributed, partitioned, and replicated commit log service used as a high-performance message queue. It is designed for decoupling systems, peak shaving (load leveling), and asynchronous processing. Key architectural components include:

    • Broker: A single Kafka server instance within a cluster.
    • Topic: A logical category for messages. Topics are divided into partitions for scalability.
    • Partition: A subset of a topic stored as an append-only log file. Partitions allow data to be distributed across multiple brokers to avoid single-disk limits and enable load balancing.
    • Offset: A unique long-integer identifier representing the position of a message within a partition. Kafka uses sequential read/write operations based on offsets rather than random access indices.
    • Zookeeper: Used for cluster coordination, including broker management and leader election for partitions.
  7. Overview of Linux Access Control Lists (ACL)

    Access Control Lists (ACL) provide a more granular permission management system than the traditional Unix owner-group-other model. While chmod and chown are limited to three permission sets, ACLs allow administrators to define specific permissions for individual users or groups on a per-file or per-directory basis, adhering to the POSIX 1003.1e/1003.2c standards.
  8. Understand Python memory management via reference counting

    Python manages memory using a reference counting mechanism. A piece of memory is tracked by how many variables reference it. When a variable references a memory block, the count increases by 1; when a variable is deleted or no longer references that block, the count decreases by 1. Once the reference count reaches 0, the memory is deleted and the data is destroyed.
  9. Interpret MySQL EXPLAIN output for query optimization

    The EXPLAIN command provides critical details about how MySQL executes a query. Key columns include:

    • key_len: The length of the index used in bytes. Useful for determining how many columns of a composite index are actually being utilized.
    • ref: The columns or constants used to filter the index.
    • rows: The estimated number of rows MySQL must examine to find the results.
    • Extra: Additional information about the execution process, including:
      • Using index: The query is a 'covering index' query; it retrieves data directly from the index tree without reading the actual table rows.
      • Using filesort: MySQL must perform an extra pass to find how to retrieve rows in sorted order (indicates a performance bottleneck).
      • Using temporary: MySQL needs to create a temporary table to hold the result set.
      • Using where: The WHERE clause is used to filter rows before they are sent to the next table or the client.
      • Using index for group-by: An index is used to resolve GROUP BY or DISTINCT operations without accessing the actual table data.
  10. Understand 4K alignment for disk performance

    Disk alignment refers to aligning the starting position of a partition to the edge of a physical sector. Modern disks use 'physical sectors' (often 4096 bytes) which are reported to the OS as multiple 'logical sectors' (usually 512 bytes).

    If a partition is not aligned, a single 'cluster' (the smallest unit of read/write after formatting) may span across two physical sectors. This forces the hardware to perform two read/write operations instead of one, significantly degrading I/O performance. This is especially critical for SSDs, where misalignment increases the number of erase/write cycles.

  11. Understand the JavaScript Event Loop

    JavaScript is single-threaded. Tasks are handled as follows:

    1. Synchronous Tasks: Executed immediately in the main thread (execution stack).
    2. Asynchronous Tasks: (e.g., click events, load events, setTimeout) are placed in a task queue.
    3. Execution: Once the execution stack is empty, the system reads the task queue in order and moves asynchronous tasks into the stack for execution.
  12. Understand Scrapy's core architecture

    Scrapy operates through five core components: Engine, Scheduler, Downloader, Spider, and Pipeline.

    Data Flow:

    1. Spider generates a request $\rightarrow$ Engine $\rightarrow$ Scheduler.
    2. Scheduler filters duplicates $\rightarrow$ Queue $\rightarrow$ Engine $\rightarrow$ Downloader.
    3. Downloader fetches data $\rightarrow$ Response $\rightarrow$ Engine $\rightarrow$ Spider.
    4. Spider parses Response $\rightarrow$ Item $\rightarrow$ Engine $\rightarrow$ Pipeline.
    5. Pipeline handles persistence (storage).