Table of Contents
如何设置apache的并发数量
您可能感兴趣的文章
Home php教程 php手册 如何设置apache的并发数量

如何设置apache的并发数量

Jun 13, 2016 am 09:05 AM
apache

如何设置apache的并发数量

网站反应慢不一定是程序或数据库的问题,apache并发数量设置有问题的话同样会导致当网站访问量过大的时候出现请求特别慢或失败的问题,那么该如何设置apache的并发数量呢?

1、在httpd.conf文件中修改

#Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

将上面一句的#注释去掉

2、确定当前的apache是什么MPM模式(winnt模式,perfork模式,worker模式)

进入到apache/bin目录

cmd命令:httpd.exe -1

说明:看mpm_xxx.c 如果xxx是winnt  说明是winnt,另外还可能是perfork或者worker

3、修改httpd-mpm.conf文件

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves

ThreadsPerChild      150  //修改这个值即可
MaxRequestsPerChild    0

4、重启apache,测试看看

在Linux下,一般采用的MPM是perfork模式

StartServers          5        //预先起5个进程
MinSpareServers       5       //最小空闲进程
MaxSpareServers      10      //最大空闲进程
MaxClients          150      //并发连接数
MaxRequestsPerChild   0      //指一个进程里可以起多少个线程,对worker更好,0为不限制

给大家一个合理的建议配置,对在部分网站,中型网站,配置:


StartServers          5        //预先起5个进程
MinSpareServers       5       //最小空闲进程
MaxSpareServers      10      //最大空闲进程
ServerLimit          1500     // 用于修改apache编程参数
MaxClients          1000      //并发连接数
MaxRequestsPerChild   0      //指一个进程里可以起多少个线程,对worker更好,0为不限制

如果你的网站pv值百万,可以这样设置:

ServerLimit          2500     // 用于修改apache编程参数
MaxClients          2000      //并发连接数

您可能感兴趣的文章

  • 如何设置phpmyadmin自动登陆和取消自动登录
  • php解析url (parse_url) 参数成数组 (parse_str)
  • 如何设置DIV层显示在flash对象之上,兼容ie和firefox等浏览器
  • php计算当前是一年或一月中第几周的函数
  • jquery设置按钮不可点击防止重复提交数据
  • mysql 队列实现高效并发读数据
  • Javascript中如何为函数设置默认参数值
  • javascript实现replaceall(全局匹配并替换)的方法
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run the h5 project How to run the h5 project Apr 06, 2025 pm 12:21 PM

Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

How to export pdf with xml How to export pdf with xml Apr 03, 2025 am 06:45 AM

There are two ways to export XML to PDF: using XSLT and using XML data binding libraries. XSLT: Create an XSLT stylesheet, specify the PDF format to convert XML data using the XSLT processor. XML Data binding library: Import XML Data binding library Create PDF Document object loading XML data export PDF files. Which method is better for PDF files depends on the requirements. XSLT provides flexibility, while the data binding library is simple to implement; for simple conversions, the data binding library is better, and for complex conversions, XSLT is more suitable.

How to generate pom.xml How to generate pom.xml Apr 03, 2025 am 06:00 AM

There are the following ways to generate a pom.xml file: Use Maven Archetype to provide predefined project templates to automatically generate pom.xml files for specific types of projects. Use the Maven Helper plugin to provide commands to generate pom.xml files. Create manually to customize the pom.xml file for the project.

How to set character encoding on the server side to solve Bootstrap Table garbled How to set character encoding on the server side to solve Bootstrap Table garbled Apr 07, 2025 pm 12:00 PM

To set character encoding on the server side to solve the garbled Bootstrap Table, you need to follow the following steps: check the server character encoding; edit the server configuration file; set the character encoding to UTF-8; save and restart the server; verify the encoding.

How to check Debian OpenSSL configuration How to check Debian OpenSSL configuration Apr 12, 2025 pm 11:57 PM

This article introduces several methods to check the OpenSSL configuration of the Debian system to help you quickly grasp the security status of the system. 1. Confirm the OpenSSL version First, verify whether OpenSSL has been installed and version information. Enter the following command in the terminal: If opensslversion is not installed, the system will prompt an error. 2. View the configuration file. The main configuration file of OpenSSL is usually located in /etc/ssl/openssl.cnf. You can use a text editor (such as nano) to view: sudonano/etc/ssl/openssl.cnf This file contains important configuration information such as key, certificate path, and encryption algorithm. 3. Utilize OPE

Cannot start mysql in xampp Cannot start mysql in xampp Apr 08, 2025 pm 03:15 PM

There are many reasons why XAMPP fails to start MySQL, including port conflicts, configuration file errors, insufficient system permissions, service dependency issues, and installation issues. The troubleshooting steps are as follows: 1) Check port conflicts; 2) Check configuration files; 3) Check system permissions; 4) Check service dependencies; 5) Reinstall MySQL. Follow these steps and you can find and resolve issues that cause MySQL startup to fail.

How to use Debian Apache logs to improve website performance How to use Debian Apache logs to improve website performance Apr 12, 2025 pm 11:36 PM

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

See all articles