当前位置:网站首页>Apache MPM model and ab stress test
Apache MPM model and ab stress test
2022-07-03 04:40:00 【Saiyujun】
MPM Models and ab Pressure test
List of articles
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)
边栏推荐
- Learning practice: comprehensive application of cycle and branch structure (I)
- [SQL injection] joint query (the simplest injection method)
- Truncated sentences of leetcode simple questions
- Number of 1 in binary (simple difficulty)
- Asp access teaching management system design finished product
- I stepped on a foundation pit today
- Function introduction of member points mall system
- 一名外包仔的2022年中总结
- IPhone x forgot the boot password
- I've been in software testing for 8 years and worked as a test leader for 3 years. I can also be a programmer if I'm not a professional
猜你喜欢
Preliminary cognition of C language pointer
Smart contract security audit company selection analysis and audit report resources download - domestic article
Preparation for school and professional cognition
Leetcode simple question: check whether two string arrays are equal
Web - Information Collection
Design and implementation of JSP logistics center storage information management system
Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
Basic use of continuous integration server Jenkins
data2vec! New milestone of unified mode
MC Layer Target
随机推荐
Joint set search: merge intervals and ask whether two numbers are in the same set
MediaTek 2023 IC written examination approved in advance (topic)
Reptile exercise 02
Contents of welder (primary) examination and welder (primary) examination in 2022
Php+mysql registration landing page development complete code
【SQL注入】联合查询(最简单的注入方法)
Priv-app permission异常
[fxcg] inflation differences will still lead to the differentiation of monetary policies in various countries
data2vec! New milestone of unified mode
Leetcode simple question: the key with the longest key duration
AWS VPC
文献阅读_基于多模态数据语义融合的旅游在线评论有用性识别研究(中文文献)
Smart contract security audit company selection analysis and audit report resources download - domestic article
Number of 1 in binary (simple difficulty)
MySQL winter vacation self-study 2022 12 (3)
Leetcode simple question: check whether the string is an array prefix
What functions need to be set after the mall system is built
When using the benchmarksql tool to test the concurrency of kingbasees, there are sub threads that are not closed in time after the main process is killed successfully
[set theory] binary relationship (definition field | value field | inverse operation | inverse synthesis operation | restriction | image | single root | single value | nature of synthesis operation)
雇佣收银员(差分约束)