Scale a Search to 50M Users: Spring Boot Interview Question
Engineering With Java
0:00 / 0:00
Scale a Search to 50M Users: Spring Boot Interview Question
138 просмотров · 1 дн. назад
Engineering With Java
417 подписчиков
138 просмотров · 1 дн. назад
Your search endpoint serves 50 million users, the database CPU is stuck above 85%, and latency is around 800ms. How do you get it under 100ms?
In this Spring Boot interview question, we walk through how to scale a user search endpoint backed by PostgreSQL:
Why ILIKE '%john%' forces a full table scan
Speeding up substring search with a pg_trgm trigram GIN index
Switching to a B-tree index when most searches are prefix-based (john%)
Adding pagination with LIMIT to protect memory, network and DB CPU
Using a Bloom filter to skip the database for usernames that don't exist (40% of searches in this scenario)
TIMESTAMPS
00:00 The scenario: 50M users, 10K requests/sec
00:00 Why the current query is slow
00:00 Trigram index for substring search
00:00 Prefix search and B-tree indexes
00:00 Bloom filters for non-existent usernames
00:00 Wrap-up and interview tips
READ THE FULL ARTICLE
https://javabulletin.substack.com/p/s...
More real-world Java and Spring Boot interview questions every week:
https://javabulletin.substack.com
If this helped, like the video and subscribe for more backend interview prep.
#SpringBoot #Java #SystemDesign #PostgreSQL #InterviewQuestions #BackendDevelopment