glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

Distribute files by size in different bricks

Open PHD59fr opened this issue 9 years ago • 4 comments

Hello, I don't know if a functionality exists:

Volume Name: disk Type: Distribute Volume ID: XXXXXXXXXXXXXXXXX Status: Started Snapshot Count: 0 Number of Bricks: 4 Transport-type: tcp Bricks: Brick1: 192.168.1.1:/home/disk Brick2: 192.168.1.2:/home/disk Brick3: 192.168.1.3:/home/disk Brick4: 192.168.1.4:/home/disk Options Reconfigured: transport.address-family: inet nfs.disable: on

Network Details: Brick1 Bandwidth 1Gbps Brick2 Bandwidth 100Mbps Brick3 Bandwidth 100Mbps Brick4 Bandwidth 1Gbps

Functionality:

My desk is 192.168.1.5,

I mount the volume with 'mount -t glusterfs 192.168.1.1:storage /disk'

It works perfectly but without size distribution, to manage the restriction of network bandwidth, I would like to be able to distribute the files with the following configuration:

for file size < 2GB the file can go only on Brick2 or Brick3, if Brick2 and Brick3 are full, then it can go in Brick1 or Brick2 for file size >= 2GB the file can go only on Brick1 or Brick4, if Brick1 and Brick4 are full, then it can go in Brick2 or Brick3

Does this feature exist ? If so, what is the configuration to apply ?

PHD59fr avatar Jul 17 '17 01:07 PHD59fr

In gluster file distribution among the bricks is handles by the distribute xlator. And as of now, the file distribution happens based on the hashing algorithm. I.e, the hash range is distributes among the existing bricks. A file that gets created will be hashed to one of the bricks and will be placed there. The hash value is calculated using the file name.

So, IIUC, distribution of file based on the file name is not there in the current distribute logic (Distrubute xlator's developers or/and maintainers might be able to give a better picture). Also note that, when a file is created, distribute wont know the size to which the file can grow. Files are created and then via write () call, they are modified (or appended).

From your description, it looks like you expect the files to be created by default in bricks brick2 or brick3 and later once they become bigger than 2GB, they will have to be migrated to brick1 or brick4. IIUC, such mechanism is not there yet. Someone from Distribute xlator area might be able to confirm it.

On Sun, Jul 16, 2017 at 9:04 PM, PHD [email protected] wrote:

Hello, I don't know if a functionality exists:

Volume Name: disk Type: Distribute Volume ID: XXXXXXXXXXXXXXXXX Status: Started Snapshot Count: 0 Number of Bricks: 4 Transport-type: tcp Bricks: Brick1: 192.168.1.1:/home/disk Brick2: 192.168.1.2:/home/disk Brick3: 192.168.1.3:/home/disk Brick4: 192.168.1.4:/home/disk Options Reconfigured: transport.address-family: inet nfs.disable: on

Network Details: Brick1 Bandwidth 1Gbps Brick2 Bandwidth 100Mbps Brick3 Bandwidth 100Mbps Brick4 Bandwidth 1Gbps

Functionality:

My desk is 192.168.1.5,

I mount the volume with 'mount -t glusterfs 192.168.1.1:storage /disk'

It works perfectly but without size distribution, to manage the restriction of network bandwidth, I would like to be able to distribute the files with the following configuration:

for file size < 2GB the file can go only on Brick2 or Brick3, if Brick2 and Brick3 are full, then it can go in Brick1 or Brick2 for file size >= 2GB the file can go only on Brick1 or Brick4, if Brick1 and Brick4 are full, then it can go in Brick2 or Brick3

Does this feature exist ? If so, what is the configuration to apply ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gluster/glusterfs/issues/267, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmAbFDI0tcx9UZNO0CWM3gGYo4eqGq_ks5sOrMcgaJpZM4OZePb .

raghavendrabhat avatar Jul 17 '17 03:07 raghavendrabhat

From your description, it looks like you expect the files to be created by default in bricks brick2 or brick3 and later once they become bigger than 2GB, they will have to be migrated to brick1 or brick4. IIUC, such mechanism is not there yet. Someone from Distribute xlator area might be able to confirm it.

The file does not move after it has been stored for the first time. Thank for your reply ;)

PHD59fr avatar Jul 17 '17 07:07 PHD59fr

for file size < 2GB the file can go only on Brick2 or Brick3, if Brick2 and Brick3 are full, then it can go in Brick1 or Brick2 for file size >= 2GB the file can go only on Brick1 or Brick4, if Brick1 and Brick4 are full, then it can go in Brick2 or Brick3

File size is not known during file creation, which is where the hashing algorithm works, by hashing the name to a DHT subvolume and creating the file there.

In the scheme proposed, how will DHT (or the distribution xlator) know the size before hand, i.e when the file is created? Are there hints that can be passed down to this layer during the create (which assumes non-POSIX app, or app written with gfapi)?

What I mean in typical C+POSIX calls would be,

fd = creat(<pathname>, <mode>);
...
retbytes = write(fd, <buf>, <count>); // or variants of write (pwrite/writev)

ShyamsundarR avatar Jul 17 '17 15:07 ShyamsundarR

On Mon, Jul 17, 2017, at 11:58 AM, Shyam wrote:

for file size < 2GB the file can go only on Brick2 or Brick3, if Brick2 and Brick3 are full, then it can go in Brick1 or Brick2>> for file size >= 2GB the file can go only on Brick1 or Brick4, if Brick1 and Brick4 are full, then it can go in Brick2 or Brick3> File size is not known during file creation, which is where the hashing algorithm works, by hashing the name to a DHT subvolume and creating the file there.> In the scheme proposed, how will DHT (or the distribution xlator) know the size before hand, i.e when the file is created? Are there hints that can be passed down to this layer during the create (which assumes non-POSIX app, or app written with gfapi)?> What I mean in typical C+POSIX calls would be,

fd = creat(, ); ... retbytes = write(fd, , ); // or variants of write (pwrite/writev) If the application could use fallocate, there might be a way to get the desired effect. If the user knows what the file size is going to be, and can do an fallocate right after the open (create), then relocating while the file's still zero-length might be cheap enough to be worth it. I'll also point out that sharding might have a role to play here. With sharding, large files are no longer distributed only to one subvolume, so any hotspot problems associated with those files should already be ameliorated.

jdarcy avatar Jul 17 '17 21:07 jdarcy