当前位置:网站首页>MPM model and ab pressure test
MPM model and ab pressure test
2022-07-03 04:40:00 【Saiyujun】
One 、MPM Model
How to handle concurrent connections
1、MPM The way
prefork
worker
event
2、 see httpd Currently in use MPM Model
[[email protected] ~]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork // What is used MPM The way
3、prefork
Mr. Yu becomes a child process , Different sub processes handle different client requests , Pre derived mode , Yes ⼀ A master control process , then ⽣ Into multiple ⼦ process , Use select Model , most ⼤ Concurrent 1024, Each subprocess has ⼀ Independent threads respond to user requests , relative ⽐ Occupy more memory , But it's stable , You can set the most ⼤ And the minimum number of processes , Is the oldest ⽼ Of ⼀ Patterns , It is also the most stable mode , It is suitable for scenes with low traffic .
advantage
Stable
Inferiority
Prone to excessive memory consumption , A large number of users have slow access , Occupancy resources ,1024 A process is not suitable ⽤ For high concurrency scenarios
<IfModule prefork.c>
StartServers 16 // Default number of initiator processes
MinSpareServers 5 // The smallest idle child process
MaxSpareServers 5 // The largest idle child process
ServerLimit 256 // The maximum number of processes allowed to start by the server
MaxClients 256 // The maximum number of connections allowed by the server
MaxRequestsPerChild 4000 // How many requests can each subprocess handle at most
</IfModule>
4、worker
Mr. Yu becomes a child process , Each subprocess will produce multiple threads , Each thread handles the client request ,⼀ A mixed model of multi process and multi thread , Yes ⼀ A control process , Start multiple ⼦ process , Every ⼦ The process contains fixed threads , send ⽤ Threads Process the request , When the thread is not enough ⽤ It will restart when ⼀ A new one ⼦ process , And then in the process ⾥⾯ Then start the thread to process the request , Because it makes ⽤ Thread processing request , Therefore, it can bear more ⾼ Concurrent .
advantage
Fast
Multiple threads generated by the same process can share memory
phase ⽐prefork Occupy ⽤ Less memory , More requests can be processed at the same time
Inferiority
unstable
worker Model and other applications are both useful topic
send ⽤keepalive Of ⻓ Connect ⽅ type , A thread will ⼀ Straight occupied , Even if no data is transmitted , Also needed ⼀ Wait until the timeout before being released . If there are too many threads , Occupied like this , It will also lead to ⾼ In the concurrent scenario ⽆ The service thread can ⽤.( The problem lies in prefork In mode , Will also send ⽣)
5、enent
Pre generate child processes , Each subprocess will produce multiple threads , Each thread handles the client request
In long connection 、 High concurrency scenario , Solved the problem of thread exhaustion
It belongs to the event driven model (epoll), Each process responds to multiple requests , In the current version ⾥ Is already stable, but ⽤ The pattern of . It and worker The pattern is very similar to , most ⼤ The difference is that , It solves keepalive scenario , Long term occupation ⽤ The waste of resources of threads ( Some threads are being keepalive, Where is the empty hanging ⾥ wait for , middle ⼏ Almost didn't ask to come , what ⾄ Wait until the timeout ). event MPM in , There will be ⼀ Individual specialty ⻔ Threads to manage these keepalive Type of thread , When there's a real request coming , Pass the request to the service thread , Of board ⾏ After the completion of ,⼜ Allow it to release . This enhances ⾼ Request processing capability in concurrent scenarios .
advantage :
Single thread responds to multiple requests , Take up less memory , High and play better , There will be ⼀ A dedicated thread to manage keep-alive Type of thread , When there's a real request coming , Pass the request to the service thread , Of board ⾏ After the completion of ,⼜ Allow it to release .
shortcoming
No thread safety control
<IfModule event.c>
StartServers 4 // Default number of initiator processes
MaxClients 300 // Maximum number of concurrent connections
MinSpareThreads 25 // Minimum number of idle threads
MaxSpareThreads 75 // Maximum number of idle threads
ThreadsPerChild 25 // The number of threads generated by each child process
MaxRequestsPerChild 100 // The maximum number of requests that each thread is allowed to process
</IfModule>
Two 、ab Pressure test
ab Introduction to common parameters :
-n : Total number of requests executed , The default is 1;
-c: Concurrency number , The default is 1;
-t: The total time taken for the test , Seconds per unit , default 50000s
-p:POST Data file at
-w: With HTML Format output result of table
#
#ab ‐c 100 ‐n 1000 http://vedio.linux.com/index.html
2 This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
4 Licensed to The Apache Software Foundation, http://www.apache.org/
5
6 Benchmarking vedio.linux.com (be patient)
7 Completed 100 requests
8 Completed 200 requests
9 Completed 300 requests
10 Completed 400 requests
11 Completed 500 requests
12 Completed 600 requests
13 Completed 700 requests
14 Completed 800 requests
15 Completed 900 requests
16 Completed 1000 requests
17 Finished 1000 requests
18
19
20 Server Software: Apache
21 Server Hostname: vedio.linux.com
22 Server Port: 80
23
24 Document Path: /index.html
25 Document Length: 17 bytes
26
27 Concurrency Level: 100 // Number of concurrent connections
28 Time taken for tests: 1.252 seconds // The time taken by the server to complete all requests 【 important indicator 】
29 Complete requests: 1000
30 Failed requests: 0
31 Write errors: 0
32 Total transferred: 268000 bytes // How many bytes of data have been transmitted ; Real data +http The first one
33 HTML transferred: 17000 bytes // How many bytes of data have been transmitted ; Real data
34 Requests per second: 798.78 [#/sec] (mean) // Number of requests processed per second , Throughput rate ;【 important indicator 】
35 Time per request: 125.190 [ms] (mean) // Average user request wait time , Company ms 【 important indicator 】
36 Time per request: 1.252 [ms] (mean, across all concurrent requests) // Processing time of user request 【 important indicator 】
37 Transfer rate: 209.06 [Kbytes/sec] received // Measure bandwidth 【 important indicator 】
38
39 Connection Times (ms)
40 min mean[+/‐sd] median max
41 Connect: 0 7 11.9 2 56
42 Processing: 4 114 66.7 108 1071
43 Waiting: 2 96 46.0 93 1071
44 Total: 6 121 68.3 111 1104
45
46 Percentage of the requests served within a certain time (ms)
47 50% 111
48 66% 124
49 75% 140
50 80% 151
51 90% 174
52 95% 194
53 98% 267
54 99% 301
55 100% 1104 (longest request)
边栏推荐
- Ffmpeg tanscoding transcoding
- [software testing-6] & Test Management
- 会员积分商城系统的功能介绍
- data2vec! New milestone of unified mode
- 智能合约安全审计公司选型分析和审计报告资源下载---国内篇
- Triangular rasterization
- Leetcode simple question: the key with the longest key duration
- How to choose cross-border e-commerce multi merchant system
- 2.14 summary
- Factor stock selection scoring model
猜你喜欢
Integration of Android high-frequency interview questions (including reference answers)
I stepped on a foundation pit today
Youdao cloud notes
Design and implementation of JSP logistics center storage information management system
7. Integrated learning
How to retrieve the password for opening word files
Introduction to JVM principle
Jincang KFS data bidirectional synchronization scenario deployment
Pyqt control part (II)
Number of uniform strings of leetcode simple problem
随机推荐
[set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
FuncS sh file not found when using the benchmarksql tool to test kingbases
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
Kingbasees plug-in KDB of Jincang database_ database_ link
Hj35 serpentine matrix
The simple problem of leetcode: dismantling bombs
一名外包仔的2022年中总结
C primre plus Chapter 10 question 6 inverted array
Triangular rasterization
I stepped on a foundation pit today
Pyqt control part (II)
The reason why the entity class in the database is changed into hump naming
Kingbasees plug-in KDB of Jincang database_ exists_ expand
A outsourcing boy's mid-2022 summary
[BMZCTF-pwn] 20-secret_ file
IPhone x forgot the boot password
Basic use of continuous integration server Jenkins
Auman Galaxy new year of the tiger appreciation meeting was held in Beijing - won the double certification of "intelligent safety" and "efficient performance" of China Automotive Research Institute
智能合约安全审计公司选型分析和审计报告资源下载---国内篇
AWS VPC