As we all know. KesionCMS V4.0 has a qualitative overpass in both function and performance. It is no longer a system that can only generate 1 article in one second in the previous version. However, recently, it has been found that some users have mentioned that the speed has not improved much. Now I will give you a summary.
1. The tag call is unreasonable
A. Customize static labels (maximum impact)
For convenience, some users use a lot of custom static tags. Even make the entire page template into a static tag call. What's even more terrifying is that you insert a large number of system function tags, custom SQL tags, etc. into custom static tags.
After testing, if the system function tag and custom SQL tag are inserted into the custom static tag, the system generation speed will be greatly reduced. The reason is as follows: originally, the database only needs to be read to perform the tag replacement work once, but with the help of custom static tags, it invisibly requires at least two tag replacement work. So the performance is degraded.
After the above analysis, the solution is to use as little as possible or not to use custom static tags. You absolutely do not insert system function tags and custom SQL tags into custom static tags.
B. Custom SQL tags
Friends who have used custom SQL tags know that a SQL tag corresponds to an SQL query statement. Whether the SQL is constructed reasonably directly affects the performance of the system.
As an 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
And assume that the loop body is as follows:
[loop=10]
<li>
<ahref="{$Field(ID,GetInfoUrl,1,1)}" target="_blank">{$Field(Title,Text,5,...,0,)}</a>({$Field(Adddate,Date,YYYYY MM month DD date)})
</li>
[/loop]
In the above code segment. Obviously, the final results of the operation are the same, but the execution efficiency of statement 2 will be better than statement 1. The more data you have, the more obvious it is. I won't explain the reason in detail here. Interested friends can refer to: /xhp5678/archive/2006/07/07/, /oec2003/archive/2007/05/09/
C. System function tags
KesionCMS system function tags are used as entry-level tags, and all codes are integrated into the functions of the core code. A lot of optimization work has been done on the statement. In principle, users don’t need to pay attention to anything when using it. But if you pay a little attention, you will find that many tags support universality. Careful friends will find that in the "Column of the Nature" column in the tag attributes, there are "current column (general)" and "not specified columns", etc. If you specify it as the current column (generic), then the tag you created will be a general tag in this model. In this way, you don't need to build a lot of tags. Reduce the number of tag replacements of the database from the page.
2. Unreasonable column division
Some user column divisions are extremely unreasonable, and the articles under one column actually reach tens of thousands of data. For many articles under the column, it is recommended to subdivide the column. V4.0 has introduced models, and data can also be distributed to user-built data tables through self-built models. This effectively reduces the pressure on a single data table.
3. No regular maintenance of the database
Users who use Access databases should regularly compress and repair the database. Users of SQL databases can regularly clear logs, compress, etc. Maintaining the database regularly can also find that the performance of the system will improve.
When to use Ajax output for tags
KesionCMS V4.0 introduces the tag ajax output function, but some users do not understand this. Friends who are not clear about it can learn about it here http://tech./05/0908/17/
1. Final-level list label (pagination label)
When the column information of the website is not allowed to be collected by others, you can use ajax to output it.
When there are more than 1,000 articles in your column, you can consider ajax output. The reason is as follows: Suppose you display 20 articles per page. Then every time you generate this column page, you need to generate 1000/20=50 static pages at the same time. If there are 20 columns and all of them are generated, 50*20=1000 static pages will be generated at the same time in an instant. At this time, the server's resource occupancy will increase dramatically, resulting in a slow release of the column page. If it is ajax output, each column will generate a static page regardless of the number of articles. In fact, ajax is called dynamically without refresh. When you output with AJAX, you add new content in the background, and you don't even need to generate the column page again, because it will update dynamically.
2. Latest updates, click rankings, recommended information and other calls
When your content page has generated a static page, have you ever been worried that the content page cannot automatically update the click ranking, cannot automatically update the latest added articles, and cannot automatically update the recommended information? KesionCMS V4.0 introduces ajax output, which completely solves this problem. You just need to select ajax to the label output format.
1. The tag call is unreasonable
A. Customize static labels (maximum impact)
For convenience, some users use a lot of custom static tags. Even make the entire page template into a static tag call. What's even more terrifying is that you insert a large number of system function tags, custom SQL tags, etc. into custom static tags.
After testing, if the system function tag and custom SQL tag are inserted into the custom static tag, the system generation speed will be greatly reduced. The reason is as follows: originally, the database only needs to be read to perform the tag replacement work once, but with the help of custom static tags, it invisibly requires at least two tag replacement work. So the performance is degraded.
After the above analysis, the solution is to use as little as possible or not to use custom static tags. You absolutely do not insert system function tags and custom SQL tags into custom static tags.
B. Custom SQL tags
Friends who have used custom SQL tags know that a SQL tag corresponds to an SQL query statement. Whether the SQL is constructed reasonably directly affects the performance of the system.
As an 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
And assume that the loop body is as follows:
Copy the codeThe code is as follows:
[loop=10]
<li>
<ahref="{$Field(ID,GetInfoUrl,1,1)}" target="_blank">{$Field(Title,Text,5,...,0,)}</a>({$Field(Adddate,Date,YYYYY MM month DD date)})
</li>
[/loop]
In the above code segment. Obviously, the final results of the operation are the same, but the execution efficiency of statement 2 will be better than statement 1. The more data you have, the more obvious it is. I won't explain the reason in detail here. Interested friends can refer to: /xhp5678/archive/2006/07/07/, /oec2003/archive/2007/05/09/
C. System function tags
KesionCMS system function tags are used as entry-level tags, and all codes are integrated into the functions of the core code. A lot of optimization work has been done on the statement. In principle, users don’t need to pay attention to anything when using it. But if you pay a little attention, you will find that many tags support universality. Careful friends will find that in the "Column of the Nature" column in the tag attributes, there are "current column (general)" and "not specified columns", etc. If you specify it as the current column (generic), then the tag you created will be a general tag in this model. In this way, you don't need to build a lot of tags. Reduce the number of tag replacements of the database from the page.
2. Unreasonable column division
Some user column divisions are extremely unreasonable, and the articles under one column actually reach tens of thousands of data. For many articles under the column, it is recommended to subdivide the column. V4.0 has introduced models, and data can also be distributed to user-built data tables through self-built models. This effectively reduces the pressure on a single data table.
3. No regular maintenance of the database
Users who use Access databases should regularly compress and repair the database. Users of SQL databases can regularly clear logs, compress, etc. Maintaining the database regularly can also find that the performance of the system will improve.
When to use Ajax output for tags
KesionCMS V4.0 introduces the tag ajax output function, but some users do not understand this. Friends who are not clear about it can learn about it here http://tech./05/0908/17/
1. Final-level list label (pagination label)
When the column information of the website is not allowed to be collected by others, you can use ajax to output it.
When there are more than 1,000 articles in your column, you can consider ajax output. The reason is as follows: Suppose you display 20 articles per page. Then every time you generate this column page, you need to generate 1000/20=50 static pages at the same time. If there are 20 columns and all of them are generated, 50*20=1000 static pages will be generated at the same time in an instant. At this time, the server's resource occupancy will increase dramatically, resulting in a slow release of the column page. If it is ajax output, each column will generate a static page regardless of the number of articles. In fact, ajax is called dynamically without refresh. When you output with AJAX, you add new content in the background, and you don't even need to generate the column page again, because it will update dynamically.
2. Latest updates, click rankings, recommended information and other calls
When your content page has generated a static page, have you ever been worried that the content page cannot automatically update the click ranking, cannot automatically update the latest added articles, and cannot automatically update the recommended information? KesionCMS V4.0 introduces ajax output, which completely solves this problem. You just need to select ajax to the label output format.