DEV Community

vidhya murali
vidhya murali

Posted on

From DSA to Distributed Systems: What I Learned in the "Code on JVM" Session

Code on JVM – Session

The session mainly focused on how large-scale software systems work, not just Java programming. These are concepts used by companies like Google, Amazon, Netflix, Uber, Instagram, and Discord.

  1. What is DSA (Data Structures & Algorithms)? DSA is the study of organizing and processing data efficiently.

Imagine you're building a contact list.

If you store names randomly, searching takes longer.If you organize them properly, searching becomes much faster.
That's what DSA helps with.

Common Data Structures

  • Array
  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • HashMap
  • Heap
  • Common Algorithms
  • Searching
  • Sorting
  • Recursion
  • Dynamic Programming
  • Graph Algorithms

Why should Java developers learn DSA?

Because every software company asks DSA questions in interviews, and efficient code is essential for scalable applications.

Practice on:

  • LeetCode
  • HackerRank
  1. Big O Notation Big O tells us how fast or slow an algorithm becomes as the amount of data grows.

Example:

Searching a name in a list of 10 people is easy.

Searching in a list of 10 million people is harder.

Big O measures this growth.

Complexity Meaning Example

  • O(1) Constant Access an array element
  • O(log n) Very fast Binary Search
  • O(n) Linear Linear Search
  • O(n log n) Efficient sorting Merge Sort
  • O(n²) Slow Bubble Sort
  1. Abstract Syntax Tree (AST) When you write Java code,

int sum = a + b;
The compiler doesn't understand text directly.

It converts your code into a tree called an Abstract Syntax Tree (AST).

Example:

Assignment
|
Variable(sum)
|
+
/ \
a b
AST is used by:

Java Compiler

IntelliJ IDEA

Eclipse

Static code analyzers

  1. Engineering Blocks Large applications are built using reusable components called engineering blocks.

Examples:

  • Database
  • Cache
  • Search
  • Load Balancer
  • CDN
  • Queue
  • Authentication
  • Logging

For example, when you order food on Swiggy:

  • Login service
  • Restaurant service
  • Payment service
  • Notification service
  • Map service

Each is an engineering block.

  1. Bloom Filter A Bloom Filter quickly checks whether an item might exist.

Example:

Suppose a website has 100 million usernames.

Instead of checking the database every time:

Bloom Filter first checks:

Definitely not present ✅

Maybe present ✅

If it says "maybe," then the database is checked.

Benefits:

Very fast

Uses very little memory

Used in:

Google Chrome Safe Browsing

Apache Cassandra

Redis

  1. Apache Cassandra Apache Cassandra is a NoSQL database designed for huge amounts of data.

Features:

Very fast writes

High availability

Distributed across many servers

Used by:

Discord

Netflix

Apple

Instagram (for some workloads)

  1. HNSW Graph HNSW stands for Hierarchical Navigable Small World.

It is an algorithm for finding similar items quickly.

Example:

Search:

"White sports shoes"

Instead of exact matches, it finds:

White sneakers

Running shoes

Tennis shoes

Used in:

AI search

Image search

Recommendation systems

  1. What is RAG? RAG stands for Retrieval-Augmented Generation.

It is not an AI model.

Instead, it is a technique that combines:

Searching for relevant information.

Giving that information to a Large Language Model (LLM).

Generating an answer based on those documents.

Example:

You ask a company's chatbot:

"What is the leave policy?"

The chatbot:

Searches company documents.

Retrieves the relevant policy.

Uses the LLM to answer.

  1. Vector Database Normally, databases store text or numbers.

A vector database stores embeddings, which are numerical representations of data that capture meaning.

Used for:

Semantic search

AI search

Recommendation systems

RAG applications

Popular examples:

Pinecone

Milvus

Weaviate

ChromaDB

  1. Skip List A Skip List is a faster version of a linked list.

Instead of moving one node at a time, it uses multiple levels so it can "skip" over many nodes.

Used in:

Redis Sorted Sets

Storage engines

Average search time: O(log n).

  1. Redis Sorted Set Redis stores data in memory, making it extremely fast.

A Sorted Set stores data along with a score.

Example:

Alice 100
Bob 95
Charlie 80
Used for:

Game leaderboards

Rankings

Rate limiting

  1. RocksDB RocksDB is a high-performance key-value database created by Meta.

Features:

Fast writes

Efficient storage

Embedded database

Used in:

CockroachDB

Caching systems

Storage engines

  1. LSM Tree LSM stands for Log-Structured Merge Tree.

Instead of writing directly to disk every time:

Data is written to memory (MemTable).

Later, it's flushed to disk as sorted files.

Benefits:

Faster writes

Reduced disk operations

Used by:

Cassandra

RocksDB

ScyllaDB

  1. Consistent Hashing Suppose you have 4 servers storing data.

If a 5th server is added, you don't want to move all the data.

Consistent Hashing moves only a small portion of data, making scaling much easier.

Used in:

Amazon DynamoDB

Cassandra

Discord

CDNs

  1. CDN (Content Delivery Network) A CDN stores copies of files on servers around the world.

Example:

If you're in Chennai watching Netflix, the video is served from a nearby server instead of one in another country.

Benefits:

Faster loading

Lower latency

Examples:

Akamai

Cloudflare

Amazon CloudFront

  1. H3 Index H3 is a geographic indexing system created by Uber.

It divides the Earth into hexagonal cells.

Why hexagons?

Better coverage than squares.

More accurate for nearby searches.

Used by:

Uber

Ola

Swiggy

Zomato

  1. HyperLogLog HyperLogLog estimates the number of unique items using very little memory.

Example:

Instead of storing every unique visitor, it estimates:

"About 1 million unique visitors."

Memory usage:

Around 12 KB

Typical error:

Around 0.81%

Used for:

Analytics dashboards

Reddit

Google BigQuery

  1. React Reconciliation React compares:

The old Virtual DOM

The new Virtual DOM

It then updates only the changed parts of the real DOM, making UI updates faster.

  1. Micro SaaS A Micro SaaS is a small software product that solves a specific problem for a niche audience and usually earns recurring revenue through subscriptions.

Example ideas:

Resume Builder

Invoice Generator

URL Shortener

AI Grammar Checker

  1. What is a Moat? A moat is a long-term competitive advantage that makes it difficult for others to copy your business.

Examples:

Strong brand

Unique data

Loyal customers

Network effects

Proprietary technology

  1. High Load Scenarios A high-load scenario occurs when thousands or millions of users access an application simultaneously.

Examples:

  • IPL ticket booking
  • Flipkart Big Billion Days
  • Swiggy during lunch hours

To handle high load, engineers use:

  • Load balancing
  • Caching
  • Streaming
  • Virtual threads
  • Distributed databases
  1. File Handling in Java Different approaches suit different file sizes:

File Size Recommended Approach
Small files byte[]
Medium files InputStream
Large files StreamingResponseBody
Many concurrent large downloads StreamingResponseBody + Virtual Threads
Reactive applications Flux

  1. Virtual Threads (JDK 21) Virtual Threads are lightweight threads introduced in Java 21.

Compared to traditional threads, they:

Use much less memory.

Allow applications to handle thousands of concurrent tasks efficiently.

They are especially useful for web servers and I/O-bound applications.

Overall Session Summary

This session wasn't just about Java syntax—it introduced the building blocks of scalable software systems. You learned how companies like Amazon, Uber, Netflix, Discord, Swiggy, and Google handle huge amounts of data and traffic using algorithms, data structures, distributed databases, caching, efficient storage engines, and concurrency. As you continue learning Java, these concepts will help you understand not only how to write code, but also how real-world systems are designed to scale.

Top comments (0)