memos icon indicating copy to clipboard operation
memos copied to clipboard

Extensive memory and data consumption when posting images

Open raisinbear opened this issue 2 years ago β€’ 2 comments

Describe the bug

Edit: This is for SQLite storage, I don’t know about other backend options.

Hi, first of all thanks for the great work! I really enjoy using memos a lot 😊 I often create memos with images / photos and noticed that memory load on my server shoots up when loading these posts. In a test environment, I freshly set up, I created some memos containing a lot of images (regular smartphone resolution) and observed resource usage. The docker container was quickly consuming > 500 MB of memory when a client loaded the page. More when I added more images. Needless to say this kind of scaling can quickly lead to OOM condition depending on the server hardware and other running services πŸ˜… Part of the issue, I think, is that there are no thumbnails (at least I couldn't find any in the database) and the images are loaded full scale. That leads me to the second part of the issue header: this makes quite a dent in mobile data balance and isn't really necessary just for the memos overview. However, I guess creating smaller preview images would just postpone the problem, since memory consumption would still rise proportionally with the number of loaded images, merely at a slower rate.

Steps to reproduce

  1. Upload image resources with memo
  2. Visit overview with any client
  3. Take note of server side memory consumption
  4. Upload more image resources
  5. Repeat 1-3 and compare memory consumption to the one noted before

Screenshots or additional context

No response

raisinbear avatar Mar 03 '23 16:03 raisinbear

It looks like storing these images in a database will cause errors. FYI, we support integration with external storage in the latest version, such as AWS S3. So I think you should configure an s3 to prevent this problem.

boojack avatar Mar 04 '23 06:03 boojack

Thanks for the quick reply. I saw you added S3 support, which is great! At the same time, memos is such a lightweight service - apart from the issue mentioned - that it performs like a champ even on an outdated raspberry pi 2! Possibly even on lower spec'd hardware. Sure, it's possible to use minio as backend, but this seems kind of overkill for personal small-scale deployment πŸ˜… Anyways, thanks a lot for considering!

raisinbear avatar Mar 04 '23 10:03 raisinbear

Feel free to reopen if problem still exists

boojack avatar Mar 11 '23 04:03 boojack