Databases 19 min read

Crack Backend Interviews: Redis, MySQL Locks, MQs & XiaoHongShu Salary Secrets

The article combines a surprising look at XiaoHongShu's record‑breaking graduate salaries with a comprehensive backend interview guide covering Redis advantages and drawbacks, common data structures, persistence and high‑availability, MySQL lock types, optimistic vs. pessimistic locking, message‑queue fundamentals, RabbitMQ vs. Kafka differences, deadlock avoidance, and a sample algorithm question.

IT Services Circle
IT Services Circle
IT Services Circle
Crack Backend Interviews: Redis, MySQL Locks, MQs & XiaoHongShu Salary Secrets

Recent graduate offers from XiaoHongShu have sparked excitement because the company announced salaries that reach 30k+ per month, translating to annual packages of 50‑60w plus signing bonuses and equity, far higher than most other tech firms.

Collected data shows several backend development offers:

33k × 16 = 52.8w

35k × 16 = 56w

38k × 16 = 60.8w

39k × 16 = 62.4w

Compared with the previous year, the 2024 batch appears to enjoy a noticeable salary increase, making the offers hard to refuse.

Redis Interview Questions

Advantages of Redis

Extreme performance : In‑memory operations avoid disk I/O, achieving read QPS > 100k and write QPS > 50k.

Rich data structures : Supports strings, hashes, lists, sets, sorted sets, bitmaps, HyperLogLog, GEO, streams, enabling many use‑cases without extra code.

Persistence mechanisms : RDB snapshots and AOF append‑only logs provide durability while keeping most operations fast.

High availability : Master‑slave replication, Sentinel automatic failover, and Redis Cluster sharding allow scaling to TB‑level memory.

Redis Disadvantages

High memory cost limits capacity for cold data.

Data consistency risks: RDB may lose recent writes; AOF can lose up to 1 second of data; async replication can cause stale reads.

Lacks complex SQL queries and full transaction rollback, making it unsuitable for heavy relational workloads.

MySQL Lock Types

MySQL locks are categorized by scope: global, table, and row locks.

Global lock (e.g., flush tables with read lock) makes the entire database read‑only, useful for full logical backups.

Table lock (e.g., lock tables) blocks other sessions from reading or writing the locked table.

Metadata lock (MDL) is automatically acquired during DDL/DML to protect schema changes.

Intention lock is set before row‑level locks to speed up lock checks.

Row‑level locks include record locks (S/X), gap locks (prevent phantom reads), and next‑key locks (record + gap).

Optimistic vs. Pessimistic Locks

Optimistic locking assumes low contention and checks a version number or timestamp before committing; it suits read‑heavy, low‑conflict scenarios such as product detail pages.

Pessimistic locking acquires a lock (e.g., SELECT ... FOR UPDATE or Java synchronized) before accessing data; it is appropriate for write‑heavy, high‑conflict cases like banking transactions or inventory deduction.

Deadlock Prevention

Deadlocks occur when four conditions hold: mutual exclusion, hold‑and‑wait, no preemption, and circular wait. Breaking any condition—commonly by enforcing a consistent resource acquisition order—prevents deadlocks.

Message Queue Fundamentals

Message queues provide decoupling, asynchronous processing, and traffic shaping (peak‑shaving). Common patterns include using MQ for order creation, user tracking, and inventory updates.

RabbitMQ vs. Kafka

RabbitMQ offers precise routing, strong reliability via acknowledgments, and supports complex exchange patterns, making it ideal for business‑logic‑intensive scenarios.

Kafka prioritises throughput with partitioned logs and high‑volume persistence, suited for large‑scale log collection and real‑time data pipelines.

Additional Interview Topics

The interview also covered algorithmic coding (e.g., reversing words in a string) and other system‑design questions.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

message queuesredismysqlDatabase Locksbackend interviewSalary Insights
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.