Nixpkgs: Does beesd actually work?

Created on 26 May 2020  路  4Comments  路  Source: NixOS/nixpkgs

Describe the bug

I have a NixOS system with 250 LXC containers (running NixOS) from the same LXC image. They are initially about 600 MB and content is identical. So i thought that this is a perfect scenario for deduplication, but only 10 GB are saved from 170 after i let beesd do its thing for 4 days.

To Reproduce

I might try to reproduce it with a simpler setup when i have time.

Steps to reproduce the behavior:

  1. ...
  2. ...
  3. ...

Expected behavior
250 x 600 MB are deduplicated to 1x 600MB, since the nix store is read only and never changes

Additional context
Add any other context about the problem here.

Notify maintainers
@charles-dyfis-net

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
question

All 4 comments

It works for me -- I use it in practice. That said -- typically, if you're running a bunch of lxc containers, you'd want to directly mount a shared Nix store into all of their namespaces, so that shared store wouldn't be duplicated (and require deduplication) in the first place.

bees really stands out in scenarios where file-by-file deduplication isn't good enough -- if you _can_ do file-by-file, using xfs_io dedupe or even cp --reflink=always (caveat that using cp loses the guarantees that a dedupe operation will be nondestructive) is your friend.

Anyhow -- if you have a lot of content you know isn't being deduplicated, the first place I'd start is inspecting /.beeshome/beesstats.txt, and taking any remedial action implied (if the hash table is full, f/e, you know it needs to be larger); followed by reading through https://github.com/Zygo/bees/blob/master/docs/wrong.md, making sure you aren't doing something like btrfs defrag that undoes bees' work (or leaving autodefrag turned on), etc.

The second place I'd start is talking to upstream.

thank you very much for the fast and helpful response!

if you're running a bunch of lxc containers, you'd want to directly mount a shared Nix store into all of their namespaces, so that shared store wouldn't be duplicated (and require deduplication) in the first place.

can you give me a hint how to do that in practice?

if you're running a bunch of lxc containers, you'd want to directly mount a shared Nix store into all of their namespaces, so that shared store wouldn't be duplicated (and require deduplication) in the first place.

can you give me a hint how to do that in practice?

Something like:

lxc.mount.entry = /nix/store nix/store none defaults,bind.ro 0.0

Closing this ticket for now. Wish you luck in getting something that works for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

teto picture teto  路  3Comments

lverns picture lverns  路  3Comments

ob7 picture ob7  路  3Comments

yawnt picture yawnt  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments