Large Block Size in HDFS! How is the unused space accounted for?

后端 未结 3 507
萌比男神i
萌比男神i 2020-12-04 19:59

We all know that the block size in HDFS is pretty large (64M or 128M) as compared to the block size in traditional file systems. This is done in order to reduce the percenta

3条回答
  •  囚心锁ツ
    2020-12-04 20:43

    In normal file system if we create a blank file, then also it holds the 4k size, as it is stored on the block. In HDFS it won't happen, for 1GB file only 1GB memory is used, not 4 GB. To be more clear.

    IN OS : file size 1KB, Block size : 4KB, Mem Used : 4KB, Wastage : 3 KB. IN HDFS : File size 1GB, Block Size: 4GB, Mem Used : 1GB, Wastage : 0GB, Remaining 3 GB are free to be used by other blocks.

    *Don't take numbers seriously, they are cooked up numbers to make point clear.

    If you have 2 different file of 1GB then there will be 2 blocks of 1 GB each. In file system if you storing 2 files of 1 KB each, then you will be having 2 different files of 4KB + 4KB = 8KB with 6KB wastage.

    SO this make HDFS much better than file system. But irony is HDFS uses local file system and in the end it ends up with the same issue.

提交回复
热议问题