当前位置:网站首页>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)边栏推荐
- [XSS bypass - protection strategy] understand the protection strategy and better bypass
- 金仓数据库KingbaseES 插件kdb_database_link
- Use the benchmarksql tool to perform a data prompt on kingbases. The jdbc driver cannot be found
- Preliminary cognition of C language pointer
- arthas watch 抓取入参的某个字段/属性
- UiPath实战(08) - 选取器(Selector)
- Arthas watch grabs a field / attribute of the input parameter
- 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
- Pyqt control part (II)
- 金仓KFS数据双向同步场景部署
猜你喜欢

智能合约安全审计公司选型分析和审计报告资源下载---国内篇

使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver

2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical

C language self-made Games: Sanzi (tic tac toe chess) intelligent chess supplement

【工具跑SQL盲注】

2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
![[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa](/img/a9/92059db74ccde03b84c69dfce35b37.jpg)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa

Joint search set: the number of points in connected blocks (the number of points in a set)

How to choose cross-border e-commerce multi merchant system

Human resource management system based on JSP
随机推荐
【XSS绕过-防护策略】理解防护策略,更好的绕过
SSM based campus part-time platform for College Students
Prefix and (continuously updated)
跨境电商多商户系统怎么选
[PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
P35-P41 fourth_ context
会员积分商城系统的功能介绍
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
[XSS bypass - protection strategy] understand the protection strategy and better bypass
一名外包仔的2022年中总结
Leetcode simple question: the key with the longest key duration
FuncS sh file not found when using the benchmarksql tool to test kingbases
The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found
Kingbasees plug-in KDB of Jincang database_ exists_ expand
Introduction to JVM principle
How to retrieve the password for opening word files
I stepped on a foundation pit today
移动端——uniapp开发记录(公共请求request封装)
[set theory] binary relationship (special relationship type | empty relationship | identity relationship | global relationship | divisive relationship | size relationship)


