"Perhaps the buffer should be dynamically set based on the size of the directory entry file"
This would eliminate the readdir() bottleneck.
51–60 of 93 posts
"Perhaps the buffer should be dynamically set based on the size of the directory entry file"
This would eliminate the readdir() bottleneck.
Excellent case for not giving root.
What does root have to do with this?
The premise of the article is a bad precedent for stable environments: let's bend the OS so that it plays nicely with what's clearly misuse and misunderstanding of filesystems.
The only way eight million files should ever end up in a single directory level is by accident, and that's not the case in the scenario outlined here.
Putting eight million files in one directory level aside, the whole basis for this event - using the filesystem as a storage layer for a k/v 'database' - is just twisted.
Happy not to be working with devs like this.
Earlier quoted context omitted.
What does root have to do with this?
Article illustrates numerous manner of ways of doing things incorrectly. The premise of the article is a bad precedent for stable environments: let's bend the OS so that it plays nicely with what's clearly misuse and misunderstanding of filesystems. The only way eight million files should ever end up in a single directory level is by accident, and that's not the case in the scenario outlined here.
http://blogs.perl.org/users/randal_l_schwartz/2011/03/perl-t...
Really surprised by all the high-fiving and positive excitement going on about this article. Putting eight million files in one directory level aside, the whole basis for this event - using the filesystem as a storage layer for a k/v 'database' - is just twisted. Happy not to be working with devs like this.
Sure, you can find out a lot by doing things you really shouldn't do, like using the directory system as k/v store.
But in the end, you should still learn the lesson that it is really a bad idea.
I suspect the author is incorrect in his claim that reading in 32k chunks is responsible for the slowness. Due to read ahead and buffering, Unix-like systems tend to do reasonably well on small reads. Yes, big reads are better, but small reads are not unreasonably slow. To test this, he should try "ls | cat". On large directories that often runs many orders of magnitude faster than "ls". This is because, I believe, l…
Running /bin/ls will bypass the alias.
The author has a great tip for kernel/filesystem developers: "Perhaps the buffer should be dynamically set based on the size of the directory entry file" This would eliminate the readdir() bottleneck.
I suspect the author is incorrect in his claim that reading in 32k chunks is responsible for the slowness. Due to read ahead and buffering, Unix-like systems tend to do reasonably well on small reads. Yes, big reads are better, but small reads are not unreasonably slow. To test this, he should try "ls | cat". On large directories that often runs many orders of magnitude faster than "ls". This is because, I believe, l…
The original onus for the post was python's os.listdir() which as far as I know doesn't stat(). ls, just made the blog post more interesting :-). I was surprised that the 32K reads were taking so long. It's possible since it was on a virtualized disk ("in the cloud") that something else was slowing down disk IO (like Xen). But I can assure you that a larger read buffer performed much better in this given scenario. I'…
>>> "Don’t be afraid to compile code and modify it" I was a bit thrown by this advice. Are there folks out there that are afraid to compile code and modify it?
Some developers (myself included) may have a general preference for sticking with the "official" packages to avoid extra work when bringing up a new machine or migrating to a new distro version.