memory usage
Warracker appears to be using 3x more RAM than expected. This will ultimately limit what types of servers it can run on. I'm currently seeing about 150mb RAM utilization from the warracker front-end. the db is using about 36mb which is expected. version 0.9.9.8
Hello @icywhisker-official!
Do you have email notifications enabled?
And are your files and documents running on a separate volume?
E-mail notifications are turned off. I'm not really sure if 150mb ram utilization is normal. it seems not though. the docker is running send_expiration_notifications every 2 minutes
Couple of things are not optimized.
And the email notification runs in the background even if it's turned off.
I'm investigating as well.
For your storage what have you set?
this is running on a google container optimized os. its root fs is read only (sda). sdb is where the warracker db is mounted to
[Unit] Description=Warracker Service After=warrackerdb.service
[Service]
ExecStart=/usr/bin/docker run --rm
--network actual-net
--name warracker
-p 8005:80
-v /mnt/disks/data/warracker/uploads:/data/uploads
-e DB_HOST=warrackerdb
-e DB_NAME=warranty_db
-e DB_USER=warranty_user
-e DB_PASSWORD=${DB_PASSWORD:-warranty_password}
-e SMTP_HOST=smtp.email.com
-e SMTP_PORT=465
-e SMTP_USERNAME=REDACTED
-e SMTP_PASSWORD=REDACTED
ghcr.io/sassanix/warracker/main:latest
ExecStop=/usr/bin/docker stop warracker ExecStopPost=/usr/bin/docker rm -f warracker
[Install] WantedBy=multi-user.target [Unit] Description=Warracker DB After=fs-prep.service network-online.target docker.service
[Service]
ExecStart=/usr/bin/docker run --rm
--network actual-net
--name warrackerdb
-v /mnt/disks/data/warracker/db:/var/lib/postgresql/data
-e POSTGRES_DB=warranty_db
-e POSTGRES_USER=warranty_user
-e POSTGRES_PASSWORD=${DB_PASSWORD:-warranty_password}
--health-cmd="pg_isready -U warranty_user -d warranty_db"
--health-interval=5s
--health-timeout=5s
--health-retries=5
postgres:15-alpine
ExecStop=/usr/bin/docker stop warrackerdb ExecStopPost=/usr/bin/docker rm -f warrackerdb
[Install] WantedBy=multi-user.target
Thanks for that, how many warranties have you added in total?
1
1
And there are no large documents added correct?
Can you change the storage limit from 32 MB's to 16 and restart your application, and see if that reduced it a little bit.
I found it. each gunicorn worker uses about 45mb.
I'm working on having different memory modes to increase efficiency.
Right now, there's 4 workers.
this app is designed to support multiple users which makes sense however, there doesnt seem to be any real need for multiple workers if there is only one user in the db. perhaps that check can be built in and for every 5 users, increase the worker count exponentially until a limit is reached?
I will give the option to the users, if they want to use the least amount of ram on their VPS or Raspberry Pie's I will set up 1 worker, which will handle the workload well.
So three different modes, optimized, ultra-light, and performance, which can be setup through .env or within docker-compose.
Thanks for letting me know, I also need to work on the email notification scheduler to stay disabled when it's disabled in the settings.
docker compose is ideal for me. I can build it into the service
With over 6 warranties, I have brought it down to this much usage.
I believe actual budgeting software merged their server and front end into one docker. If the same thing is done here, it may drastically improve memory usage and processing times. The current usage that this application has will limit the amount of future projects I add to my server unless I add swap.
I will look into how actual budget has it setup, that's very interesting. I will look into it, but in the meantime I have the optimized versions that can be utilized through the environment variables.
I wouldn't focus on merging or even optimizing until after initial release. Features first, bugs second, optimization 3rd. That seems like a good idea
HI @icywhisker-official,
Thanks again for bringing it to my attention, I appreciate your feedback! :)
I have released the enhancements under the latest release, you can use the environments in your docker-compose this way:
Memory optimization mode
Options: optimized (default), ultra-light, performance
- optimized: 2 workers, ~60-80MB RAM usage (recommended for most deployments)
- ultra-light: 1 worker, ~40-50MB RAM usage (for very limited resources)
- performance: 4 workers, ~150-200MB RAM usage (for high-traffic deployments)
WARRACKER_MEMORY_MODE=optimized
The app runs at around 60-80mb. Thanks for the improvement!
It is possible to save an overall 30-50mb of RAM by implementing further optimizations. This could include using a different db provider such as sqllite; merging the two dockers into one; allowing the e-mail server to be optional; using a different web hoster other than nginx; using waitress instead of gunicorn