Comprehensive Optimization of v4.0 and Ajax tag usage skills

Source: Internet
Author: User

As we all know. Kesioncms v4.0 has a qualitative overflight in terms of both functionality and performance. It is no longer the previous version. Only one article can be generated in 1 second. Article . However, it has recently been found that some users mentioned that the speed has not improved much. Now I will give you a general summary.

1. The tag call is unreasonable.

A. Custom static tags (most influential)

Some users use a large number of custom static tags for convenience. The entire page template is even called as a static tag. What's even worse is that a large number of system function labels and custom SQL labels are inserted into custom static labels.

After testing, if the system function tag and custom SQL tag are inserted in the Custom static tag, the system generation speed will be greatly reduced. the reason is as follows: Originally, you only need to read the database for one-time tag replacement, but with the help of custom static tags, the tag replacement work needs to be performed at least twice. Therefore, the performance is reduced.

After the above analysis: the solution is to use as few static labels as possible or not use custom static labels. The system function tag and custom SQL tag are definitely not inserted into the custom static tag.

B. Custom SQL labels

Anyone who has used custom SQL labels knows that an SQL tag corresponds to an SQL query statement. Whether the SQL structure is reasonable directly affects the system performance.

Example:

Statement 1: Select * From ks_article where TID in ('column id') order by ID DESC

Statement 2: Select top 10 ID, title, adddate from ks_article where tid = 'column id' order by ID DESC

Assume that the loop body is as follows:

CopyCode The Code is as follows: [loop = 10]
<Li>
<Ahref = "{$ field (ID, getinfourl, 1,1)}" target = "_ blank"> {$ field (title, text, 5 ,..., 0,) }</A> ({$ field (adddate, date, yyyy, mm, DD )})
</LI>
[/Loop]

In the above Code segment. Obviously, the final results are the same, but Statement 2 is more efficient than Statement 1. The more data you have, the more obvious it is. Here is not detailed description of the reason, interested friends can refer to: http://www.cnblogs.com/xhp5678/archive/2006/07/07/445206.html, http://www.cnblogs.com/oec2003/archive/2007/05/09/740048.html
C. System Function labels

Kesioncms system function labels serve as entry-level labels, and all codes are integrated into core code functions. A lot of optimization work has been done on the statement. In principle, users do not need to pay attention to any issues during use. However, if you pay attention to it, you will find that many tags support general purpose. Careful friends will find that there are "current column (general)" and "unspecified columns" in the "All columns" column of the label attribute. In this case, if you specify the current topic (general), the tag you created will be a general label in this model. In this way, you do not need to create a large number of labels. Reduce the number of database tag replacements from the page ..
2. unreasonable column Division
Some user columns are very unreasonably divided. The number of articles in a column actually reaches tens of thousands of data records. If there are many articles under the topic, we recommend that you segment the topic. V4.0 introduces a model. You can also use a self-built model to distribute data to user-created data tables. This effectively reduces the pressure on a single data table.

3. The database is not regularly maintained.

Users who use the ACCESS database should compress and fix the database regularly. SQL database users can regularly clear logs and compress the database. regular database maintenance can also improve the system performance.

When is the tag Output Using ajax?

Kesioncms v4.0 introduced the tag Ajax output function, but some users do not understand this, do not know friends can understand http://tech.163.com/05/0908/17/1T55SUPP00091K8Q.html

1. End-Level list tags (paging tags)

When the website's topic information cannot be collected by others, AJAX can be used for output.

When your topic contains more than 1000 articles, consider Ajax output. The reason is as follows: Suppose you have 20 entries per page. Each time this topic page is generated, 1000/20 = 50 static pages are generated at the same time. If there are 20 columns and all are generated, 50*20 = 1000 static pages will be generated at the same time in an instant. In this case, the resources occupied by the server will increase dramatically, resulting in a slow release of column pages. For Ajax output, each topic generates a static page regardless of the number of articles. In fact, Ajax is not dynamically called. When you use ajax to output new content, you do not even need to generate a column page in the background because it will be dynamically updated.

2. Call the latest updates, click rankings, and recommendation information

After a static page has been generated for your content page, have you ever been troubled by the fact that you cannot automatically update click rankings on the Content Page, update the latest articles, or update the recommendation information automatically? Kesioncms v4.0 introduces Ajax output, which completely solves this problem. You only need to select Ajax as the tag output format.

Related Article

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.