Skip to content

FSAdapter raises RAM consumption after access to file #8686

Open
@Kutikov

Description

@Kutikov

New Issue Checklist

  • I am not disclosing a vulnerability.
    I am not just asking a question.
    I have searched through existing issues.
    I can reproduce the issue with the latest version of Parse Server.

Issue Description

When I use FSAdapter and try to fetch multiple files using Parse.File.url({forceSecure: true}), I`m facing growing of RAM consumption up to 2-2.5 times on my server

Steps to reproduce

The simplest way to reproduce:

  1. Start express app with ParseServer
  2. Check up RAM consumption as baseline
  3. Record the OGG audio file, upload it using Parse to the server
  4. Start playing in <audio> element in html or any other stream player
  5. Check up RAM consumption - level 1
  6. Stop playing and destruct player to free up link
  7. Check up RAM consumption - level 2

Actual Outcome

RAM consumption: baseline < level 1 <= level 2. In my case level 2 = level 1 = 2.5x baseline

Expected Outcome

RAM consumption: baseline < level 1 > level 2. I'd like to have 1.5x level 2 = level 1 = 1.5x baseline

Environment

Server

  • Parse Server version: 5.5.3
  • Operating system: Ubuntu 20.04
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 6.0.3
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: 4.1.0

Logs

Activity

parse-github-assistant

parse-github-assistant commented on Jul 13, 2023

@parse-github-assistant

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
mtrezza

mtrezza commented on Jul 13, 2023

@mtrezza
Member

If you try to get the file using a CURL request to the REST API, do you see the same increase in RAM consumption?

Kutikov

Kutikov commented on Jul 14, 2023

@Kutikov
Author

No differences between ParseClientJS and access through raw URL

My actions:

  1. Open the needed page and get url through ParseClientJS, copy it
  2. Reboot the server and monitor RAM consumption baseline
  3. Open the link in a browser using copied URL (2 types of files: audio/ogg codec opus and video/mp4
  4. Measure RAM consumption again while audio/video is playing level 1
  5. Wait until the end of playing and close the browser
  6. Measure RAM consumption level 2

Results:
125% baseline = level 1 = level 2 for video/mp4
150% baseline = level 1 = level 2 for audio/ogg codec opus

Notes:
I'm delighted with these results because RAM consumption is not growing as dramatically as before. I've made some server optimization: I enabled swap file 1Gb and cannot reproduce server freeze and Out of Memory problems after this. I start this investigation because of server crashes and freezes every 5-8 hours. In fact my problem is solved.

Even if we cannot figure out the causes of this RAM consumption growth, it's needed to make a mark in server requirements about at least 1024 MB of RAM combined with 1024 MB of swap for ParseFile using

mtrezza

mtrezza commented on Jul 14, 2023

@mtrezza
Member

I'm not sure what specific number should be added to the docs regarding server requirements. I think this depends on the (virtual) hardware, maybe OS limit settings and the file itself. Maybe there's more to it and file handling could be improved to use the available RAM (with longer response time) instead of crashing the server, but that would require a deeper analysis.

Kutikov

Kutikov commented on Jul 14, 2023

@Kutikov
Author

Ok, so I think this issue is not urgent and can be queued to the regular workflow. Let me know if you need any details or testing. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:docsOnly change in the docs or README

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mtrezza@Kutikov

        Issue actions

          FSAdapter raises RAM consumption after access to file · Issue #8686 · parse-community/parse-server