当前位置:网站首页>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)
边栏推荐
- Sdl2 + OpenGL glsl practice (Continued)
- Small program animation realizes the running lantern and animation object
- Kubernetes源码分析(一)
- Two drawing interfaces - 1 Matlab style interface
- [free completion] development of course guidance platform (source code +lunwen)
- [set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
- [USACO 2009 Dec S]Music Notes
- Reptile exercise 03
- 2022 chemical automation control instrument examination summary and chemical automation control instrument certificate examination
- 7. Integrated learning
猜你喜欢
Employee attendance management system based on SSM
Triangular rasterization
MC Layer Target
Preliminary cognition of C language pointer
[USACO 2009 Dec S]Music Notes
金仓KFS数据双向同步场景部署
Two drawing interfaces - 1 Matlab style interface
SSM based campus part-time platform for College Students
使用BENCHMARKSQL工具对kingbasees并发测试时kill掉主进程成功后存在子线程未及时关闭
[fxcg] inflation differences will still lead to the differentiation of monetary policies in various countries
随机推荐
Leetcode simple problem delete an element to strictly increment the array
2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
逆袭大学生的职业规划
第十九届浙江省 I. Barbecue
Leetcode simple question: check whether the string is an array prefix
Asp access teaching management system design finished product
I've seen a piece of code in the past. I don't know what I'm doing. I can review it when I have time
RSRS index timing and large and small disc rotation
Priv-app permission异常
Bugku CTF daily question baby_ flag. txt
Handling record of electric skateboard detained by traffic police
有道云笔记
arthas watch 抓取入参的某个字段/属性
[set theory] binary relation (example of binary relation on a | binary relation on a)
Matplotlib -- save graph
Why should programmers learn microservice architecture if they want to enter a large factory?
2022 chemical automation control instrument examination summary and chemical automation control instrument certificate examination
金仓数据库KingbaseES 插件kdb_date_function
【PHP漏洞-弱类型】基础知识、php弱相等、报错绕过
Reptile exercise 02