In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the methods and solutions of slow website access. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
When a website is slow, several reasons should be reflected in our mind:
1. Program code execution aspect
two。 A large number of database operations
3. Domain name DNS resolution problem
4. Server environment
That's how I solved it, so let's talk about the steps in the solution.
1. Open the slow access to the website to observe the situation, through Firefox's fixfox plug-in or IE element view tool, the information loaded in your site will be displayed at a glance, and how many seconds it takes for those elements to load, how to solve the problem, download the remote time-consuming js locally, or delete it directly.
two。 I looked at the next page where there are many places to connect database operations, and there are remote database operations, and there are extra database connection code, needless to say, change it.
After solving the problem, I found that it was indeed faster, but it was still not ideal, so I put the page execution database code into the database without slow execution.
3. The situation about the domain name DNS is just one of them. Don't rush to find the domain name vendor. You can write a page without data operation and put it under the domain name of the same server to see if the access is as slow as it is. If it is possible, you should also let the people around you take a look. It is better not to be someone from the same company.
4. Let me take a look at the server, whether it is caused by the high utilization rate of CPU.
A. Top found that the use of cpu is not high, about 30%, but found a problem, the number of sleeping processes is relatively large. Damn, it's better not to be a zombie process. There aren't many such things these days.
b. Check the number of timewait: found that there are mysqld and httpd, mostly from httpd; command netstat-ae | grep TIME_WAIT
How to solve the quantity problem of timewait?
TIME_WAIT solution:
Vi / etc/sysctl.conf
Edit the file and add the following:
Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 30
Net.ipv4.tcp_keepalive_time = 30 time to stay connected
Net.ipv4.tcp_max_tw_buckets = 100. this is the number of time_wait that the server keeps at the same time.
Then execute / sbin/sysctl-p to make the parameter take effect.
Set up the configuration file for APACHE:
The timeout of Timeout 10's connection to the client
KeepAlive On can transmit multiple times at a time, so that multiple HTTP requests can be passed in a single connection.
MaxKeepAliveRequests 50 sets how many requests can be made within a connection
KeepAliveTimeout 15 if the server has completed a request, how long will it disconnect if it hasn't received the next request?
Save restart APACHE
After setting up the previous operation:
Netstat-n | awk'/ ^ tcp/ {+ + S [$NF]} END {for (i in S) print iMagne S [I]}'
You will find it very successful.
If you are not satisfied, you can set the Ulimit parameter again.
Cat > > / etc/security/limits.conf
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.