강의

멘토링

로드맵

Inflearn brand logo image
Programming

/

Back-end

Building Production-Level Real-Time Chat Server: From Distributed Processing to Performance Optimization (Kotlin & Spring)

Using Spring Boot 3.x + Kotlin, we build a 3-instance cluster, and utilizing Redis Pub/Sub distributed messaging and an Nginx load balancer, develop a scalable WebSocket real-time chat server capable of handling large-scale traffic.

(4.7) 15 reviews

109 learners

  • Hong
실습 중심
서버
백엔드
백엔드개발자
아키텍처
Spring
Kotlin
Spring Boot
websocket

Reviews from Early Learners

What you will learn!

  • Distributed messaging system for real-time message synchronization across multiple server instances using Redis Pub/Sub.

  • How to configure a 3-instance cluster with Docker Compose and distribute traffic using an Nginx load balancer

  • Implement bidirectional real-time communication using Spring WebSocket

  • How to design a scalable server architecture by applying Domain-driven Design in a multi-module structure

  • Redis-based message sequencing guaranteeing order in distributed environments

  • Service Operation Methods via Docker Container-Based Deployment, Health Checks, and Log Monitoring

  • Modern Backend Development Using Spring Boot 3.x + Kotlin's Latest Features

  • Defensive coding for stable service operation, including message deduplication, session cleanup, resource release, etc.

In this course, you will...

You will design and build a scalable server architecture that can handle tens of thousands of users in a real-world service environment.


🏗 . Beyond simply implementing functions, you can learn the core principles of distributed systems that operate reliably even under large-scale traffic.

First, you will learn how to distribute traffic with an Nginx load balancer so that multiple servers can act as a single system 🌐 and how to synchronize messages between servers in real time using Redis Pub/Sub . In the process, you will naturally acquire the know-how to solve the C10K (10,000 concurrent connections) problem.


You'll also get to experience tuning your database connection pool and improving response times down to milliseconds by implementing JPA batch processing and cursor-based pagination.

Finally, you will learn stable operation techniques to maintain a consistent environment from development to deployment through Docker containers 🐳 and to prevent service failures in advance by building a Health Check and monitoring system 🩺 . All of these processes will be implemented in elegant and efficient code using the latest stacks : Kotlin, Spring Boot 3.x, and websocket .

📦 After taking the lecture, you can create results like this

A fully decentralized chat application 📦

You get a complete application package that can run the entire system (server, database, cache, etc.) at once with a command. It is a ready-to-deploy service, not just a collection of code snippets.

Production Level System Architecture Design 🗺

You will build and understand a system architecture blueprint that covers the entire flow from user requests to data storage. This blueprint will be a great portfolio asset that demonstrates your technical depth.

Real-time two-way chat feature 💬

You will have a fully implemented core chat functionality that allows users to log in, create chat rooms, and exchange various messages in real time.

Horizontally scalable server cluster

We will build a server cluster with n Spring Boot servers running under an Nginx load balancer. This will teach you how to easily scale the system by simply adding server instances when traffic increases.

High availability messaging system 📡

We build a reliable messaging system that delivers all messages without loss through Redis Pub/Sub even if one server fails or users access different servers.

Optimized Data Management System

We will complete a hybrid data system that satisfies both data stability and fast response speed by permanently storing chat data in PostgreSQL and storing session information and cache data in Redis.

📚 Lecture Key Contents!

Redis Pub/Sub Distributed Messaging

Implement Redis's publish-subscribe pattern for real-time message synchronization across multiple server instances. Build a production-grade distributed messaging system that prevents duplicate messages, guarantees message order, and provides isolation per server, laying the foundation for scalable real-time communication.

WebSocket based real-time communication

Implements bidirectional real-time communication that is much more efficient than HTTP by leveraging Spring WebSocket. Provides stable real-time chat functionality through session management, connection state tracking, error handling, etc., and also applies optimization techniques for resolution.

Multi-module DDD architecture

Following the Domain-driven Design principle, we separate the API, Domain, Persistence, and WebSocket layers into independent modules. We build an extensible server architecture that maximizes maintainability and testability by clearly distinguishing the responsibilities of each module and controlling the direction of dependencies.

Nginx load balancer + WebSocket proxy

Configure an Nginx load balancer that evenly distributes traffic across n Spring Boot instances. Reliably proxy WebSocket connections as well as HTTP requests, and build a highly available service environment with production-grade reverse proxy settings.

📚 View project feature architecture

Redis Pub/Sub

Message Processing Process

📚 Preview the lecture!

📚 Writing a WebSocket Session Management Class



📚 Deploying servers using automated scripts



📚 Docker- Compose for environment deployment



📚 Setting up Nginx performance metrics



Why should I learn Kotlin..?

It is said to be 100% compatible with Spring, and Kotlin, a language created by Jetbrain, is optimized for concurrent programming, which Spring is not suitable for.

📚 Concise and intuitive grammar


Kotlin allows developers to do more with less code because it provides a concise and intuitive syntax. This has the effect of improving readability and making it easier to maintain.

📚 High productivity and safety


Kotlin supports null safety by default, which can reduce null pointer exceptions (NullPointerException). It also supports functional programming, which allows you to write code in a more functional and declarative way. These features increase development productivity and reduce the possibility of bugs.

📚 High compatibility


Kotlin is 100% compatible with Java, making it easy to integrate into existing Java projects. This means that Java developers have no significant barriers to learning Kotlin, and can use new Kotlin features while maintaining existing code.

Can't we just implement websocket with HTTP ? 🤔

📌 It is possible. It is not an impossible development method.

📌 However, server developers generally need to take advantage of server resources as much as possible.

📌 Therefore, in cases where a continuous connection must be maintained, such as a chat server, it is very suitable to use WebSocket .

Four values that are important

1. Lectures must be humane.

I don't think a lecture that is easy to show off is a lecture, even if it may be considered unprofessional. Debugging is also part of the lecture.

2. It must be specialized for practical work.

Development is not something you just talk about. You can actually implement it and go through the process of making it work.

  • Planners... please save me...

3. It must be helpful to students.

I wanted to incorporate concepts that I have applied and seen effective in my field. Through this process, you can indirectly experience the field, or if you are a practitioner, you can demonstrate better performance in the field environment.

4. The lecture is not over.

I hope you leave a lot of questions and answers as you go through the lecture. This lecture was not created solely based on my knowledge. It also includes opinions from developers at various large companies.

  • Here are some brief biographies of those who helped in completing this lecture:


private val supported_one = "Kakao Pay Platform Backend Developer" private val supported_two = "Toss Securities API Server Developer" private val supported_three = "Unicorn startup server developer who wants to keep it a secret"

Things to note before taking the class

Practice environment

  • Taken using MacOS M3.

  • It uses Docker by default.

  • java --version : 17.0.12 2024-07-16 LTS

  • I use an IDE from the JetBrains family.

  • Build using Gradle.

    • The source code is fully included, including the build files, to prevent possible version conflicts.

😍 Good topic to look at together

Recommended for
these people

Who is this course right for?

  • Backend Dev: Jr.→Mid-level Growth

  • Developer wanting real-time service development experience

  • Developer interested in Distributed Systems Architecture

  • Mid-level developer who wants to grow into a senior developer

  • Developers with Docker basics or aspiring learners.

  • Game/Chat/Social Service Developer

  • Job seeker looking to enhance their portfolio

  • Developer planning a job change by expanding their tech stack

Need to know before starting?

  • Basic knowledge of Spring is helpful.

  • Basic knowledge of Web Socket communication is a plus.

  • You don't need all this knowledge. Since we'll be implementing the project directly, we can learn together.

Hello
This is

2,728

Learners

188

Reviews

76

Answers

4.5

Rating

14

Courses

자기 소개

집에서 빈둥대다 개발에 흥미를 느껴 개발 공부를 시작하였고 현재는 판교에서 플랫폼 서버 개발을 담당하여 진행하고 있습니다.

 

제가 공부를 했던 방법과 실무에서 접하실 수 있는 여러가지 문제점들과 해결책을 여러분들에게 제공하고 싶어 지식공유자 활동을 이어나가고 있습니다.

 

강의는 오로지 저만의 지식을 통해 만들어지지 않습니다. 모든 강의는 함께하시는 분들이 계십니다.

 

지식공유자 경력

[前] 샌드박스 블록체인 개발자

[前] 넥슨 자회사 백엔드 개발자

[] 판교에서 고여가는 서버 개발자

 

인터뷰 이력

Curriculum

All

28 lectures ∙ (4hr 55min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

All

15 reviews

4.7

15 reviews

  • kju626095386님의 프로필 이미지
    kju626095386

    Reviews 8

    Average Rating 5.0

    5

    100% enrolled

    I watched the lecture well with realistic and good content. Thank you.

    • jhong
      Instructor

      Hello ks ju, thank you for leaving a review. In actual operating environments, this structure can accommodate much more diverse functionality, so you can think of it as a structure designed for that purpose 😊😊 I will continue to provide more beneficial lectures in the future. Have a great day :)

  • youngba8935643님의 프로필 이미지
    youngba8935643

    Reviews 4

    Average Rating 5.0

    Edited

    5

    96% enrolled

    I prepared for employment and referred to the instructor's lectures a lot while working in practice, using them as a foundation for my learning, and I think this is really high-quality content that has been tremendously helpful. The process of writing code together is also very beneficial, and since it feels like coding alongside someone right next to me, I think the learning effect becomes that much better!! I hope to watch more frequently in the future and that good lectures will continue to be created. Thank you!

    • jhong
      Instructor

      Hello Tenburger! I heard you're preparing for job hunting!! I hope this course will be of great help to you. Please let us know if you successfully land a job later 😊😊 Thank you!

  • kask814587762님의 프로필 이미지
    kask814587762

    Reviews 3

    Average Rating 5.0

    5

    100% enrolled

    I enjoyed the lecture. There wasn't any major inconvenience in watching it, and the content itself was very beneficial. Please continue to provide good lectures in the future!

    • jhong
      Instructor

      Hello Woo-dang-tang! Thank you so much for leaving such a nice review!! I will work hard to provide even more beneficial and interesting lectures that are suitable for practical work in the future! Have a great day!

  • eightee724277님의 프로필 이미지
    eightee724277

    Reviews 4

    Average Rating 5.0

    5

    93% enrolled

    I learned so much. I think this is a great lecture. I'm planning to take other courses as well.

    • jhong
      Instructor

      Hello, I'm glad you liked #8!! I hope to see you in other lectures too 😊😊 Thank you for the good review!

  • tasdo4797187님의 프로필 이미지
    tasdo4797187

    Reviews 5

    Average Rating 5.0

    5

    100% enrolled

    As a backend developer... this was really helpful. Thank you.

    • jhong
      Instructor

      Hello tasd os! Since we're in the same field, I'm so proud that it seems to have been very helpful to you. Thank you!

Limited time deal

$51.70

18%

$63.80

Hong's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!