memos
memos copied to clipboard
Extensive memory and data consumption when posting images
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
- Upload image resources with memo
- Visit overview with any client
- Take note of server side memory consumption
- Upload more image resources
- Repeat 1-3 and compare memory consumption to the one noted before
Screenshots or additional context
No response
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.
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!
Feel free to reopen if problem still exists