10 tips for improving web development performance

Source: Internet
Author: User
Tags session id

With the rapid development of the network, the continuous improvement of network performance becomes the key to be able to stand out in the app. A highly connected world means that users have more stringent requirements for the Web experience. If your site doesn't respond quickly, or your app is delayed, users will soon be able to empathize with your competitors. The following is a summary of 10 of the experience of performance improvement, for reference:

1. Use a reverse proxy server (Reverse proxies) to accelerate and protect your applications

Its role is mainly in the following three aspects:

    • Load Balancing – The load balancer running on the reverse proxy server balances the transfer between different servers. Through it, you can make non-differentiated server additions.
    • Save static files – for a direct file request, a sample file or code file can be stored directly on the reverse proxy server and then sent directly to the user, allowing quick access and offloading the application server to make the program performance improved.
    • Security-The reverse proxy server can be configured with high security and identify and monitor threats.
2. Add a Load Balancer

Adding a Load balancer to your site is a relatively simple change, but it can bring a good performance and security boost. The purpose of the load balancer is to transfer distribution between different servers.

The load balancer is implemented on the premise that there is a reverse proxy server that sends related requests to other servers after receiving Internet traffic. The beauty of a balancer is that it supports two or more application servers and uses a selection algorithm to split requests between servers.

3. Caching static and dynamic content

The use of caching technology enables content to be presented to users more quickly, with the processing strategy of processing content faster when demand is being sent, storing content on a faster device, or bringing content closer to the user.

4. Data compression

Compression technology is a huge potential performance accelerator. Its main role is reflected in the image, video or audio files, can be efficient compression processing.

5. Optimizing SSL/TLS Access

Although SSL/TLS is becoming more and more popular, its impact on performance should also be taken seriously. Its impact on performance is mainly reflected in two aspects:

    • The initial handshake is unavoidable whenever a new connection is opened, which means that the browser needs to use http/1.x to establish a server connection every time.
    • The encrypted data stored on the server becomes larger, and is decoded when the user reads it after being encrypted.

So how do you deal with it?

    • Session caching-use Ssl_session_cache to directly cache parameters that establish a new SSL/TLS connection
    • Session ID-Stores the identity of the specified SSL/TLS/id, but when a new connection is made, it can be taken directly, eliminating the hassle of re-establishing the communication.
    • OCSP stapling optimization-Reduce the time to establish communications by crawling SSL/TLS authentication information.
6. Deploy HTTP/2 or Spdy

For websites that already have SSL/TLS enabled, the combination of HTTP/2 and Spdy will enable a powerful combination of performance, because the result is that a single connection is created with only one communication handshake. The main feature of Spdy and HTTP/2 is that they use a single connection rather than a multiparty connection.

7. Update software version 8 regularly. Optimizing Linux Performance

For example, the following configuration or processing of Linux:

Backlog queue

If you have some connections that will be deactivated, consider adding net.core.somaxconn.

File descriptor

Nginx allows a maximum of two file descriptors per connection. If your system serves multiple connections, you may want to consider increasing the value of Sys.fs.file_max.

Instantaneous port

When used as a proxy, Nginx creates a temporary instantaneous (ephemeral) port for each upstream server. You can therefore try increasing the value of the net.ipv4.ip_local_port_range to increase the number of available ports.

9. Optimize Web server performance

Access Log Optimization

In Nginx, the Buffer=size parameter is added to the Access_log to realize the cache writing of the log, and the addition of Flush=time allows the content to be written after a certain time interval.

Cache

Enabling caching can make the connection more responsive.

Client Active Connection

Active connections can reduce the number of reconnection times, especially if SSL/TLS is enabled.

Upstream Active connection

A upstream connection is a connection to a program server, a database server, and so on.

Restricting access to resources

Adopting appropriate policies to limit access to resources can improve performance and security.

Perform worker processing

The worker processing mode is the request-driven processing mode. Nginx uses an event-based model and an OS dependency mechanism to efficiently distribute requests.

To perform a socket sub-table

The socket table creates a socket listener for each worker process and, when the core delegation connects to the listener, immediately knows which processing is about to be executed, thus simplifying the processing process.

Thread pool Processing

Any computer thread can be suspended due to a single slow operation. For Web server software, disk access is a performance bottleneck, such as data replication operations. When using a thread pool for processing, it is possible to put some slow-response actions into a task group alone, thus not affecting other operations.

10. Real-time monitoring to quickly solve problems and bottlenecks

Implementation of real-time monitoring, you can fully grasp the operation of the system, to identify problems to solve problems, or even to identify the cause of performance bottlenecks or slow operation.

For example, the following issues can be monitored:

    • Server outage
    • Connection access is missing
    • Server Cache loss Critical
    • The server sent the wrong data

Learn the front-end students

Welcome to join the front-end learning Exchange QQ Group: 461593224

10 tips for improving web development performance

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.