8-second principle: as a webmaster, you need to know that if your website cannot be opened within 8 seconds after you click it, the customer will close it and find another similar website. The main reason for slow website opening speed is that too many images are used on the webpage, which seriously affects the loading speed of the website, such as website navigation, sidebar, webpage background image, and advertisement image.
8-second principle: as a webmaster, you need to know that if your website cannot be opened within 8 seconds after you click it, the customer will close it and find another similar website.
The main reasons for slow website access speed are:
- When the website is a dynamic website developed in PHP, asp, asp.net, jave, jsp, and other languages, the website does not generate static pages or implement pseudo static pages.
- The webpage adopts the webpage layout of table or div + table. the code writing is not standard, and there are too many repeated codes in the code writing. the code should be refined and written in line with international WEB development standards, we recommend that you use the div + CSS webpage layout to create webpages that comply with W3C standards.
- The webpage uses too many images, which seriously affects the loading speed of the website, such as website navigation, sidebar, webpage background image, and advertisement image.
- There are too many dynamic scripts on the webpage and the writing is not standard, such as javascript, too many online customer service, current time code and weather code.
- Because of the special industry, customers cannot make fancy websites or make rough cut images. Therefore, the size of the rough Web pages may be large, this will also seriously affect the open speed.
- For website videos, you can place your videos on the video server or transfer them through a large video website. For example, upload the content to Youku and Sina podcasts first, and then reference the URL to the website code. do not place it on your own web server.
- Select a high-quality server to ensure the speed and stability of website opening. we recommend that you maintain the best response speed within 15 seconds after PING.
There are many reasons for slow website access. We can use some common commands to preliminarily detect the cause of slow down:
Ping command:
It is used to check whether the connection between your local computer and the server is normal. based on the returned time, we can preliminarily determine whether the communication between your network and the server is smooth. the smaller the time value, the better, if the time value is a little higher or lower, it is generally because your current bandwidth is not in good condition. if the value is large, we need to use the tracert command in the second step. next we will talk about the tracert command. This command can also view the IP address that a domain name directs.
Ping the domain name or IP address. Operation Procedure: click "Start"-"run"-enter CMD-OK and enter the ping command under the DOS character, for example, ping 220.181.107.31 or www.nowamagic.net.
Tracert command:
Checks the address and time of all gateways that send data packets to the remote server on your local computer. With this command, we can check the access speed of the server because the Gateway speed is slow.
Operation Procedure: click "Start"-"run"-enter CMD-OK and enter the Tracert command under the DOS character, for example, Tracert 220.181.107.31 or Tracert www.nowamagic.net.
After using this command, we can check which IP address has a very high time value. we can query the gateway IP address of this IP address, and enter this IP address on www.ip138.com. In this way, we can know why access is slow.
Maybe you will ask, why does my website access speed not slow? Because the Gateway used to access each website is not necessarily the same gateway server.
Reasons for server in the IDC
At present, China mainly has telecom data centers, Netcom data centers, and dual-line data centers. When users and websites are in different CIDR blocks, such as servers in China Telecom, access using China Netcom will be slow.
Low hardware configuration, low server space, and insufficient bandwidth affect the speed of the server. Or if the bandwidth is enough, but the speed is too slow. If the egress bandwidth of the two-line data center is insufficient, the access to the China Telecom network is not satisfactory.
Server maintenance or updates may also lead to slow website access, usually at around 2 o'clock in the evening.
Network device problems
- If the network cable is not created according to the correct standard (T586A and T586B), there is a great risk. Performance:
One case is that the network speed is slow at the beginning, and the other case is that the network speed is normal at the beginning, but after a period of time, the network speed slows down. The latter case is very obvious on a desktop computer, but the network speed is normal when you use a laptop to check. After years of practice, I have found that the slow speed caused by incorrect network cables is also related to the quality of the network adapter. Generally, the NIC of a desktop computer is inferior to that of a laptop, using a laptop to check that the network speed is normal does not eliminate the problem that the network cable is not created in accordance with the standard. We now require that all network cables be squashed according to T586A and T586B standards. during fault detection, we cannot use laptops instead of desktop computers.
- Broadcast storms caused by hardware faults on network devices lead to slow network speeds
As the main means to discover unknown devices, broadcast plays a very important role in the network. However, as the number of computers in the network increases, the number of broadcast packets increases dramatically. When the number of broadcast packets reaches 30%, the network transmission efficiency will be significantly reduced. When the network adapter or network device is damaged, it will send broadcast packets continuously, resulting in broadcast storms and network communication paralysis. Therefore, when the hardware of the network device fails, the network speed may also slow down. If such a fault is suspected, replace the hub or switch with the replacement method to eliminate the fault of the collector line equipment. If these devices are not faulty, after the power of the hub or switch is turned off, run the "Ping" command in DOS to test the involved computers one by one and find the computers with the faulty Nic, the network speed can be restored after a new Nic is changed. NICs, hubs, and switches are the most vulnerable devices to slow network speeds.
- A loop in the network causes the network speed to slow down
This phenomenon rarely occurs when the number of nodes involved in the network is not large and the structure is not complex. However, in some complex networks, there are often redundant backup lines. a loop may be formed when a connection is accidentally established. For example, the network cable is connected from the network center to the computer room, and then from the computer room to the computer room. At the same time, a backup line is directly connected from the network center to the second room of the computer. if these lines are connected at the same time, a loop is formed, and data packets are continuously sent and verified, thus affecting the overall network speed. It is difficult to search for this situation. In order to avoid this situation, we must develop a good habit when laying the network cable: the network cable is marked with an obvious label, where there is a backup line should be well documented. When such a fault is suspected, the partitioning and segmentation method is generally used.
- A port in the network forms a bottleneck, leading to slow speed.
In fact, the WAN port and LAN port of the router, the switch port, the hub port, and the server NIC may all become network bottlenecks. When the network speed slows down, we can use the network management software to view the data traffic of routers, switches, and server ports during peak hours. we can also use the Netstat command to count the data traffic of each port. Based on this, identify the network data flow bottleneck and try to increase its bandwidth. There are many specific methods, such as replacing the server NIC with 1000 M or M, installing multiple NICs, dividing multiple VLANs, and changing the vro configuration to increase bandwidth, which can effectively alleviate network bottlenecks, it can increase the data transmission speed to the maximum extent.
- The website to be accessed is too heavy, the bandwidth is too narrow, the local network speed is too slow, and Internet access is shared across multiple computers, or when there are a large number of Internet users downloading, the speed of opening the webpage is slow.
Impact of website programs on access speed
- Programs using SQL databases are faster than those using ACCESS, and websites developed using cache or other acceleration technologies are much faster than traditional websites.
- Try to use static HTML pages
As we all know, ASP, PHP, JSP and other programs realize dynamic interaction of web page information, which is indeed very convenient to run, because their data interaction is good, you can easily access and change the database content to make the website "dynamic", such as forums and message boards. However, such programs must first be processed by the server, generate HTML pages, and then "send" them to the client, which consumes a certain amount of server resources. If you use too many such programs on the VM, the webpage display speed will be slow, so it is not necessary. please try to use static HTML pages.
- Change ASP, ASPX, PHP, and other files to js references.
This should be noted in programming such as ASP, ASPX, and PHP. if you want to embed dynamic data in static HTML pages, if these dynamic data is provided by ASP, PHP, and other programs, it will be referenced using the following statement: In this way, every time someone visits your website, the server will execute and process tongji once. asp files, extract the corresponding data from the database, and then output the data to the web page. if tens of thousands of people access the data at the same time, tens of thousands of times are required. We recommend that you dynamically generate data into a 1. js file in these programs, and then click