Skip to content

MOSU-354 feat: 가상 쓰레드 활성화#355

Merged
wlgns12370 merged 2 commits intodevelopfrom
perf/mosu-354
Aug 22, 2025
Merged

MOSU-354 feat: 가상 쓰레드 활성화#355
wlgns12370 merged 2 commits intodevelopfrom
perf/mosu-354

Conversation

@wlgns12370
Copy link
Contributor

@wlgns12370 wlgns12370 commented Aug 22, 2025

✨ 구현한 기능

📢 논의하고 싶은 내용

  • x

🎸 기타

  • x

Summary by CodeRabbit

  • Chores
    • Enabled virtual threads in runtime configuration to improve responsiveness and throughput under high concurrency; no workflow changes or downtime expected.
  • Bug Fixes
    • Clarified signup duplicate-account handling so social (Kakao) signups are now rejected with the appropriate duplicate response while local pending accounts are handled distinctly, reducing signup errors and confusion.

@coderabbitai
Copy link

coderabbitai bot commented Aug 22, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a Spring Boot setting to enable virtual threads and updates sign-up validation: introduces an isKakaoUser() predicate and changes duplicate-user checks in SignUpAccountStepProcessor to treat Kakao-backed users and pending Mosu users distinctly.

Changes

Cohort / File(s) Summary
Configuration: Virtual Threads
src/main/resources/application-base.yml
Added spring.threads.virtual.enabled: true under spring.threads. No other config changes.
Sign-up validation logic
src/main/java/life/mosu/mosuserver/application/auth/processor/SignUpAccountStepProcessor.java
Reworked existing-user validation: added explicit check for Kakao users to throw KAKAO_DUPLICATED; retained pending+mosu check to throw USER_ALREADY_EXISTS; removed prior provider-switch under pending logic.
User entity predicate
src/main/java/life/mosu/mosuserver/domain/user/entity/UserJpaEntity.java
Added public boolean isKakaoUser() returning true when provider == AuthProvider.KAKAO.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant Controller as SignUpController
  participant Processor as SignUpAccountStepProcessor
  participant Repo as UserRepository
  Note over Processor: New validation branching
  Client->>Controller: signUpRequest
  Controller->>Processor: validateForNewSignUp(request)
  Processor->>Repo: findByLoginId/login identifiers
  Repo-->>Processor: existingUser (if any)
  alt existingUser is Kakao
    Processor-->>Controller: throw KAKAO_DUPLICATED (error)
  else existingUser is pending and mosu-backed
    Processor-->>Controller: throw USER_ALREADY_EXISTS (error)
  else no conflicting existingUser
    Processor->>Repo: existsByLoginId(...) (final check)
    Repo-->>Processor: exists? -> continue
  end
  Controller-->>Client: success / error response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Enable virtual threads [#354]

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Modified sign-up validation logic (src/main/java/life/mosu/mosuserver/application/auth/processor/SignUpAccountStepProcessor.java) Not related to enabling virtual threads; this changes application logic for provider/pending checks.
Added isKakaoUser() predicate (src/main/java/life/mosu/mosuserver/domain/user/entity/UserJpaEntity.java) Domain API addition for provider checks; unrelated to the performance/config objective in #354.

Possibly related PRs

Suggested labels

우선순위 중

Poem

I flipped a tiny config switch—hop! 🐇
Threads go nimble, light as crop.
I nudge the signup cheeky and spry,
Keep Kakao friends from a double try.
Thump-thump! the server hums — carrots nigh. 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2d536c3 and fd25476.

📒 Files selected for processing (2)
  • src/main/java/life/mosu/mosuserver/application/auth/processor/SignUpAccountStepProcessor.java (1 hunks)
  • src/main/java/life/mosu/mosuserver/domain/user/entity/UserJpaEntity.java (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch perf/mosu-354

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @wlgns12370, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 애플리케이션의 성능 최적화를 목표로 가상 쓰레드 기능을 활성화합니다. 특히 CPU 사용량이 낮고 응답 시간이 높은 작업에서 효율성을 높여 전반적인 시스템 반응성을 개선하는 데 중점을 둡니다.

Highlights

  • 가상 쓰레드 활성화: application-base.yml 파일에 spring.threads.virtual.enabled: true 설정을 추가하여 Spring Boot 애플리케이션에서 가상 쓰레드 기능을 활성화합니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

가상 쓰레드를 활성화하여 I/O 중심 작업의 성능을 개선하려는 좋은 변경입니다. 이 변경으로 애플리케이션의 동시 처리 능력이 향상될 것으로 기대됩니다.

다만, 가상 쓰레드를 도입하면서 함께 고려해야 할 몇 가지 사항에 대해 리뷰 코멘트를 남겼습니다. 데이터베이스 커넥션 풀 크기 조정과 비동기 작업(@Async)에 대한 쓰레드 풀 설정이 가상 쓰레드와 함께 올바르게 동작하는지 확인이 필요해 보입니다. 자세한 내용은 파일 리뷰를 참고해 주세요.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/main/resources/application-base.yml (3)

13-16: Capacity tuning follow-up (DB pool, servlet threads, timeouts).

Virtual threads raise concurrency; ensure downstream limits are sane:

  • HikariCP is capped at 15; watch acquisition timeouts and DB saturation before increasing.
  • If using Tomcat, consider lowering max worker threads (platform threads still exist) once load-tested.
  • Validate request and async timeouts so massively concurrent work doesn’t pile up.

If you want, I can suggest profile-specific overrides (e.g., a lower server thread cap for dev/stage) after we confirm the runtime stack (Tomcat/Jetty/Undertow) and current load test results.


68-71: Verify redis.port env var name.

port: ${VELKEY_PORT} looks unusual alongside spring.data.redis.*. If this isn’t intentional, it may need to be ${REDIS_PORT} (or another redis-specific env).


13-16: Review of Virtual Thread Pinning and Context Propagation

Optional refactoring suggestion—no critical blockers found.

  • Pinning hotspots: No occurrences of synchronized (…) or ReentrantLock around potentially blocking calls were detected in production code.
  • Custom executors: The only explicit thread pools are in tests (IpRateLimitingFilterMultiUserIsolationTest.java), so production paths will use Spring Boot’s configured virtual-thread executor.
  • Context propagation: We do see SecurityContextHolder usages in controllers (MyUserController), filters (TokenFilter, KmcTokenProcessingFilter), and argument resolvers (PhoneNumberArgumentResolver, UserIdArgumentResolver). If you introduce any @Async or @Scheduled tasks backed by the virtual-thread executor, ensure the security context (and any ThreadLocals/MDC you introduce later) is propagated—e.g. via Spring’s DelegatingSecurityContextExecutor or SecurityContextTaskDecorator.

Given there are no urgent pinning or custom-executor issues, this remains an optional refactor to harden context propagation under virtual threads.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e7433f3 and 2d536c3.

📒 Files selected for processing (1)
  • src/main/resources/application-base.yml (1 hunks)
🔇 Additional comments (1)
src/main/resources/application-base.yml (1)

13-16: Virtual Threads Flag Verified

  • Spring Boot is pinned to version 3.4.5 (build.gradle line 3), which is ≥ 3.2.0.
  • The Java toolchain is configured for Java 21 (build.gradle line 13).
  • I didn’t locate any Dockerfiles using Temurin or OpenJDK base images—if you are containerizing, please ensure your images also run on Java 21+.

With those requirements met, the threads.virtual.enabled: true setting in src/main/resources/application-base.yml will be effective.

@mosu-dev mosu-dev deleted a comment from gemini-code-assist bot Aug 22, 2025
@wlgns12370 wlgns12370 merged commit 62e79c0 into develop Aug 22, 2025
2 of 3 checks passed
@wlgns12370 wlgns12370 deleted the perf/mosu-354 branch August 22, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[📈 성능 개선] 가상 쓰레드 활성화

1 participant