Java Interview Simulation: Solving Sohu’s High‑Throughput Push System
This article walks through a five‑round Java interview simulation where the candidate designs, optimizes, and secures a massive push‑notification system for Sohu, covering Spring Boot high‑concurrency architecture, sharding and cache‑penetration mitigation, Kafka reliability, Kubernetes deployment with gray releases, multi‑region high‑availability, and AI‑driven smart‑push strategies, complete with concrete code snippets and real‑world performance numbers.
A Java developer named Xiao Ming prepares for a Sohu Java engineer interview and shares a detailed five‑round mock interview that illustrates how to design, implement, and operate a push‑notification platform capable of handling millions of users and 120k QPS.
Round 1 – Spring Boot Architecture & High Concurrency
Design a three‑layer Controller‑Service‑DAO structure.
Use Spring WebFlux for reactive programming and Resilience4j for rate‑limiting.
Async tasks via @Async and ThreadPoolTaskExecutor (core 10, max 20, queue 100).
Database connection pool tuned with HikariCP (maxLifetime < wait_timeout).
Diagnose a response‑time spike (50 ms → 2 s) with thread -n 5, find OkHttp timeout, fix by disabling retries and enlarging the connection pool (50 → 200).
Explain Spring Boot auto‑configuration ( @Conditional, spring.factories) and custom starter creation steps.
JVM GC tuning: enable GC logs ( -Xlog:gc*,gc+heap=debug:file=gc.log), use jmap -histo:live to locate memory leaks, resolve Full GC by expiring Redis cache entries.
Idempotency via global traceId (Snowflake) stored in Redis with SETNX and TTL, and Redisson lock granularity.
Explain configuration injection with @ConfigurationProperties and dynamic refresh using @RefreshScope.
Logging and tracing using AOP and traceId for end‑to‑end visibility.
Round 2 – Sharding, Cache‑Penetration & Persistence
Horizontal sharding with ShardingJDBC (hash on user_id, 16 databases, 16 tables per DB).
Cache‑penetration solutions: null‑value caching (1 min TTL), Bloom filter pre‑check, per‑key token‑bucket rate limiting.
Redis persistence: AOF + RDB hybrid, keepalive pool size (50 → 200), master‑slave with Sentinel, handle split‑brain by requiring at least one slave ( min‑slaves‑to‑write).
MySQL index optimization: composite index
ALTER TABLE push_record ADD INDEX idx_user_time (user_id, push_time), consider time‑bucketed tables for large date ranges.
Round 3 – Kafka Reliability & Monitoring
Producer config acks=all, retries = 3; Broker min.insync.replicas=2, log flushing.
Consumer disables auto‑commit, manually commits after successful processing ( commitSync), enables idempotence.
Deduplication via unique messageId stored in Redis before processing.
High availability: 6 partitions, replication factor 3, ISR ensures leader election.
Monitoring lag with kafka-consumer-groups.sh, Prometheus + Grafana dashboards, alert when lag > 1000 or latency > 10 s.
Round 4 – Spring Cloud Alibaba, Nacos & Kubernetes Practices
Service discovery & configuration via Nacos; Feign clients with @FeignClient.
Gray release: two Deployment versions (v1/v2), Gateway weight routing (90 %/10 %), route by request header.
Circuit breaking with Resilience4j (open after 5 failures, half‑open after 30 s).
Horizontal Pod Autoscaler (HPA) based on CPU 70 % or custom Kafka lag metric; PodDisruptionBudget ensures minimum 2 replicas.
Multi‑zone Nacos clusters synchronized via MetaServer for high availability.
Liveness and readiness probes (code snippet shown) to restart or evict unhealthy pods.
Round 5 – End‑to‑End High‑Availability Architecture & AI Integration
Four‑layer design: Gateway + Spring Boot services, Redis + MySQL + Elasticsearch storage, Kafka + RocketMQ messaging.
Multi‑region deployment with traffic DNS routing, Kafka MirrorMaker2 for cross‑region sync, strong‑read/weak‑write strategy, outbox pattern for strong consistency.
AI‑driven smart push: RAG pipeline (feature extraction → vector retrieval → LLM suggestion → hard constraints → explanation). Uses Spring AI, calls to Tongyi/Qianwen APIs.
Compliance: data masking, minimal fields via Protobuf, audit logs stored in ELK for 180 days.
Cost control: hot‑cold topic separation, Redis + Caffeine caching of LLM prompts and suggestions, token accounting per strategy.
A/B testing with layered randomization, DiD & propensity‑score matching, automatic rollback on safety thresholds.
Answer Analyses
Each round is followed by a concise answer analysis that reiterates the key points (e.g., Spring Boot high‑concurrency, ShardingJDBC, Kafka reliability, Nacos governance, observability stack, multi‑active consistency, Protobuf serialization, RAG strategy, multi‑modal moderation, agent‑based operation, cost‑aware AI serving, causal A/B testing).
Additional Practical Tips
Resume honesty, company research, concise self‑introduction.
Maintain calm, admit unknowns, use concrete examples.
Follow interview etiquette (listen, ask balanced questions).
The article ends with links to a series of MCP (Micro‑Component‑Platform) tutorials and community resources.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubiquitous Tech
A ubiquitous public account for pirate enthusiasts, regularly sharing curated experiences, tech learning, and growth insights. Currently publishing articles on AI RAG customer service, AI MCP technology, and open-source design. Personal free Knowledge Planet: Awakening New World Programmer.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
