Skip to content

XXieYiqiang/SoakUpTheSun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β˜€οΈ SoakUpTheSun - Cloud-Based Visual Assistance Platform (WIP)

Spring Cloud Go Vue.js Python

Redis RocketMQ Elasticsearch License


"Be their eyes, Online."

SoakUpTheSun is a high-concurrency heterogeneous microservices platform based on Java + Go + Python. We have abandoned the traditional offline rescue model and built a purely online assistance system based on Go SFU Real-time Streaming + Redis Hot Pool Matching.

By integrating RocketMQ Asynchronous Decoupling, Lua Atomic Locks, and AI Visual Analysis technologies, we allow visually impaired users to connect with global volunteers in milliseconds with just a tap on the screen, transcending geographical limitations.

Currently, this is a learning-oriented project. You can learn solutions for common scenarios such as flash sales (seckill), mass distribution, cache breakdown, cache penetration, instant messaging (IM), matching algorithms, and self-deployed AI model usage.

Due to space limitations, detailed implementation diagrams and functional charts for each feature cannot be fully displayed here. Please contact the email at the end of this document, and I will send you the complete architecture diagrams.

πŸ— System Topology

The system adopts a heterogeneous microservices architecture with a fully asynchronous core link design.

System Architecture

Diagram Explanation: The system is divided into the Java Business Middle Platform, the Go Streaming Layer, and the Python AI Computing Layer. Core interactions are scheduled via the Redis Hot Pool, utilizing RocketMQ for traffic peak shaving.

πŸš€ Key Features

  • ⚑️ Millisecond-Level Hot Pool Matching Utilizes Redis Set to maintain a real-time pool of online volunteers. Unlike traditional database queries, we only match users who actively activate their status. Combined with an Elasticsearch fallback strategy, this ensures a connection success rate of > 99%.

  • πŸŽ₯ Self-Developed Go SFU Streaming Service A deeply customized SFU server based on the Pion framework, supporting WebRTC signaling interaction and RTP packet forwarding. Optimized for weak network environments, keeping end-to-end latency within 200ms.

  • πŸ›‘οΈ High-Concurrency Short Link Defense System Integrates Bloom Filter and Redis Token Bucket. Performs O(1) extreme-speed deduplication before generating 6-digit short codes, effectively preventing ID collisions and malicious traversal attacks.

  • πŸ”„ Asynchronous Slicing Import for Massive Data Adopts a TaskQueue + Async Thread Pool solution to handle Excel imports of 100,000+ rows. Uses Mybatis-Plus for batch insertion and dual-writing to ES, avoiding long transactions that could lock the database.

  • πŸ’° Redis Lua Atomic Inventory Flash Sale In public welfare prize redemption scenarios, "inventory query" and "inventory deduction" are encapsulated into a single Lua script, executed atomically in the Redis single-threaded model to completely eliminate overselling.

πŸ›  Tech Stack

Domain Technology Selection Core Function
Service Governance Spring Cloud Alibaba Nacos (Registration/Config), OpenFeign (RPC)
Audio/Video Go (Golang) + Pion WebRTC Signaling Exchange, RTP Media Forwarding
AI Computing Python + OpenCV Computer Vision Analysis (OCR/Object Detection)
Persistence MySQL 8.0 Business Data Storage
Cache/Lock Redis (Redisson) Distributed Lock, Hot Pool (Set), Bloom Filter, Lua Script
Search Elasticsearch 7.x Multidimensional Volunteer Matching (Painless Script), Inverted Index
Message Queue RocketMQ Image Analysis Peak Shaving, Async Decoupling, Excel Task Distribution
Task Scheduling XXL-Job Distributed Scheduled Tasks (Point Settlement)
Object Storage Tencent COS Massive Storage for Images/Video Files

🧩 Core Design Challenges & Solutions

πŸ”΄ Challenge 1: "Overselling" & "Collision" Under High Concurrency

Scenario: In emergency call mode, multiple visually impaired users might match with the same online volunteer simultaneously; or during a prize flash sale, inventory might drop below zero. Solution:

  • Atomic Guarantee: Abandoning Java-level locks, we encapsulate "query state" and "lock state" into Redis Lua scripts, leveraging Redis's single-threaded nature for atomic execution.
  • Distributed Lock Fallback: After successful Lua execution, a Redisson Watchdog mechanism is introduced to prevent lock anomalies caused by business logic timeouts, ensuring strong data consistency.

🟑 Challenge 2: Balancing Security & Performance in Short Link Systems

Scenario: Video room links are only 6 characters long, making them vulnerable to brute-force traversal or ID collisions. Solution:

  • Extreme Speed Deduplication: Introduce Bloom Filter to perform O(1) memory-level deduplication before generating short codes, blocking 99% of invalid database queries.
  • Traffic Cleaning: Combined with the Redis Token Bucket Algorithm to limit request rates per IP, preventing malicious scanning.

πŸ”΅ Challenge 3: OOM in Full Settlement of Massive Point Data

Scenario: The platform generates millions of review logs daily. Loading all of them into memory for point calculation would cause frequent Full GC or even OOM in the JVM. Solution:

  • Streaming Processing: Abandon LIMIT offset and design a Cursor Pagination mechanism based on primary key IDs, ensuring query performance does not degrade as data volume increases.
  • Memory Aggregation: Use Java 8 Stream API to perform small-batch aggregation calculations at the application layer, merging 2000 database updates into a single batch submission, significantly reducing I/O overhead.

πŸ“‚ Detailed Directory Structure

SoakUpTheSun/
β”œβ”€β”€ πŸ“‚ clientService/               # [Frontend] Vue.js Client
β”‚   β”œβ”€β”€ public/                     # Static Resources (Markdown CSS, Fonts)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/                    # Axios Interface Encapsulation (user.js)
β”‚   β”‚   β”œβ”€β”€ assets/                 # Assets (styles, images)
β”‚   β”‚   β”œβ”€β”€ libs/                   # Global Tools (Map, WebSocket Plugins)
β”‚   β”‚   β”œβ”€β”€ store/                  # Vuex State Management (User, MessageDispatcher)
β”‚   β”‚   β”œβ”€β”€ utils/                  # Core Utilities (auth.js, request.js)
β”‚   β”‚   └── views/                  # Page Views (ChatRoom, JoinRoom, UserHome)
β”‚   └── vue.config.js               # Frontend Proxy & Build Config
β”‚
β”œβ”€β”€ πŸ“‚ sfu/                         # [Streaming] Self-developed Go SFU Server (WebRTC)
β”‚   β”œβ”€β”€ internal/
β”‚   β”‚   β”œβ”€β”€ api/room/               # Room Management API (Join, Close, Save)
β”‚   β”‚   β”œβ”€β”€ cache/                  # Redis Cache Operation Wrapper
β”‚   β”‚   β”œβ”€β”€ config/                 # System Config (JWT, MySQL, Log)
β”‚   β”‚   β”œβ”€β”€ ws/                     # WebSocket Signaling (Core Handshake Logic)
β”‚   β”‚   └── app/                    # Application Startup Lifecycle Management
β”‚   β”œβ”€β”€ utils/                      # Toolkit (Base58, JWT, Encrypt)
β”‚   β”œβ”€β”€ config.yaml                 # Media Ports & ICE Configuration
β”‚   └── main.go                     # Go Program Entry
β”‚
β”œβ”€β”€ πŸ“‚ volunteer/                   # [Backend] Volunteer Core Business Module (The Core)
β”‚   β”œβ”€β”€ src/main/java/org/hgc/suts/volunteer/
β”‚   β”‚   β”œβ”€β”€ common/
β”‚   β”‚   β”‚   β”œβ”€β”€ manager/            # Redis Manager
β”‚   β”‚   β”‚   └── scheduledTask/      # XXL-Job Scheduled Task (Point Settlement)
β”‚   β”‚   β”œβ”€β”€ controller/             # Web Interface Layer (Facade Pattern)
β”‚   β”‚   β”œβ”€β”€ facade/                 # Facade Pattern Encapsulating Complex Business
β”‚   β”‚   β”œβ”€β”€ mq/                     # RocketMQ Message Driver
β”‚   β”‚   β”‚   β”œβ”€β”€ consumer/           # Consumers (EasyExcel Listener, Task Execution)
β”‚   β”‚   β”‚   β”‚   └── easyExcel/      # ⚑️ Async Slicing Import (ReadExcelDistributionListener)
β”‚   β”‚   β”‚   β”œβ”€β”€ event/              # Domain Event Objects
β”‚   β”‚   β”‚   └── producer/           # Message Producers
β”‚   β”‚   └── service/
β”‚   β”‚       β”œβ”€β”€ impl/               # Business Logic Implementation
β”‚   β”‚       β”‚   β”œβ”€β”€ VolunteerMatchServiceImpl.java  # πŸš€ Hybrid Dual-Track Matching Strategy
β”‚   β”‚       β”‚   └── VolunteerPrizesServiceImpl.java # Prize Redemption Logic
β”‚   └── src/main/resources/
β”‚       β”œβ”€β”€ lua/                    # ⚑️ Redis Atomic Script Library
β”‚       β”‚   β”œβ”€β”€ redeem_volunteer_prizes_stock_synchronize.lua # Inventory Deduction
β”‚       β”‚   └── volunteer_active_match.lua                    # Hot Pool Matching
β”‚       └── scripts/
β”‚           └── volunteer_match.painless  # πŸ” ES Dynamic Weight Scoring Script
β”‚
β”œβ”€β”€ πŸ“‚ picture/                     # [Backend] Image Processing & AI Integration Service
β”‚   β”œβ”€β”€ src/main/java/org/hgc/suts/picture/
β”‚   β”‚   β”œβ”€β”€ common/tensentCos/      # Tencent Cloud COS Object Storage Wrapper
β”‚   β”‚   β”œβ”€β”€ mq/consumer/            # Listeners for Image Upload/Video Frame Analysis
β”‚   β”‚   └── ws/                     # AI Real-time Analysis WebSocket Channel
β”‚
β”œβ”€β”€ πŸ“‚ user/                        # [Backend] User Authentication & Authorization Center
β”‚   β”œβ”€β”€ src/main/java/org/hgc/suts/user/
β”‚   β”‚   β”œβ”€β”€ common/biz/user/        # UserContext Context & Interceptors
β”‚   β”‚   └── remote/                 # OpenFeign Remote Call Clients
β”‚
β”œβ”€β”€ πŸ“‚ shortlink/                   # [Backend] Short Link Generation Service
β”‚   └── src/main/java/org/hgc/suts/shortlink/
β”‚       β”œβ”€β”€ config/                 # πŸ›‘οΈ Bloom Filter Configuration (RBloomFilter)
β”‚       └── service/impl/           # Short Code Generation & 302 Redirect Logic
β”‚
β”œβ”€β”€ πŸ“‚ docs/                        # Project Documentation Resources
└── pom.xml                         # Maven Parent Project Dependency Management

πŸš€ Quick Start

Requirements

  • JDK 17+ / Go 1.25+
  • MySQL 8.0 / Redis 5.0+ / RocketMQ 5+
  • Nacos 2.0+

Deployment Steps

1. Infrastructure Startup

docker-compose up -d mysql redis rocketmq nacos elasticsearch
cd clientService && npm install && npm run serve
---

🀝 Contribution & Contact

SoakUpTheSun is a technology-driven public welfare project. If you are interested in Accessibility Design or High Availability Architecture, feel free to submit a PR.


If you like this project, please give it a star! ⭐️

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published