当前位置:网站首页>2、 Concurrent and test notes youth training camp notes
2、 Concurrent and test notes youth training camp notes
2022-07-07 07:24:00 【A low-key horse】
Concurrent 、 Unit test course notes | Youth Camp notes
This is my participation 「 The third youth training camp - Back end field 」 The third part of note creation activities 1 Notes
Concurrent
Concurrency and parallelism
Concurrent : In a nuclear CPU Run in
parallel : In multi-core CPU Run in
Coroutines and threads
- coroutines : User mode lightweight threads ,KB Level
- Threads : Kernel mode , It can run multiple Synergetics ,MB Level
Co process communication
channel( Is it synchronized -> The efficiency of consumption and production varies )
Lock( Concurrent security )
sync Under bag Mutex, Locking ensures concurrency security
WaitGroup
Method :
structure :
test
unit testing
The rules
assert( Example :assert.Equal() Method , Quickly compare and judge the test results )
coverage (
)<===“–cover”
rely on ((mock Mechanism ) idempotent 、 Stable ==》 Pile driving )
idempotent : Every test run should produce the same results as before
Mockey Patch The scope of Runtime, Pass... At run time Go Of unsafe package , Replace the address of the function in memory with the address of the runtime function . Jump the implementation of the function or method to be driven .
The benchmark
Test the performance and CPU Loss of
ps: perform rand It takes a long time , because rand In order to ensure global randomness and concurrency security , Holds a global lock , Therefore, it is recommended to use a high-performance random number method fastrand, At the expense of certain sequence consistency .
Add
The difference between the two forms of login
One 、Cookie and Session
This is generally used for authentication when interacting with the client .
Two 、JWT+Token
No need to rely on some storage , Generally, the backend decrypts directly .
It usually lies in the server 、http If you interact , Use JWT+token
Message queuing application scenario
The main problem to be solved is isolation
Use scenarios : The two methods , If it's a strong dependence , It cannot be achieved in this way
If it is non strong dependency , Method A Is to release a message 、 event , Method B It is to receive and consume this event for asynchronous processing , In this case, use message queuing , Can play a decoupling function
Strong dependence , It cannot be achieved in this way
If it is non strong dependency , Method A Is to release a message 、 event , Method B It is to receive and consume this event for asynchronous processing , In this case, use message queuing , Can play a decoupling function
边栏推荐
- Pass parent component to child component: props
- $parent(获取父组件) 和 $root(获取根组件)
- js小练习
- Hidden Markov model (HMM) learning notes
- Model application of time series analysis - stock price prediction
- A slow SQL drags the whole system down
- Communication between non parent and child components
- Composition API premise
- freeswitch拨打分机号源代码跟踪
- Implementation of AVL tree
猜你喜欢
Outlier detection technology of time series data
MySQL service is missing from computer service
How to * * labelimg
Sword finger offer high quality code
At the age of 20, I got the ByteDance offer on four sides, and I still can't believe it
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Advanced practice of C language (high level) pointer
Lm11 reconstruction of K-line and construction of timing trading strategy
transform-origin属性详解
95后CV工程师晒出工资单,狠补了这个,真香...
随机推荐
Sqlmap tutorial (IV) practical skills three: bypass the firewall
mips uclibc 交叉编译ffmpeg,支持 G711A 编解码
About binary cannot express decimals accurately
Precise space-time travel flow regulation system - ultra-high precision positioning system based on UWB
修改Jupyter Notebook文件路径
Differences between H5 architecture and native architecture
PostgreSQL source code (59) analysis of transaction ID allocation and overflow judgment methods
异步组件和Suspense(真实开发中)
Convolutional neural network -- understanding of pooling
Reflection (II)
点亮显示屏的几个重要步骤
URP - shaders and materials - light shader lit
Initial experience of teambiion network disk (Alibaba cloud network disk)
选择商品属性弹框从底部弹出动画效果
Lvs+kept (DR mode) learning notes
How can brand e-commerce grow against the trend? See the future here!
云备份项目
A slow SQL drags the whole system down
虚拟机的作用
. Net core accesses uncommon static file types (MIME types)