In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1. Configuration file for apache (the path may be different, but the file name should not change): / etc/httpd/conf/httpd.conf
two。 The executable file is at: / usr/sbin
3. Command for starting apache service: service httpd start (status stop restart)
4. Tuning of apache: vi / etc/httpd/conf/httpd.conf
First, the tuning of the working mode
-you can view the current mode through httpd-l
Prefork mode: use multiple child processes, each with only one thread, which is efficient, and each request is independent of each other. If there is a problem with one request, it will not affect other requests, but it takes up a lot of memory.
MaxClients: if you need to set this parameter, set ServerLimit first. The size of the two can be the same, but cannot exceed ServerLimit.
Worker mode: use multiple child processes, each with multiple threads, which takes up a small amount of memory and is suitable for high-traffic http servers, but if one thread crashes, the whole process will die together.
Internet enterprises generally have high traffic and high concurrency, so they should consider using this model because it is multithreaded. As for the disadvantages, technical means such as load balancing can be used to reduce them as much as possible.
ThreadsPerChild: if you need to set this parameter, set ThreadLimit first. The size of the two can be the same, but cannot exceed ThreadLimit.
Second, the tuning of key parameters
Timeout: specifies the timeout of apache (in seconds). If this time is exceeded, apache abandons the request and releases the connection. The default value of this parameter is 120. it is recommended to set it to 60. It can be set to 30 or 15 for heavily visited websites.
KeepAlive: on servers with plenty of memory, there will be no significant change in server performance regardless of whether this function is turned off or not; if the server has less memory or mainly deals with dynamic web services, turning it off can save a lot of memory; it is recommended to turn on static services.
Expiration time: make full use of the cache (here refers to the client cache, which can be understood as the browser's cache) Expires header information is an important basis for client cache. If the current time is less than the time specified by Expires, the browser will directly obtain the relevant data information or HTML file from the cache. Otherwise, the browser will send a request to the server to obtain it.
Remove the # in front of LoadModule expires_module modules/mod_expires.so
Once the settings are completed, save and restart apache will take effect.
Enable gzip: compress all text resources transferred by Internet, such as html, css, js, for example, when transferring large files using QQ, the transfer speed after compression is significantly faster than that before compression.
Get rid of the following two front #
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
Compression level, do not set too high, otherwise it will take up too much cpu.
Once the settings are completed, save and restart apache will take effect.
If you want to verify, you can use tools such as Firebug or F12 to view the request and response. If the request header contains Accept-Encoding:gzip,deflate,sdch, it indicates the compression format supported by the current request. If the response header contains Content-Encoding:gzip, the response content has been compressed by gzip.
HostnameLookups: set to off to minimize the number of DNS queries
5. What are the aspects of apache tuning
Hardware (such as memory footprint based on operating mode)
Working mode
Parameters.
Deployment method (for example, apache and tomcat load balancing, or apache with other)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.