1

独自のデータベース ストアを作成したい場合、特に「新しい」SSD に照らして、断片化とファイルシステムのオーバーヘッドを回避するには、ファイルのサイズをどのくらいにする必要がありますか?

たとえば、多くの 64 KB のファイルは問題ないでしょうか? それとも、ファイル (inode) エントリを驚くべき速さで使い果たしているのでしょうか?

巨大なファイルを使用して、64k バイトの境界内でのみアクセスする方がよいでしょうか?

(私は例として 64 キロバイトを使用しています。おそらく 4 キロバイトが魔法のサイズですか?また、私がとりとめのないことを言っているのか、それとも私の主張を伝えているのか教えてください。)

4

2 に答える 2

3

Good questions.

The flash in modern SSD is usually(!) structured as follows: A page size of 2K or 4K than can be written and 256K erase blocks. A page cannot be overwritten without erasing it before. But the erase operation only works on full erase blocks. However, each erase operations takes a long time (in contrast to other IO operations) and slowly wears out the SSD.

A component of the SSD controller called FTL (Flash Transition Layer) is used to provide the illusion of a HDD-like block device on the flash semantics. SSD can be used like HDD, but to get the most out of it (and to do it for a long time) a software IO design incorporating the knowledge of the storage works best.

However, the SSD controller logic is usually not known. So it might differ from SSD to SSD, but here are a few rules of thumb:

If possible I would align my IO pattern and the file sizes to full erase blocks (or a multiple of it). So writing a file of 256K uses a full erase block without any internal fragmentation. Smaller files like 64K would use only a portion of it. Writing data to the rest of the block might lead to a read-modify-write cycle. This means that the complete block is read, modified and then written to another location. Very expensive.

This is not a problem when the SSD is empty (because the controller has enough unused blocks), but may become an issue if the SSD is full and also heavily used. Or if IO pattern are usually very small writes and the SSD becomes fragmentated. So that the FTL has a harder time finding consecutive free flash pages.

As a side note: the system administrator should align the filesystem to the SSD erase block boundaries, it's really important.

于 2011-11-19T10:25:36.757 に答える
2

これは、最新のディスクのシステムのビューが物理デバイス上の実際の場所と一致しないため、さらに悪化します。最新のディスク (SSD と回転ディスクの両方) は、必要な場所にセクターを配置します。

SSD にはウェア レベリング機能があるため、セクター 27 はセクター 28 のどこにも近くない可能性があり、最初は「近く」にあったとしても、少し書き込みを行った後は近くにない可能性があります。さらに、もちろん、シーク時間がないため、SSD で「閉じる」という概念は奇妙な概念です。

デザインが同じくらいシンプルで、大きなファイルが少ない場合は、ファイルがたくさんあるデザインを敬遠します。一方、単一の大きなファイル内のブロックへのマッピングを行うために、ファイル システムに相当するものを自分で作成していることに気付いた場合は、問題に非常に特殊な機能がない限り、常に時間を利用して考えたほうがよいでしょう。これは、既存のファイル システム設計に組み込まれています。

于 2011-11-18T09:37:44.887 に答える