Server Optimization-Sysctl, Apache, and MySQL-Linux Enterprise Application-Linux server application information. For more information, see the following section. It is often said that the load capacity of the server depends largely on the configuration and optimization capabilities of the system administrator. This is correct. The same hardware and different software configurations will produce very different results. The following describes how to optimize sysctrl, Apache, and MySQL. Note that all configurations depend on individual users. Make adjustments based on your actual situation.
Configure Sysctl
Edit this file:
Nano-w/etc/sysctl. conf
If the file is empty, enter the following content; otherwise, adjust the file as needed:
# Controls source route verification
# Default shoshould work for all interfaces
Net. ipv4.conf. default. rp_filter = 1
# Net. ipv4.conf. all. rp_filter = 1
# Net. ipv4.conf. lo. rp_filter = 1
# Net. ipv4.conf. eth0.rp _ filter = 1
# Disables IP source routing
# Default shoshould work for all interfaces
Net. ipv4.conf. default. accept_source_route = 0
# Net. ipv4.conf. all. accept_source_route = 0
# Net. ipv4.conf. lo. accept_source_route = 0
# Net. ipv4.conf. eth0.accept _ source_route = 0
# Controls the System Request debugging functionality of the kernel
Kernel. sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
Kernel. core_uses_pid = 1
# Increase maximum amount of memory allocated to shm
# Only uncomment if needed!
# Kernel. shmmax = 67108864
# Disable ICMP Redirect Acceptance
# Default shoshould work for all interfaces
Net. ipv4.conf. default. accept_redirects = 0
# Net. ipv4.conf. all. accept_redirects = 0
# Net. ipv4.conf. lo. accept_redirects = 0
# Net. ipv4.conf. eth0.accept _ redirects = 0
[Mysqld]
Connect_timeout = 15
Interactive_timeout = 100
Join_buffer_size = 1 M
Key_buffer = 128 M
Max_allowed_packet = 16 M
Max_connections = 500
Max_connect_errors = 10
Myisam_sort_buffer_size = 64 M
Read_buffer_size = 1 M
Read_rnd_buffer_size = 768 K
Sort_buffer_size = 1 M
Table_cache = 1024
Thread _ cache_size = 100
Thread_concurrency = 4
Wait_timeout = 300
Query_cache_size = 32 M
Query_cache_limit = 1 M
Query_cache_type = 1
Skip-innodb
Note that the above configuration applies to MB ~ MB memory. If the memory size is larger, adjust the memory size by yourself. Adding memory to the project will speed up, but using too much memory will lead to swap enabling, which will greatly lead to a reduction in system efficiency. Among them, thread_concurrency is configured. Set single CPU to 2, and dual CPU to 4.
Apache Optimization
The following optimization applies to the Apache 1.3 series. If you are using the 2.0 series, make adjustments and judgments on your own.
Confirm the location of the Apache configuration file and start editing:
Locate httpd. conf
Nano-w/path/to/httpd. conf
The httpd. conf file has a lot of content, so the author will come up with what needs to be optimized:
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 3
MinSpareServers 8
MaxSpareServers 13
MaxRequestsPerChild 50
Setting KeepAliveTimeout to a small number can reduce unnecessary waiting links on the server and increase server load to a certain extent.
In addition, the following is not optimized, but is related to Apache Security:
ServerSignature Off
ServerTokens ProductOnly
Disable ServerSignature and add ServerTokens ProductOnly to prevent normal users from detecting the actual version number of Apache, which helps Apache Security.
The above optimization will enhance the server load performance to some extent. However, please note that the best configuration is implemented.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.