Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스프링부트는 어떻게 하나의 컨트롤러로 여러 요청을 받을까? #130

Open
skarltjr opened this issue Sep 30, 2022 · 0 comments
Labels

Comments

@skarltjr
Copy link
Owner

skarltjr commented Sep 30, 2022

스프링mvc는 요청당 스레드를 할당
그런데 모든 스레드들이 하나의 컨트롤러에 진입해서 요청 처리를 진행하는데 어떻게 이게 가능한것인가.

컨트롤러도 어쨋든 하나의 객체다
jvm 메모리구조에서 객체는 어디에 저장되는가?
힙 영역이다!!!
그리고 이 객체의 매서드등은 코드(method area) 영역에 존재하며
그리고 각 스레드는 스택을 제외한 나머지 영역을 공유한다..

즉 컨트롤러의 매서드가 stateless하게 구성되어있다면 모든 스레드들은 컨트롤러 매서드를 공유하고 
이 컨트롤러의 상태를 변화시키는 동작은 없기에 동시성 문제가 존재하지 않으며
각 스레드는 개별적인 스택영역을 활용하여 서비스 로직처리가 가능하다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant