当前位置:网站首页>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)边栏推荐
- Leetcode simple problem delete an element to strictly increment the array
- Integration of Android high-frequency interview questions (including reference answers)
- 2022 registration of G2 utility boiler stoker examination and G2 utility boiler stoker reexamination examination
- The reason why the entity class in the database is changed into hump naming
- The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
- 一名外包仔的2022年中总结
- [luatos sensor] 1 light sensing bh1750
- 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
- Leetcode simple question: check whether two string arrays are equal
猜你喜欢

有道云笔记

How to retrieve the password for opening word files

Php+mysql registration landing page development complete code

Library management system based on SSM

Web - Information Collection

Bugku CTF daily question baby_ flag. txt

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

Asp access teaching management system design finished product

JVM原理简介
![[USACO 2009 Dec S]Music Notes](/img/e6/282a8820becdd24d63dcff1b81fcaf.jpg)
[USACO 2009 Dec S]Music Notes
随机推荐
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
一名外包仔的2022年中总结
[free completion] development of course guidance platform (source code +lunwen)
Hj35 serpentine matrix
Two drawing interfaces - 1 Matlab style interface
Kubernetes源码分析(一)
Number of 1 in binary (simple difficulty)
2022 registration of G2 utility boiler stoker examination and G2 utility boiler stoker reexamination examination
Kingbasees plug-in KDB of Jincang database_ database_ link
The reason why the entity class in the database is changed into hump naming
data2vec! New milestone of unified mode
Matplotlib -- save graph
The least operation of leetcode simple problem makes the array increment
[set theory] binary relationship (definition field | value field | inverse operation | inverse synthesis operation | restriction | image | single root | single value | nature of synthesis operation)
Library management system based on SSM
Use the benchmarksql tool to perform a data prompt on kingbases. The jdbc driver cannot be found
AWS VPC
[SQL injection] joint query (the simplest injection method)
Web security - CSRF (token)
智能合约安全审计公司选型分析和审计报告资源下载---国内篇


