As program developers, they all dream of building a stable and Scalable Application one day. When we see "Building a high-performance web site", we feel that this book can help us to reach this goal: it is very practical, from all aspects of the website, from Network, server software, scripting language, cache, Server Load balancer, database optimization, file sharing, and performance monitoring, developers who do not actually experience these scenarios can gain such experience and increase their knowledge.
What are you waiting?
First, let's take a look at what we are waiting for from entering a URL to rendering the page to our eyes?
Entering a URL is not just a page request, but also a request for images, styles, scripts, and other files. Each request will go through the same process:Data is transmitted over the network (transmitted and transmitted), the server processes the returned data for the request, and locally renders the returned data.Although these requests are concurrent, a complete process of a Web page always depends on the final processed request.
How to do
If you are a website architect, what can you do in these three aspects ??
Can you allow users to all be in the China Telecom or China Unicom network? Can you allow 10 m and 20 m access to all users ?? Obviously, no, but we canDifferent servers are deployed in China Telecom and China Unicom networks and different regions.So that users in different networks and regions can achieve optimal access.Let our servers access through higher bandwidthTo reduce the access time of our data segment;Streamline page content and necessary compression for pages, text, images, and other data,It will also reduce the transmission time of the network, but compression such as gzip will increase the processing time at both ends, which should be selected based on the actual situation.
Besides, local rendering of returned data has a lot to do with the configuration of the user's computer, the version of the browser used, and the mechanism of the browser itself, however, this is beyond our control, but we can optimize it from the following aspects:Reduce page HTTP requestsBy merging images, styles, JS, and browser cache, the browser processing pressure is reduced. Fewer requests can reduce server pressure and network transmission time;Streamline page contentRemove unnecessary content, such as viewstate in. Net, which not only reduces transmitted data, but also facilitates page loading.
Another optimization is the server's processing of requests. This is where we can make a big difference.
It can be roughly divided into the following parts:
Server ConfigurationMainly hardware configuration determines the computing speed of the server;
Operating System and server softwareMay vary with application requirements;
Application optimization,CacheIt cannot be said: data cache, dynamic content cache, static page, cache sharing when multiple servers, distributed cache when multiple cache servers;
Database or other unstructured data, Storage engines, indexes, and so on. Database splitting, synchronization, and read/write splitting allow us to increase database support for larger business volumes;
Separation of page partsThe resources are divided into different servers, database servers, image servers, file servers, cache servers, etc. When more requests are distributed,Server Load balancerIt is a more important issue;
There isProgram detailsThis requires a full understanding of the language or platform, and excellent program design and efficient code are also an important factor.
In addition
It is impossible for a website to support all situations. We may have different concerns at different stages, any of the above factors may be the most important factor restricting the website performance for a certain period of time. The system in the mind or on the drawing is not a good system, only a well-tested system is a good system. Therefore, what is more important for websites isScalabilityWe should consider the next step and make necessary preparations for future expansion in our mind and in our real system.
Reduce visual waitsThis is an interesting technique. In a mature system, making the system process faster than 2 seconds can be said to be costly or impossible at this stage, however, a good interaction makes it easier for users to wait for a second while waiting, which is a good message for the system. But at the same time, how to design a good interaction and use user preferences and Human Nature (haha, a little far away) may be a more advanced learning, it may be more difficult than studying computers or programs.
It is recommended that programmers who want to be generals read this book.