Common Classification Information home page, need to read at least six times database, other subpages, five to more than 10 times.
With database connection pooling, Tomcat can support a very limited amount of concurrency. system resources are mainly consumed in two aspects:
1, database operation, frequent return of results from the database;
2, Tomcat parsing Java files.
Create a dynamic page by a certain rule. The process of HTML pure static pages is called generating static pages.
Advantages
Saves the most system consumption without having to access the database.
Tomcat directly returns. html static files without parsing Java files to maximize efficiency.
Security to avoid errors caused by illegal passing of parameters.
Disadvantages
The number of generated. HTML static pages require more hard disk space.
The interactive performance of the dynamic page has been lost.
Running a stable dynamic page is a prerequisite for generating. HTML static pages.
At first, the. HTML static page is a dynamic page that is accessed (crawled) by the system frequently. Gets the result of the run, and then saves it as an. html file. Therefore, crawl this part of the operation will be the core of the generation of static pages, and how to minimize the crawl after the resolution operation, depending on the dynamic page (example: JSP page) What rules to keep these. html static pages, how to use static pages to interact with users, and so on, are also avoided. The following points are summarized:
1. Define Rules
Most of the JSP page will no longer be the face of the user, but for system calls, to get the results of the operation, thus saving as. html file. Therefore, the JSP should replace all the. JSP tags and connections according to the rules of the core code. Replaced by. html.
2, the path
If there are too many HTML static pages, it will inevitably be stored in a different folder.
It is one of the solutions to specify an absolute path at the beginning of the root directory in all JSP pages.
3, interactive performance
Static pages inevitably lose interactive performance, such as: unable to count the number of times to read the information, unable to get session information, and so on. But it is not the solution, the idea is to separate the whole static page into a number of small pages, small pages can still be. html static page, can also be. JSP dynamic page. For example, you can nest a 10 height of 0 widths. JSP files are used specifically as the number of times to read statistics.
4, optimize
If the amount of information is large, the capacity of the HTML static page to occupy the hard disk will also increase. organizing a new. html page that is common to a static page, and then nesting all static pages with such a file helps reduce the volume of the page. (Note that this volume can only reduce the file size of the page, does not help improve access efficiency)
5. Risk
The risk is focused on the process of generating static pages. Network exceptions can cause the returned JSP page to run blank, frequent reads may cause the JSP page not to appear intact to save as an. html file, and so on, are the issues to consider.