Crack Shopee Backend Interview: Key Java, MySQL, Thread Pool & DB Concepts Explained
This article combines Shopee 2025 salary data with a comprehensive backend interview guide covering Java fundamentals, MySQL isolation levels, thread pool configuration, concurrency collections, index types, slow query optimization, and a sample three‑sum algorithm to help candidates prepare effectively.
The article shares Shopee 2025 salary information and provides a detailed backend interview guide covering Java fundamentals, MySQL concepts, thread‑pool configuration, database isolation levels, index types, slow‑query optimization, and a sample algorithm.
Shopee Salary Overview
32k × 15 + 5w signing bonus, master’s graduate, 985 background, base in Shanghai
30k × 15 + 5w signing bonus, background unknown, base in Shenzhen
29k × 15 + 3w signing bonus, bachelor 985, base in Shenzhen
23.5k × 15, master’s graduate, base in Shenzhen
Annual bonus averages three months; benefits include 15 days of annual leave and 14 days of sick leave.
Interview Difficulty
The interview process follows big‑tech standards, consisting of technical fundamentals, project discussion, and algorithm questions, focusing on Java and MySQL.
1. Abstract Class vs Interface
Abstract classes can contain member variables, constructors, and concrete methods; suitable for clear inheritance hierarchies.
Interfaces define behavior contracts, support multiple inheritance, and can contain constants and abstract methods (default/static methods from Java 8).
Implementation uses extends for abstract classes and implements for interfaces; a class can implement multiple interfaces but extend only one abstract class.
Abstract classes may have instance and static variables; interfaces only have static final constants.
2. Error vs Exception
Error represents system‑level failures (e.g., OutOfMemoryError, StackOverflowError) that applications cannot reasonably catch.
Exception denotes recoverable problems; checked exceptions must be declared or caught, while unchecked exceptions (runtime) need not be.
3. HashMap vs ConcurrentHashMap
Memory structure : HashMap uses an array + linked list (or red‑black tree in JDK 8); ConcurrentHashMap uses segmented locks (JDK 7) or CAS + synchronized (JDK 8).
Thread safety : HashMap is not thread‑safe; ConcurrentHashMap provides thread‑safe operations with fine‑grained locking.
Performance : HashMap is faster in single‑threaded scenarios; ConcurrentHashMap scales better under concurrency.
4. Thread Pool Parameters and Working Principle
Thread pools reduce the overhead of creating and destroying threads, improve stability, and simplify resource management.
corePoolSize : Number of core threads that stay alive even when idle.
maximumPoolSize : Upper limit of total threads (core + non‑core).
keepAliveTime : Time after which excess idle threads are terminated.
unit : Time unit for keepAliveTime.
workQueue : Queue that holds tasks when all core threads are busy.
threadFactory : Creates new threads, allowing custom naming.
handler : Rejection policy when the pool is saturated.
Task execution flow:
Check pool state; reject if not RUNNING.
If workerCount < corePoolSize, create a new thread.
If pool is at core size and queue not full, enqueue the task.
If queue full and workerCount < maximumPoolSize, create a new thread.
If both queue and maximum threads are full, apply the rejection handler.
5. Database Isolation Levels
Read Uncommitted : Allows dirty reads, non‑repeatable reads, and phantom reads.
Read Committed : Prevents dirty reads; non‑repeatable and phantom reads may occur.
Repeatable Read : Prevents dirty and non‑repeatable reads; phantom reads may occur (MySQL InnoDB default).
Serializable : Eliminates dirty, non‑repeatable, and phantom reads by acquiring read/write locks.
Examples illustrate how each level affects visibility of a balance change from 1 M to 2 M.
6. Solving Phantom Reads
MySQL uses MVCC snapshots for repeatable reads and gap locks for current reads (INSERT/UPDATE/DELETE) to block phantom rows; serializable level enforces full locking.
7. How Repeatable Read Is Implemented
MVCC creates a consistent snapshot (Read View) at transaction start; subsequent reads use this snapshot, while gap locks prevent phantom inserts.
8. Database Index Types
By data structure: B+Tree, Hash, Full‑text.
By physical storage: Clustered (primary) and secondary indexes.
By field characteristics: Primary, unique, normal, prefix.
By column count: Single‑column and composite indexes.
9. Slow Query Optimization
Analyze queries with EXPLAIN to identify full scans.
Create or refine indexes, respecting the left‑most rule.
Avoid index‑invalidating patterns (leading wildcards, functions).
Use covering indexes and limit selected columns.
Optimize pagination (e.g., WHERE id>last_id LIMIT 10).
Implement read/write splitting with master‑slave replication.
Consider sharding large tables.
Introduce caching layers (e.g., Redis) with appropriate consistency strategies.
10. Hand‑Written Algorithm – Three Sum
A classic problem that asks to find all unique triplets in an array that sum to zero; typical solutions involve sorting and two‑pointer traversal.
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.
