当前位置:网站首页>Performance analysis of user login TPS low and CPU full
Performance analysis of user login TPS low and CPU full
2022-07-06 03:07:00 【zuozewei】
User login is just a common function , But its logic is not simple at all . Because the login process needs to compare and verify personal information , During the verification process, the corresponding encryption algorithm must be called , Encryption algorithm is a function that requires high performance . The complex encryption algorithm has high security , But the performance is poor ; Uncomplicated encryption algorithm has good performance , But it's safe , This is a question of trade-offs .
Follow the design steps of the benchmark scenario of the test scheme , First, test the benchmark scenario of this interface .
● Problem phenomenon
As shown in the figure above , This phenomenon is becoming more and more obvious .
In the pressure measurement results TPS The average is 25 The average response time reached 993 ms.
● The analysis process
In terms of performance analysis logic , For the problem of long response time , The first thing to do is to split the time . Since this system has been deployed SkyWalking, Use it to see where time is mainly spent .
Look at the picture ,Tomcat Of SelfDuration The most. , In other words, time is almost consumed in the service itself .
● Global monitoring
First, check the resource level of the application server :
You can see 4C Of CPU Resources have been exhausted .
The container deployed here , Let's take a look at the resource usage of each container :
You can see that resources are mainly consumed by the service container .
● Service orientation analysis
First, enter the service container to view the resource consumption :
stay SkyWaking You can't see the complete call stack in , Consider connecting directly to the service Java The time consumption of the method in the process . Here we use Arthas Follow up .
Check out the busiest previous N Thread and print stack :
Here is the business code of the program .
therefore trace attemptAuthentication This method .
next trace authenticate This method .
Follow it layer by layer , Finally came here :
Since the crypt_raw The method takes a long time , Then decompile the source code to see what this paragraph is .
As you can see, here is an encryption algorithm BCrypt, So the conclusion is obvious BCrypt Although the encryption algorithm has high security , But the performance is poor .
● demo verification
Use here SpringBoot Realization MD5 Encryption and BCrypt Encrypted instance .
JMeter Concurrent 20 MD5 Encryption result :
JMeter Concurrent 20 BCrypt Encryption result :
● Suggested optimization direction
Here's an explanation ,Bcrypt When encrypting , every time HASH The values are different , So it's very slow !
What exactly is Bcrypt Algorithm , You can refer to this article :https://www.jianshu.com/p/2b131bfc2f10
So that's the analysis , The optimization scheme is actually clear , That is to use faster encryption , Or remove the encryption algorithm .
边栏推荐
- Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
- Linear programming matlab
- Who is the winner of PTA
- Prototype design
- Gifcam v7.0 minimalist GIF animation recording tool Chinese single file version
- 【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
- C语言sizeof和strlen的区别
- 继承day01
- [ruoyi] enable Mini navigation bar
- 2.11 simulation summary
猜你喜欢
Eight super classic pointer interview questions (3000 words in detail)
Microservice registration and discovery
PMP每日一练 | 考试不迷路-7.5
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1
Derivation of anti Park transform and anti Clarke transform formulas for motor control
Problems encountered in 2022 work IV
#PAT#day10
RobotFramework入门(一)简要介绍及使用
I sorted out a classic interview question for my job hopping friends
RobotFramework入门(二)appUI自动化之app启动
随机推荐
张丽俊:穿透不确定性要靠四个“不变”
Spherical lens and cylindrical lens
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
[network security interview question] - how to penetrate the test file directory through
Performance test method of bank core business system
原型图设计
[unity3d] GUI control
Microsoft speech synthesis assistant v1.3 text to speech tool, real speech AI generator
jsscript
tcpdump: no suitable device found
My C language learning record (blue bridge) -- on the pointer
[pointer training - eight questions]
八道超经典指针面试题(三千字详解)
What is the investment value of iFLYTEK, which does not make money?
Data and Introspection__ dict__ Attributes and__ slots__ attribute
Eight super classic pointer interview questions (3000 words in detail)
Game theory matlab
【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
C language - Blue Bridge Cup - promised score
Modeling specifications: naming conventions