News for hackers. Stuff that matters.
Re:SQLite: 35% Faster Than the Filesystem by mkl on Sunday January 15, 2023 @02:58AM (#34387619)
On Windows in my experience it's at least a factor of 10. I worked on a script recently that reads ~20000 files a few kb each and extracts some info to generate a web page. I sped it up enormously just by putting the file contents into SQLite tables.
Re:SQLite: 35% Faster Than the Filesystem by nostrademons on Sunday January 15, 2023 @03:02AM (#34387645)
Lots of small files (particularly in a single directory) is a known failure mode of many OS filesystems. I remember putting a million files into MogileFS and finding that filesystem operations basically did not complete in any reasonable length of time.
Re:SQLite: 35% Faster Than the Filesystem by icelancer on Sunday January 15, 2023 @03:08AM (#34387682)
Yeah I got absolutely crushed by this when trying to migrate a Windows Server 2016 machine to unRAID, whose filesystem is absolutely horrible when dealing with thousands of smaller files. Wiped out a month of work for NAS-related activities; we're back on Windows again.
Re:SQLite: 35% Faster Than the Filesystem by leoc on Sunday January 15, 2023 @03:14AM (#34387727)
Small-file performance was the main selling point of (v3) ReiserFS.
Re:SQLite: 35% Faster Than the Filesystem by v3ss0n on Sunday January 15, 2023 @03:52AM (#34387914)
The murderous File System.
Re:SQLite: 35% Faster Than the Filesystem by szastamasta on Sunday January 15, 2023 @04:04AM (#34387965)
ReiserFS was really good. Too bad that nobody continued it. I’m not sure it was due to the original author story or due to it’s code being really hard to work with. But the FS was so much faster than ext3/4 on machines from 2000’. And I never lost a file with it. Something you cannot say about xfs or jfs. I’ve had to reinstall os so many times after system crash due to them getting corrupted.
Re:SQLite: 35% Faster Than the Filesystem by leoc on Sunday January 15, 2023 @08:44AM (#34389322)
Edward Shishkin has kept plugging away at Reiser4 https://en.wikipedia.org/wiki/Reiser4#History_of_Reiser4 .
Re:SQLite: 35% Faster Than the Filesystem by avgcorrection on Sunday January 15, 2023 @03:46AM (#34387885)
It also seems that some “do one thing well” tools want to implement their logic using files. For example: each entry in a password database is a file (pass(1)).

Whatever overhead of such small files might not matter though if the problem space is kept “human sized” (whatever one human can be bothered to manage).

I used to have tens of thousands of file in git annex. I had to tarball (chunk) some of the things that I never really use in order to speed up `git annex fsck`.

Re:SQLite: 35% Faster Than the Filesystem by breck on Sunday January 15, 2023 @04:50AM (#34388180)
Yes I did an experiment years ago with 6.5 million files and it was disaster (https://breckyunits.com/building-a-treebase-with-6.5-million...).

However, things have totally changed with the M1 generation of Macbooks. Things that were once near impossible now run in an instant. I need to redo this experiment.

Re:SQLite: 35% Faster Than the Filesystem by _dhruva on Sunday January 15, 2023 @10:12AM (#34389962)
When I worked at NetApp, this was a problem there too.

IIRC, the fix was for directory entries were later stored in sorted buckets (aka hash map) and only the corresponding bucket for the file name would get locked. This reduced scope of lock for atomic operations like rename and also allowed faster lookup instead of O(n) based scan.

Re:SQLite: 35% Faster Than the Filesystem by vanviegen on Sunday January 15, 2023 @03:39AM (#34387847)
I think an in-process database will always have a large advantage in this scenario, as going through the filesystem means at least three system calls (open, read, close) per file.

That's not to say filesystems couldn't be improved.

Re:SQLite: 35% Faster Than the Filesystem by chongli on Sunday January 15, 2023 @03:07AM (#34387675)
Windows struggles horrendously with lots of small files. If you tried the same task on Linux you’d see a large jump in performance. I don’t know if Linux small file access could match SQLite but it would be a lot closer.
Re:SQLite: 35% Faster Than the Filesystem by icelancer on Sunday January 15, 2023 @03:10AM (#34387695)
Depends. fuse filesystem + SMB was so bad (unRAID; Linux underneath) that I had to switch back to Windows, which works mostly fine.
Re:SQLite: 35% Faster Than the Filesystem by bombolo on Sunday January 15, 2023 @03:34AM (#34387822)
Well fuse… did you expect performances using fuse?
Re:SQLite: 35% Faster Than the Filesystem by icelancer on Sunday January 15, 2023 @12:17PM (#34391030)
I expected unRAID to be good at storing files of all kinds.
Re:SQLite: 35% Faster Than the Filesystem by sz4kerto on Sunday January 15, 2023 @04:28AM (#34388066)
That's because Windows' FS offers quite a lot of features that many other FSs don't -- especially SQLite doesn't. You might not need those features, of course.

One core feature is that Windows offers hooks ('filters') that allows other components to put themselves between the client program and the files. This is how virtual filesystems work (like OneDrive, etc.), or how anti-malware works.

When you read from sqlite, then those reads can't come from another server, the objects can't be scanned automatically, etc. Again -- you might not need these features, but it's not that sqlite or ext4 is somehow magically faster; they just made different design choices.

Re:SQLite: 35% Faster Than the Filesystem by kaba0 on Sunday January 15, 2023 @07:59AM (#34389066)
Linux also has virtual file systems.
Re:SQLite: 35% Faster Than the Filesystem by ectopod on Sunday January 15, 2023 @08:36AM (#34389278)
The design choices make a bit of a difference but most of the overhead is Defender. When you try to read thousands of files your computer spends most of its time running Defender. Turn it off and the problem goes away.
Re:SQLite: 35% Faster Than the Filesystem by mkl on Sunday January 15, 2023 @06:13AM (#34388562)
Yes, Linux does a lot better (haven't tried that specific script, but have done a lot of similar things), but I've gotten (smaller) speed improvements with similar use of SQLite there too.
Re:SQLite: 35% Faster Than the Filesystem by vbezhenar on Sunday January 15, 2023 @03:30AM (#34387803)
Try zip file. Might work even better.
Re:SQLite: 35% Faster Than the Filesystem by lanstin on Sunday January 15, 2023 @03:59AM (#34387944)
I would hate to see rename semantics in this case.
Re:SQLite: 35% Faster Than the Filesystem by becurious on Sunday January 15, 2023 @11:54AM (#34390832)
Zip stores all its metadata at the end of the file.
Re:SQLite: 35% Faster Than the Filesystem by karmakaze on Sunday January 15, 2023 @01:35PM (#34391753)
Whenever I have lots of files that need to go into a directory, I'll split into subdirs by prefix (or other partitioning scheme)--look in .git/objects for example.

Also be careful if the function that returns directory contents sorts results that you don't need done.