java - spring是不是相比其他框架要慢一些?
巴扎黑
巴扎黑 2017-04-18 10:55:40
0
11
1195

用springMVC开发了一个在线考试系统。后台用了Spring+SpringMvc,其他还用了SpringSecure。

除了服务器,其他客户端载入一个页面,看了下时间大约在70ms左右,不含载入后用post请求的一堆数据。重复刷新或者去其他页面也都是要等70ms左右才能加载完页面。页面静态资源缓存已开。

这个70ms左右的时间有办法减少吗?谢谢!

巴扎黑
巴扎黑

reply all(11)
Peter_Zhu

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. . .

Ty80

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template