Comprehensive Java Backend Interview Review: Threads, Collections, Networking, HTTP, TCP, and MySQL
This article presents a detailed Java backend interview recap covering self‑introduction, thread‑pool choices, Snowflake ID usage, List implementations, List vs Set differences, common HTTP status codes, flow and congestion control, URL request flow, TCP three‑way handshake, HTTP vs HTTPS, database index types, B+‑tree advantages, transaction isolation problems, and practical interview preparation tips.
Interview Overview
Author introduces a recent Alibaba Java backend interview, summarizing around 20 fundamental questions on projects, Java collections, concurrency, networking, and MySQL.
Thread Pools
Used ScheduledThreadPool for periodic tasks; explained why it fits the scenario.
FixedThreadPool – fixed number of threads, excess tasks queued.
CachedThreadPool – virtually unlimited threads with SynchronousQueue for hand‑off.
SingleThreadExecutor – single thread, recreates on failure, preserves order.
SingleThreadScheduledExecutor – special case of ScheduledThreadPool with one thread.
Unique ID Generation
Adopted Snowflake algorithm to generate globally unique IDs instead of auto‑increment primary keys.
Other strategies: auto‑increment, UUID (not ideal for primary keys due to randomness and index fragmentation).
Open‑source alternatives: Meituan Leaf, Baidu UidGenerator.
Java List Implementations
Common List implementations: ArrayList, LinkedList, Vector, Stack.
Characteristics: ArrayList: dynamic array, fast random access, suitable for read‑heavy scenarios. LinkedList: doubly linked list, fast insert/delete, good for frequent modifications. Vector: thread‑safe version of ArrayList. Stack: LIFO structure based on Vector.
List vs Set
List is ordered and allows duplicates; Set is unordered and enforces uniqueness.
Use List when order or duplicate counts matter; use Set for deduplication and fast existence checks.
Common HTTP Status Codes
Explained the five classes of status codes (1xx–5xx) with typical examples such as 200 OK, 404 Not Found, 500 Internal Server Error, etc.
Flow Control and Congestion Control
Flow control uses sliding windows to prevent sender overload; congestion control employs slow start, congestion avoidance, fast retransmit, and fast recovery algorithms.
URL Request Execution Process
Browser parses URL, resolves IP via DNS hierarchy (cache → OS → local DNS → root → authoritative), then establishes TCP connection and requests the resource.
TCP Three‑Way Handshake
Detailed state transitions with packet flags and sequence numbers:
Client SYN → Server SYN‑ACK → Client ACK.
State diagram includes CLOSE, LISTEN, SYN‑SENT, SYN‑RCVD, ESTABLISHED.
HTTP vs HTTPS
HTTP transmits plaintext on port 80; HTTPS adds SSL/TLS encryption on port 443, providing confidentiality and integrity.
Database Indexes
Types: B+‑tree (InnoDB default), hash, full‑text.
B+‑tree stores only keys in non‑leaf nodes, resulting in fewer I/O operations, stable insert/delete performance, and linked leaf nodes for efficient range queries.
Transaction Isolation Issues
Identified dirty read, non‑repeatable read, and phantom read.
Isolation level mapping:
Dirty read → READ‑UNCOMMITTED.
Non‑repeatable read → REPEATABLE‑READ.
Phantom read → SERIALIZABLE.
MySQL InnoDB default is REPEATABLE‑READ, which largely prevents phantom reads via MVCC for snapshot reads and next‑key locks for current reads.
Interview Takeaways
Strengthen SQL knowledge and practice queries.
Review computer networking concepts more thoroughly.
Deepen understanding of Java concurrency.
Continuously ask “why” to solidify concepts.
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.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
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.
