当前位置:网站首页>Difference Between Stateless and Stateful
Difference Between Stateless and Stateful
2022-07-31 22:50:00 【Xiaoyu who loves programming】
Stateless vs. Stateful
- Stateful Services
Stateful service, The server records the client information of each session, so as to identify the client's identity and perform corresponding processing according to the user's identity.
- Stateless Services
Understanding stateful services, stateless services are easy to understand. The most common implementation of stateless services in practice is to use a token-based approach, namely:
- The server does not save any client session information;
- Every request from the client must carry a token, which contains authentication, signature-related information (username, role, permissions, etc.);
Problems with traditional session authentication methods
HTTP itself is stateless, short connection, so we have our traditional Cookie-Session mode, which is in the monomerwidely used in architecture.After the user completes the login, the session information with the user is saved in the Session of the server, and then the server responds with a SessionID to the front end, and the front end sends this The SessionID is stored in Cookie, and subsequent requests carry the Cookie information to continue to initiate the request, and the backend queries its corresponding session information to complete the request response.
There are some problems with this approach:
- Performance: Every time a session is established, the server needs to store the session information, which increases the pressure on the server to store and query, and takes up valuable storage and computing resources;
- Scalability: The server saves the user state, and it is difficult to expand horizontally. In the microservice environment, it is necessary to perform state replication and synchronization (Session synchronization, Session sharing) on each server before processing.to expand;
- CSRF attack: Because this method is based on cookie for user identification, if the cookie is intercepted, the user and the server will be attacked by cross-site request forgery;
- Cross-platform: Sessions and cookies are hard to work with on mobile apps, you cannot share server-created sessions and cookies with mobile terminals.
Workaround:
边栏推荐
- "The core concept of" image classification and target detection in the positive and negative samples and understanding architecture
- 信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
- 顺序表的实现
- 二叉树非递归遍历
- How to get useragent
- 景区手绘地图的绘制流程
- 支付模块实现
- Realization of character makeup
- Transfer Learning - Domain Adaptation
- [QNX Hypervisor 2.2用户手册]9.15 suppress
猜你喜欢
![[Code Hoof Set Novice Village 600 Questions] Merge two numbers without passing a character array](/img/4d/038e6cd6ecad19934122cff89f4d76.png)
[Code Hoof Set Novice Village 600 Questions] Merge two numbers without passing a character array

VOT2021比赛简介

Go mode tidy reports an error go warning “all” matched no packages

基于单片机GSM的防火防盗系统的设计

【ACM】2022.7.31训练赛

Quick Start Tutorial for flyway

The article you worked so hard to write may not be your original

支付模块实现

(26)Blender源码分析之顶层菜单的关于菜单

高等代数_证明_任何矩阵都相似于一个上三角矩阵
随机推荐
Fixed-length usage of nanopb string type based on RT1052 Aworks (27)
[QNX Hypervisor 2.2用户手册]9.15 suppress
The uniapp applet checks and prompts for updates
The article you worked so hard to write may not be your original
顺序表的实现
cas and spin locks (is lightweight locks spin locks)
Pytest初体验
Document management and tools in the development process
Bionic caterpillar robot source code
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
Input and output optimization
"SDOI2016" Journey Problem Solution
Interview assault 69: TCP reliable?Why is that?
[QNX Hypervisor 2.2 User Manual]9.16 system
程序进程和线程(线程的并发与并行)以及线程的基本创建和使用
HTC使用官方固件作为底包制作rom卡刷包教程
BM3 将链表中的节点每k个一组翻转
Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
BOW/DOM (top)
Summary of the classic drawing method of histogram