# Workaround for high \`tutor dev\` memory usage in Palm and Nightly

**URL:** <https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717>\
**Category:** Development\
**Tags:** tutor, tutor-mfe, palm\
**Created:** [July 14, 2023, 4:20pm UTC](https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717 "2023-07-14T16:20:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmccormick](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/kmccormick/32/8982_2.png) [@kmccormick](https://discuss.openedx.org/u/kmccormick)\
**Post date:** [July 14, 2023, 4:20pm UTC](https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717/1 "2023-07-14T16:20:42Z")

</div>

**The good news:** Tutor has been keeping up with improvements to Open edX frontends. Since Palm, Tutor now runs **nine** different micro-frontend apps by default!

**The bad news:** In development mode (`tutor dev`), this results in very high resource consumption, since each micro-frontend uses its own Docker container. Depending on how much memory you have, running `tutor dev start` in Palm or Nightly might freeze your machine.

**The workaround:** You can lower tutor-dev’s resource consumption by creating a simple plugin that disables the MFEs that you don’t strictly need. Create a file at `"$(tutor plugins printroot)/fewermfes.py"`:

```python
from tutormfe.hooks import MFE_APPS

MFES_TO_KEEP = ["learning", "gradebook", "course-authoring"]

@MFE_APPS.add()
def _remove_extra_mfes(apps: dict) -> dict:
    return {
        app_name: app
        for app_name, app in apps.items()
        if app_name in MFES_TO_KEEP
    }

```

Then, enable it, and re-initialize the MFE plugin:

```auto
tutor plugins enable fewermfes
tutor config save
tutor dev do init --limit=mfe
tutor dev reboot

```

You can modify `MFES_TO_KEEP` to suit your needs. Remember to disable this plugin before using production mode (`tutor local`), unless you want to run the deprecated frontends!

**Longer term** : We are working on improvements to tutor-mfe so that tutor-dev will only use a single Docker container, regardless of how many micro-frontends are installed: [Support `npm start` on host for MFE development · Issue #123 · openedx/wg-developer-experience · GitHub](https://github.com/openedx/wg-developer-experience/issues/123)

---

<div class="post-metadata">

**Author:** ![bergman](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/bergman/32/2897_2.png) [@bergman](https://discuss.openedx.org/u/bergman)\
**Post date:** [July 20, 2023, 12:15pm UTC](https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717/2 "2023-07-20T12:15:08Z")

</div>

Is the fact itself there are many node containers affects so much? Or maybe the fact we have 9 webpack devservers running? What is the expected effect if we put all those devservers in a single “jar”? Will it resolve the situation? Possibly, putting only a configurable subset of MFEs into a dev mode could help… Just a thoughts: what is resources diff MFE with devserver vs built-n-served? 🤔

---

<div class="post-metadata">

**Author:** ![kmccormick](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/kmccormick/32/8982_2.png) [@kmccormick](https://discuss.openedx.org/u/kmccormick)\
**Post date:** [July 20, 2023, 3:39pm UTC](https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717/3 "2023-07-20T15:39:39Z")

</div>

> [@bergman](#):
>
> Is the fact itself there are many node containers affects so much? Or maybe the fact we have 9 webpack devservers running? What is the expected effect if we put all those devservers in a single “jar”?

Great question @bergman . I imagine that having a single devserver instead of 9 would make a big difference. I don’t know how hard that would be to implement.

> [@bergman](#):
>
> Possibly, putting only a configurable subset of MFEs into a dev mode could help Just a thoughts: what is resources diff MFE with devserver vs built-n-served? 🤔

Yes, if I understand you correctly, that is what @brian.smith is working on now. The resource difference is very significant!

---

<div class="post-metadata">

**Author:** ![regis](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/regis/32/2640_2.png) [@regis](https://discuss.openedx.org/u/regis)\
**Post date:** [August 2, 2023, 10:26am UTC](https://discuss.openedx.org/t/workaround-for-high-tutor-dev-memory-usage-in-palm-and-nightly/10717/4 "2023-08-02T10:26:58Z")

</div>

I have a candidate solution to the high memory/cpu issue: [fix: high memory/cpu usage in dev by regisb · Pull Request #137 · overhangio/tutor-mfe · GitHub](https://github.com/overhangio/tutor-mfe/pull/137)

Let me know what you think by adding your comments to the PR. I’m particularly interested to learn if it works for you! (it works for me)
