High concurrency solution--page static

First, what is page static:

Simply put, if we access a link, the module corresponding to the server will process the request, go to the corresponding jsp interface, and finally generate the data we want to see. The disadvantage of this is obvious: because the server will process each request, if there are too many high concurrent requests, it will increase the pressure on the application server, and the server will be down if it is not good. So how to avoid it? If we save the result of the test.do request as an html file, and then access it every time the user accesses it, wouldn't the pressure on the application server be reduced?

So where do static pages come from? Can't let us handle each page manually? Here comes the content we want to explain, the static page generation scheme... What we need is to automatically generate a static page. When the user visits, it will automatically generate test.html and then display it to the user.

Second, let's briefly introduce the knowledge points that should be mastered in order to master the static page solution:

1. Basics - URL Rewrite

What is URL Rewrite? URL Rewrite. Use a simple example to illustrate the problem: enter the URL, but actually visit abc.com/test.action, then we can say that the URL is rewritten. This technology is widely used, and there are many open source tools that can achieve this function.

2. Basic - Servlet web.xml

If you don't know how a request matches a servlet in web.xml, search the servlet's documentation. This is not nonsense. Many people think that the matching method such as /xyz/*.do is effective.

If you don't know how to write a servlet yet, please search how to write a servlet. This is not a joke. Today, with all kinds of integration tools flying around, many people will not write a servlet from scratch.

Three, the basic program introduction

java high concurrency, how to solve it, how to solve it
Among them, for the part of URL Rewriter, you can use paid or open source tools to implement it. If the URL is not particularly complicated, you can consider implementing it in a servlet, then it looks like this:

 

java high concurrency, how to solve it, how to solve it
 
Summary: In fact, we seldom consider this kind of problem in development. We directly implement the function first. When a programmer has been working for 1 to 2 years, he will feel that the realization of the function is not the most important, safety performance, quality Waiting is what a developer should be most concerned about. What I am talking about today is high concurrency. My solution is: 1. Adopt distributed application design 2. Distributed cache database 3. Code optimization

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325598769&siteId=291194637