Vaultwarden installation needs bigger swap file

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
huidbui25
Posts: 42
Joined: Tue May 07, 2019 7:07 pm
Location: DE

Re: Vaultwarden installation needs bigger swap file

Post by huidbui25 »

Hello!

Awesome stats. :) Unfortunately I can'r provide you with data that soffisticatedly.

I used htop to monitor 'real-time' what was going on. In the first half hour only about 1 GB was used, then it increased to around 1.4 GB on average and only in the last step of the installation (like the last 10 - 5 minutes) it rose to 2.0 GB. That's all I can tell.

Yes, I'm on aarch64, maybe that's an issue here, too.

I wasn't supposed to cause work on your part, I only wanted to report what I found out on my system. :) Vaultwarden is by the way the only installation that needed that much swap space here. All other programs were satisfied with a lot less then 1 GB of swap space.
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Vaultwarden installation needs bigger swap file

Post by Joulinar »

On the failed install (1GB swap), do you remember how man man CPU cores got utilized? 2 or more?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
huidbui25
Posts: 42
Joined: Tue May 07, 2019 7:07 pm
Location: DE

Re: Vaultwarden installation needs bigger swap file

Post by huidbui25 »

htop shows 4 cores for my system. And the bars looked pretty busy during installation, i.e. often at 100%. However, as far as I can remember the cores were only used sequentially, i.e. not all at the same time but one after another. Unfortunately I can't remember for sure if only 1 core was used at a time or two. :? I tend to say it was only one core at a time ...
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Vaultwarden installation needs bigger swap file

Post by Joulinar »

usually it should have been 2 cores at the same time on a standard setup on RPi3B+
Ok I will replicate next week and share my monitoring result afterwards.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
WarHawk
Posts: 781
Joined: Thu Jul 20, 2017 8:55 am

Re: Vaultwarden installation needs bigger swap file

Post by WarHawk »

ZRAM candidate??
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Vaultwarden installation needs bigger swap file

Post by Joulinar »

@MichaIng, @huidbui25 as promised, I did some more testing.

Below the link to my monitoring data. These time I reduced the view to CPU, Memory and SWAP usage. Again it is valid for 7 days

https://snapshot.raintank.io/dashboard/ ... Uh3prSXUga

What I testes: RPi3B+ ARMv8 Bullseye

09:04 - 09:09
  • SWAP set to 1GB
  • 2 parallel jobs triggered
  • already whole Mem + SWAP used after minutes
  • I cancelled installation manually
09:13 - 10:32
  • SWAP set to 1.5GB
  • 2 parallel jobs triggered
  • SWAP usage increased over time until it reached max
  • installation killed by OOM reaper
10:34 - 12:02
  • SWAP set to 2GB
  • 2 parallel jobs triggered
  • SWAP usage increased over time until it reached 1.85GB usage short before installation finished
  • installation finished after 83 minutes
12:16 - 13:28
  • SWAP set to 3GB
  • max number parallel jobs triggered (4 jobs)
  • SWAP usage increased over time until it reached 2.00GB usage short before installation finished
  • installation finished after 69 minutes
And just to compare long running installation time vs docker

13:30 - 13:34
  • SWAP set to 3GB (still)
  • docker software + portainer + vaultwarden install
  • SWAP usage > none
  • installation finished after 4 minutes
Summary:
  • 64bit ARMv8 requires much more Memory/SWAP compare to 32bit ARMv7
  • even 2 GB SWAP (3GB total) seems to be close as it reaching the limits on an empty system already
  • 3 GB SWAP (4GB total) seems to be fine but this will trigger quite high CPU usage as it will utilize all 4 cores
  • using docker image is much faster and done in a couple of minutes without SWAP usage
  • downside on docker is the overhead of around 90-100 MB memory
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: Vaultwarden installation needs bigger swap file

Post by MichaIng »

Many thanks for testing. Just to be sure, you did every test on a clean system, respectively cleared /tmp before doing the next run? As every Rust build produces a /tmp entry that stays, at least when the build is cancelled, and a new entry is created on next attempt (sadly I didn't find a way to resume a cancelled build).

So basically we need to to set the min memory 1 GiB higher for ARMv8.
huidbui25
Posts: 42
Joined: Tue May 07, 2019 7:07 pm
Location: DE

Re: Vaultwarden installation needs bigger swap file

Post by huidbui25 »

Joulinar wrote: Mon Oct 11, 2021 1:55 pm @MichaIng, @huidbui25 as promised, I did some more testing.
[...]
Absolutely amazing testing you did! :o :) It confirms the observations I made on my system.

If I could choose, I'd opt for the docker-free installation. Though it consumes considerably more resources during installation, it runs with lower impact later on. However, maybe a note or so in dietpi-software about the duration of the installation would be helpful for users.
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Vaultwarden installation needs bigger swap file

Post by Joulinar »

To avoid any left overs I did a reboot and performed another installation. To simulate some load I kept Docker + Telegraf running. As well I extended monitoring view and added /tmp. As you can see it was empty before install. Runtime was nearly same. SWAP usage was around 1.99 GB at the end. Even on a rebooted system it's close if you count some apps running. No problem on an empty system but if you have something running already it might not fit.

There you go with the charts https://snapshot.raintank.io/dashboard/ ... 3Oppszw03w
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply