Chrome browser tab page Memory usage is bigger, the website slows down to be like?

Source: Internet
Author: User
Tags chrome developer chrome developer tools

Problem Overview:

The company is doing BS applications.

Before our background server program is stateful, with Ehcache storage login status, these two days I changed to Redis storage, the application itself no longer store login status.

Then self-test, I am testing a time-consuming web operation, I found that the first time the request is relatively fast (this request will open 200 iframe out, there are 2 Ajax requests inside each IFRAME) (the browser will send the server about 600 requests), time spent 1 minutes;

Then the second request, found that a lot of requests have been in the pending state (Chrome developer tools can be seen), waiting for a long time also out of the page, is always in a circular load, very patient I waited more than 10 minutes to come out.

First, use Chrome's developer tools to view the request, as an example of the following Ajax request,

From the developer tool to see the right side of the main time spent in Waitting (TTFB), it seems to be my server has a problem?

Troubleshooting Start:

1. Background logic

The main logic of this request is: first through the Interceptor, the interceptor according to the cookie with the global token to the Redis access to the login information, determine whether to log in to intercept, if logged in, after the controller layer, mainly to check the database, in order to exclude this part of the impact, The business code was commented out and returned directly.

2. Excluding extraneous factors

2.1, first comment out the business logic code

2.2. Then record the time it takes to take data from Redis in the Interceptor:

3, after running a few, the log record is probably as follows:

Because it is the business logic to return immediately, almost no time-consuming;

Interceptors are also time-consuming, presumably 0,1,2 values (LAN Redis is pretty fast)

4. Start the problem test

As a result, the phenomenon is still the same, the first time is relatively fast, the back is more and more slow. Started to wonder if Tomcat was the problem,

So I tried to change it to NIO and the number of threads increased.

(The default http11, not for NIO, to change, change to Org.apache.coyote.http11.Http11NioProtocol)

Reference: Http://www.jianshu.com/p/8445645b3aff

5. Increase the results after the Tomcat thread pool

Or not too much, is a little faster than before the feeling.

6, the back with colleagues in the analysis of the time, colleagues said that you have to close the tab page and try again, was inspired.

On the first request, the browser's process (because the Chrome browser is a process per tab page) memory consumption is 600M;

The second request, the memory will go up to about 1200M;

The third request, it seems my hundreds of requests almost a lot of pengding state.

Here are the test results:

6.1. When the site is first opened, the memory consumption is 70M

6.2, run the first time-consuming operation

The first mission ran, memory up to 1200M, time consuming 50s, a total of 600 requests around.

6.3, run the second time-consuming operation

。。。。

。。。。

。。。。

Wait a long time, so bored to see the next task manager (said, because Chrome tab is a process, so you can view)

The memory is almost 1800M.

The developer tools are as follows:

Can find a large number of pending requests, and then the time has passed for several minutes (almost 6 minutes, there is no sign of the end)

What about the server backstage at this time?

Interceptors and business logic methods are still fast.

。。。。

。。。。

。。。。

Wait, wait.

Finally, in 700s, that is, 11 minutes or so, finally ended. The pit.

6.4, after the page refresh, run another try

After the F5 refreshes, look at the memory footprint:

200M. It's OK

So let's run one more time to see the effect.

As you can see, a new request is completed in a minute.

Summary: The problem is now obvious, that is, the browser tab (process) takes up too much memory, the percentage of requests sent in the pending state will increase significantly. The specific reason is not clear, hope doubts.

The solution is to F5 refresh or turn off the tab page to reopen it.

Chrome browser tab page Memory usage is bigger, the website slows down to be like?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.