Skip to content

[Assignment] 선의 과제#19

Open
sunnny619 wants to merge 5 commits into
mainfrom
assignment/seoneui
Open

[Assignment] 선의 과제#19
sunnny619 wants to merge 5 commits into
mainfrom
assignment/seoneui

Conversation

@sunnny619

Copy link
Copy Markdown
Collaborator

stateful VS stateless

@sunnny619 sunnny619 self-assigned this Jul 23, 2024
| | Stateful | Stateless |
| --- | --------------------------------------------------- | ---------------------------------------------------------------- |
| 정의 | 세션이 종료될 때까지, 클라이언트의 세션 정보를 저장하는 네트워크 프로토콜 | 클라이언트의 요청에 따른 응답만 처리하는 네트워크 프로토콜 |
| 예시 | TCP, FTP, Telnet 등 | HTTP, UDP, DNS 등 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Telnet이 뭔가요

클라이언트와 서버 관계에서 **서버가 클라이언트의 상태를 보존**함을 의미하는게 상태유지
자세히 말하자면 클라이언트와 서버 간에 송수신을 하며 단계별 과정을 진행하는데 있어, 서버에서 클라이언트가 이전 단계에서 제공한 값을 저장하고 다음 단계에서도 저장한 상태를 말함

예를 들어 홈 페이지에서 한 번 로그인 하면 페이지를 이동해도 로그인이 풀리지 않고 계속 유지되는 이유가 서버가 클라이언트의 상태를 기억하고 있기 때문에 가능한 것

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

요건 stateless해도 가능한 기능이에요 만약 stateful의 상태를 기억하고 있다는 점을 강조하고 싶으면
서버의 메모리 내부에 클라이언트의 정보가 계속 남아있다는 점을 강조해야 해요.
stateless하더라도 매 요청마다 토큰값을 전달하면 사실상 서버는 유저의 로그인 여부를 항상 파악할 수 있어요.

위에서 상태를 유지한다는 함은, 서버에서 클라이언트의 상태 정보를 저장하고 있는 것
그렇다면 stateful의 문제점은 **해당 서버가 멈추거나 여러 이유로 해당 서버가 못쓰게** **되어** **다른 서버를 사용해야 할때** 발생함
왜냐하면 새로운 서버에는 이전 서버에서 가지고 있던 상태값을 가지고 있지 않기 때문

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

핵심을 잘 짚었음!!! :D

## stateless?

클라이언트와 서버 관계에서 **서버가 클라이언트의 상태를 보존하지 않음**을 의미하는게 무상태
즉, stateless 구조에서 **서버는 단순히 요청이 오면 응답을 보내는 역할만 수행**하며, 상태 관리는 전적으로 클라이언트에게 책임이 있는 것

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

인증 후에 응답을 보낸다가 맞는 표현 같습니다~

### stateless와 token

무상태의 특징으로 클라이언트와 서버간의 통신에 필요한 모든 상태 정보들은 클라이언트에서 가지고 있다가 서버와 통신할때 데이터를 실어 보내는 것이기에 서버는 단순히 받아서 응답만 해주기 때문에 서버에 대한 부하가 현저히 줄어듦

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

세션을 유지하느라 발생하는 리소스 VS 토큰 인증으로 인해 발생하는 리소스
중에 어떤게 더 클까요? stateless가 무조건 부하를 낮출까요?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

인 메모리 변수 접근 VS 토큰 해싱 중에 뭐가 더 효율적일까요?

@thinkjin99

Copy link
Copy Markdown
Owner

전반적으로 완성도 있게 잘 작성해주셨습니다. 노력이 보이는 과제라 뜻깊은 것 같아요
고생하셨습니다!

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.

3 participants