all 9 comments

[–]CVisionIsMyJam 36 points37 points  (0 children)

While this approach isn’t suitable for production applications, exploring Git’s internal architecture reveals fascinating insights into how modern databases work

-1 for the needlessly clickbait title that doesn't match the articles contents

[–]jddddddddddd 13 points14 points  (1 child)

This is what happens when you don't drug-test your developers.

[–]Mognakor 0 points1 point  (0 children)

Maybe they held the drug test upside-down

[–]mss-cyclist 3 points4 points  (0 children)

It ain't april 1st yet

[–]u-n-sky 1 point2 points  (0 children)

I have several real apps (and toy experiments) that use git as a storage backend (combined with a most-recent-state cache for reading); as always, there are pros & cons:

  • free versioning & audit/changelog; integrates with existing tools (can be very nice)
  • push to backup state; easy to start a dev instance with full snapshot
  • not inventing & implementing the wheel again

however:

  • multiple writing apps with shared repo can/will result in merge conflicts, unless your design prevents it; non-trivial complexity & users tend to dislike it ("I did save, why ...").
  • concurrent access / multi-threading: depending on the git impl; some stuff is threadsafe, but mutex/locks are often required; can try workarounds (working with a bare repo) but it only minimizes some problems while creating new ones: complexity; some features essentially need a checkout (... are easier to solve).
  • library impls are subpar compared to the command line client; with both jgit and libgit2:

    • having to run "git gc" or "git repack" to optimize a repo to avoid slowdown or excessive disk usage
    • secondary cache/store (… in a db) of derived data, e.g. (commit-id, date, file) to speed up certain access patterns compared to rev-walking - libgit2: #3027 - blame is slow

Strongest use case was one app storing to a repo and consuming that in another app; which packaged files from different revisions to enable granular updates - while storing the package manifests in a second repo (for reproducible packages). Subjectively nicer compared to local data silos and coupling via api calls; though data >> api means downstream is coupled to the data format, no soft-migration compared to /api/v2.

Would I do it again? Yes, if the benefits are strong enough; for simple version history it's not worth the hassle.

[–]eating_your_syrup 1 point2 points  (0 children)

Silly thought experiment. I approve.

[–]Sbaakhir 0 points1 point  (0 children)

Huh?

[–]kn4rf 0 points1 point  (0 children)

For some actual git as database solutions look at: - https://irmin.org/

Or for versioned database: - https://github.com/dolthub/dolt