Optimization suggestions on the speed of future website access and background query

Source: Internet
Author: User

1. Database design: All table structures in the database are indexed

Reason for adjustment:

Recently the database pressure is very large, check some big Data scale query speed is very slow, causing the database server CPU has been continuously 90%-100%, the table after adding indexes, the CPU quickly become normal.

2, the Big data table to do sub-Library, partition processing:

Here's how:

1), separate the Big data table from the primary database, create a separate database, and then partition the tables;

2), insert data into the message queue, background with Windows scheduled task execution (5 minutes to execute) The C # console program inserts the data in the message queue in batches (50,000 records in the message queue, inserted into the data table at once) into the corresponding data table;

Reason for adjustment:

For example: The user accesses the log, each time the user accesses a page, our previous operation is to insert the data directly into the database, so the access to the database and operation is too large, seriously affect the other data insertion, query efficiency, using the sub-Library, partition, The benefit of Message Queuing is that when a user accesses a page, it does not directly manipulate the database, but accumulates a certain amount of data in the message queue, executes the database operation only once, and has no effect on other queries and insertions because of the reason for database separation;

3, Picture site separation:

Here's how:

1), create a new level two domain name, and the two-level domain name to do CDN processing;

2), the website front desk All pictures all use this two level domain name;

Reason for adjustment:

When users visit the site, if the pictures and sites are placed in a site, will make all operations in a site, a site in the CPU process is limited, are used by the picture, will affect other users of the normal order and other operations, so the benefits of the operation can reduce the pressure of a site to divert to another site , if the conditions can also be more than a few picture sites to put on different servers (but to do the cluster operation), JS and CSS can also do such operations.

4. Data cache:

Here's how:

Some infrequently changed data, such as commodity information, product picture information, classification information in the program to do cache processing.

Reason for adjustment:

Recently found that the business database execution of the SQL sentence, the image of the information every minute to query the database more than 2000 times or more, so frequent to check the database will cause great pressure on the database, if the cache processing will not be the data query so frequently, You can configure a cache server if you have a condition (but you don't know how to do it yet)

5, CSS, JS, picture caching problems:

Here's how:

Each time the picture, CSS, JS has the adjustment after the upload overlay, the page after these files to increase the version number, for example, a picture named Test.jpg image is overwritten after this picture on the page to increase the version number: Test.jpg?v=1000,css, JS the same.

Reason for adjustment:

Because sometimes the customer in a day to frequently replace a picture, and after the replacement due to the CDN cache problem caused the picture to remain in the original state, cannot be replaced by the picture, this is to tell the CDN server this picture has changed, need CDN re-read, not read cache, When you add a version number, the image changes to the newly replaced image.

6, CSS, JS compression problem:

Here's how:

Using the program, the page all JS merged into 1 JS and compression, CSS the same.

Reason for adjustment:

The advantage of this is to reduce the number of browser parsing JS and CSS, increase the resolution speed, make the website access speed faster;

7, according to the Yahoo Military regulation of the website Access speed optimization (Yahoo military regulation see annex):

Here's how:

According to the third party website (http://gtmetrix.com) and Firefox components (Yslow) of the tips of the site is not enough to optimize one by one, and the site needs to make image delay loading.

Reason for adjustment:

LIFEVC website was not optimized before the site opened at a speed of 22.68 seconds, after optimization: 8.78 seconds;

8, order Tracking:

Orders from the generation to the end, no one step do not have a log, each state of the conversion must have a log followed, or the order once the error, do not know what the person did the operation, do not know where to check.

Reason for adjustment:

Some times there will be some unusual orders, because there is no log, so I do not know how this order has become such.

9, the interface aspect:

All the interfaces with the third party, receive and send the data to record the original file, receive what to save what.

Reason for adjustment:

During operation, if there is an error, we can directly take out the original file, with the third-party company theory, otherwise we can only Eat哑巴亏.

Optimization suggestions on the speed of future website access and background query

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.