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

멀티 쓰레드? 멀티 프로세스? #30

Open
anthologia opened this issue Sep 19, 2022 · 1 comment
Open

멀티 쓰레드? 멀티 프로세스? #30

anthologia opened this issue Sep 19, 2022 · 1 comment
Assignees
Labels
Spring - Kim Yeonghan 김영한님 스프링 강의 관련 질의응답

Comments

@anthologia
Copy link
Collaborator

스프링 MVC 1편에서 멀티 쓰레드에 대해서 짧게 다뤘습니다.

동시 요청을 처리하는 방법으로 멀티 쓰레드 말고도 멀티 프로세스가 있는데요.
둘의 차이점은 무엇이고, 어떤 상황에서는 어떤 방식을 사용해야 더 좋은가요?

WAS는 멀티 쓰레드만 지원하고, 멀티 프로세스는 지원하지 않나요?
만약 그렇다면 그 이유는 무엇인가요?

@anthologia anthologia added the Spring - Kim Yeonghan 김영한님 스프링 강의 관련 질의응답 label Sep 19, 2022
@KimChanJin97
Copy link
Collaborator

KimChanJin97 commented Sep 19, 2022

Tomcat 은 멀티 쓰레드만 지원합니다.
Apache 는 멀티 프로세스를 기본으로 지원하고 설정에 따라 멀티 쓰레드를 같이 운용할 수 있습니다.
(찾아보니 Web Server 는 멀티 쓰레드 + 멀티 프로세스 를 지원하는 것들이 있는데,
WAS는 이 두개를 동시에 지원하는 것들이 안보입니다.
Web Server 와 WAS가 왜 이런 차이를 보이는지 찾아봐야 할 것 같습니다.)

Tomcat이 멀티 쓰레드 + 멀티 프로세스 방식을 사용하기 위해선 Tomcat 과 Apache 를 연동할 수 있습니다.
Tomcat 은 Web Server 의 기능과 Web Container(Servlet Container)기능을 모두 수행합니다.
하지만 Tomcat이 Web Server 의 기능과 Web Container(Servlet Container)기능을 모두 수행하는 것은 성능이 떨어집니다. 왜냐하면 WAS가 정적/동적 데이터를 모두 처리하는 것은 부하가 커지기 때문입니다.
그래서 Web Server는 Apache 가 담당하고, Web Container(Servlet Container)기능은 Tomcat이 담당하는 방법을 사용합니다.
물론 현재에는 Tomcat이 많이 발전해서 Tomcat의 Web Server 가 Apache에 뒤쳐지지 않을 만큼의 기능을 하지만 그럼에도 불구하고 연동하는 이유는 Apache 내에서만 설정할 수 있는 부분이라든가, Apahce에서 제공하는 유용한 모듈을 Tomcat에서는 사용할 수 없는 등의 이유가 있기 때문입니다. 
따라서 Tomcat(WAS)와 Apache(Web Server)를 연동하여 사용합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Spring - Kim Yeonghan 김영한님 스프링 강의 관련 질의응답
Projects
None yet
Development

No branches or pull requests

2 participants