Each request takes 70 milliseconds, so 1 CPU core can only handle 1000/70=14 requests per second, and 4 CPU cores can only handle 56 requests. To be honest, it is already quite slow. Make another one In comparison, when using PHP7+OPcache to run WordPress on Ubuntu (i5-3230M), one CPU core processes one WordPress homepage request (no cache needs to be checked in the database), and it only takes 28 milliseconds. You must know that WordPress has poor performance. PHP program.
So, I think each request must take at least 10 milliseconds or less to be considered fast. After all, Nginx only takes 1 millisecond to display a directory list of the root directory of a website.
In fact, 70ms is not too slow for web applications.
If you think it affects the user experience, compare it with pure HttpServlet. There are many factors that affect page loading time. Long delays are not necessarily caused by Spring MVC, but are related to factors such as containers and browsers.
You still have to look at the code and the actual situation, if it is entirely because the response speed of that request is too slow. Generally, the best optimization for small systems is to add a cache to reduce database requests and fetch data directly from memory. This will be much faster!
Let’s put it this way, it may be fast to write simple pages directly using Servlet, but when you finish all the functions yourself, you may find that it is not even as fast as SpringMVC, and many of the functions you do are actually SpringMVC Wait until the framework already exists.
Each request takes 70 milliseconds, so 1 CPU core can only handle 1000/70=14 requests per second, and 4 CPU cores can only handle 56 requests. To be honest, it is already quite slow. Make another one In comparison, when using PHP7+OPcache to run WordPress on Ubuntu (i5-3230M), one CPU core processes one WordPress homepage request (no cache needs to be checked in the database), and it only takes 28 milliseconds. You must know that WordPress has poor performance. PHP program.
So, I think each request must take at least 10 milliseconds or less to be considered fast. After all, Nginx only takes 1 millisecond to display a directory list of the root directory of a website.
In fact, 70ms is not too slow for web applications.
If you think it affects the user experience, compare it with pure HttpServlet. There are many factors that affect page loading time. Long delays are not necessarily caused by Spring MVC, but are related to factors such as containers and browsers.
It also has something to do with the code you write. . .
You still have to look at the code and the actual situation, if it is entirely because the response speed of that request is too slow. Generally, the best optimization for small systems is to add a cache to reduce database requests and fetch data directly from memory. This will be much faster!
I suggest you take a look at this: https://my.oschina.net/xiangg...
This is mainly related to Spring’s view rendering mechanism. You can refer to: http://www.cnblogs.com/davidw...
Let’s put it this way, it may be fast to write simple pages directly using Servlet, but when you finish all the functions yourself, you may find that it is not even as fast as SpringMVC, and many of the functions you do are actually SpringMVC Wait until the framework already exists.
I don’t think it’s too slow
70ms
It’s still relatively fast, as this amount of time is completely insensitive to the user.Separate the front-end and back-end, and then cache the GET request. Of course 70ms is already very fast.