Group-income-simple: Grunt watch reload gets too slow over time

Created on 1 Jun 2020  路  10Comments  路  Source: okTurtles/group-income-simple

Problem

When the server is started grunt dev, each time a file is changed the reload time takes ~8-10sec, which is _ok'ish_. This is already too slow compared to other tools, but the normal time for this project.

Over time, as we do more reloads, the reload time starts to increase as well, reaching 30-40s to reload the page.

This causes a High Usage of CPU and my PC starts to overheating. (up to 90潞C easily).

Besides that, it decreases a lot my productivity over time. A task that could take 3h probably will take +4h because of this slow reloading. (and I already do an extra effort to avoid saving a file too soon to spare some extra reloads)

So, our only solution is to restart the server and recreate the previous state (Cypress helps here) to get back to normal reload times. However, it's a matter of time to start having slow reloads again.

Solution

I tried to understand what's the cause but without success. :/

Tooling Up-for-grabs

Most helpful comment

If the issue takes a long time before becoming apparent, it could be related to memory leaks, file descriptor leaks, or other ressources.

Is the output of top still normal when the problem arises?

All 10 comments

I think @snowteamer mentioned that there's an eslint --cache option that could possibly be used to speed things up.

Yes, but unfortunately it would probably not solve the issue of the system slowing down over time

@sandrina-p - Are you seeing the time increase when running locally? I'm wondering if this is Docker related.

One solution could be:

  1. Remove eslint from grunt build (which will remove it from grunt dev).

    1. Our IDEs should warn us on eslint rules anyway - if setup correctly.

  2. Add a grunt lint task that can be added to grunt test
  3. Run quality checks on git pre-push hook.

With this:

  1. eslint will not have to run until you push code, speeding things up.
  2. Linting errors will still be blocked locally and in CI.
  3. Linting can still be checked as needed with grunt lint.
  4. We have separated the build concerns from the quality concerns.

I would also think to do the following:

  1. Install Prettier for formatting - matching settings to our eslint setup, thereby:

    1. Code will be formatted using Prettier.

    2. Code quality will be fixed using eslint.

      > See: https://prettier.io/docs/en/comparison.html

  2. Install EditorConfig to signal to the IDE what formatting each file type needs.
  3. Setup our IDEs to format w/ Prettier when saving a file.

Well, first we need to diagnose what the problem actually is. It's unclear that it's linter related.

I installed grunt-timer to try an observe the same behavior.

  1. I ran grunt dev and tried changing the frontend JavaScript about 20 times.
  2. I refreshed the login page about 30 times.
  3. I refreshed the dashboard page about 50 times.

I could not see any increase in time to build the code or reload the page.

@sandrina-p ...

  1. What operating system and version are you using?
  2. Which view should I test for reload times?
  3. Which browser are you developing with?

It's not just about refresh in a short amount of time. When I tried that, it was working fine too. It's something that happens with a long period of time 30min-2h.

I think the best way to replicate is by doing some real issue/task that evolves sbp contracts (creating users, groups, invites, etc...) at the same time you change code related with views or comtracts too. Eventually you'll see it too.
@pieer has the same problem too

MacOS Mojave, latest chrome/firefox, Node 12

If the issue takes a long time before becoming apparent, it could be related to memory leaks, file descriptor leaks, or other ressources.

Is the output of top still normal when the problem arises?

Yes, the output is the normal. We also think the issue has something related with memory leak in code recompilation.

This might be fixed in #1020, please have a look at let us know!

Please re-open this issue if the problem re-occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hubudibu picture hubudibu  路  5Comments

sandrina-p picture sandrina-p  路  5Comments

sandrina-p picture sandrina-p  路  8Comments

hubudibu picture hubudibu  路  8Comments

taoeffect picture taoeffect  路  3Comments