Io 在谷歌云上存储许多小图像以快速批量访问的选项?

Io 在谷歌云上存储许多小图像以快速批量访问的选项?,io,google-cloud-platform,Io,Google Cloud Platform,我们有一些小图像的数据集,每个图像大约100KB,每个数据集大约有50K个图像(每个数据集大约5GB)。我们通常使用这些数据集将每个图像以增量方式批量加载到googlevm实例的内存中,以便执行机器学习研究。这是每天做几次 目前,我们中的一些人都将自己的Google永久磁盘连接到VM,并在每个虚拟机上复制数据集。这并不理想,因为它们价格昂贵,然而,数据访问速度非常快,这使我们能够相当快地重复我们的研究。我们不共享一个磁盘,因为在共享时必须使用Google磁盘管理读/写设置,这给我们带来了不便 是

我们有一些小图像的数据集,每个图像大约100KB,每个数据集大约有50K个图像(每个数据集大约5GB)。我们通常使用这些数据集将每个图像以增量方式批量加载到
googlevm
实例的内存中,以便执行机器学习研究。这是每天做几次

目前,我们中的一些人都将自己的Google永久磁盘连接到VM,并在每个虚拟机上复制数据集。这并不理想,因为它们价格昂贵,然而,数据访问速度非常快,这使我们能够相当快地重复我们的研究。我们不共享一个磁盘,因为在共享时必须使用Google磁盘管理读/写设置,这给我们带来了不便


是否有另一个
googlecloud
选项来处理此用例
googlebucket
速度太慢,因为它正在读取许多小文件

如果您的主要兴趣是快速I/O,那么出于显而易见的原因,您最好使用SSD。我不明白的是为什么你不想共享一张磁盘。您可以将一个SSD作为R/W连接到一个实例,用于加载和修改数据集,并将其以只读方式装载到需要获取数据的实例

不过,我不确定这个解决方案比使用桶快多少。我想您应该知道有一个多线程传输选项,它可以成倍地提高数据传输速度,特别是在传输大量小文件时?该标志为
-m

 -m           Causes supported operations (acl ch, acl set, cp, mv, rm, rsync,
              and setmeta) to run in parallel. This can significantly improve
              performance if you are performing operations on a large number of
              files over a reasonably fast network connection.
              gsutil performs the specified operation using a combination of
              multi-threading and multi-processing, using a number of threads
              and processors determined by the parallel_thread_count and
              parallel_process_count values set in the boto configuration
              file. You might want to experiment with these values, as the
              best values can vary based on a number of factors, including
              network speed, number of CPUs, and available memory.  

              Using the -m option may make your performance worse if you
              are using a slower network, such as the typical network speeds
              offered by non-business home network plans. It can also make
              your performance worse for cases that perform all operations
              locally (e.g., gsutil rsync, where both source and destination
              URLs are on the local disk), because it can "thrash" your local
              disk.  

              If a download or upload operation using parallel transfer fails
              before the entire transfer is complete (e.g. failing after 300 of
              1000 files have been transferred), you will need to restart the
              entire transfer.  

              Also, although most commands will normally fail upon encountering
              an error when the -m flag is disabled, all commands will
              continue to try all operations when -m is enabled with multiple
              threads or processes, and the number of failed operations (if any)
              will be reported at the end of the command's execution.
如果您想使用带有R/W SSD和多个只读客户端的实例,请参见以下内容:

一个选项是在SSD上设置NFS,一个实例将充当具有R/W权限的NFS服务器,其余实例将仅具有读取权限。我将使用Ubuntu16.04,但在所有发行版中的过程都是类似的:

1-在服务器和客户端上安装所需的软件包:

Server: sudo apt install nfs-kernel-server 
Client: sudo apt install nfs-common 
2-将磁盘SSD磁盘安装到服务器上(将其格式化到要使用的文件系统后):

Server: sudo apt install nfs-kernel-server 
Client: sudo apt install nfs-common 
服务器:

jordim@instance-5:~$ lsblk 
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb      8:16   0  50G  0 disk  <--- My extra SSD disk
sda      8:0    0  10G  0 disk 
└─sda1   8:1    0  10G  0 part /

jordim@instance-5:~$ sudo fdisk /dev/sdb
jordim@instance-5:/mount/share$ touch test
现在在服务器上配置导出。添加要共享的文件夹和客户端的专用IP。您还可以在此处调整权限,使用“ro”表示“只读”,或使用“rw”表示读写权限

jordim@instance-5:/mount$ sudo vim /etc/exports 
(请注意,在导出文件中,IP是客户端实例的私有IP):

现在在服务器上启动nfs服务:

root@instance-5:/mount# systemctl start nfs-server
现在要在客户端上创建装入点:

jordim@instance-4:~$ sudo mkdir -p /nfs/share
并装入文件夹:

jordim@instance-4:~$ sudo mount 10.142.0.6:/mount/share /nfs/share
现在让我们测试一下:

服务器:

jordim@instance-5:~$ lsblk 
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb      8:16   0  50G  0 disk  <--- My extra SSD disk
sda      8:0    0  10G  0 disk 
└─sda1   8:1    0  10G  0 part /

jordim@instance-5:~$ sudo fdisk /dev/sdb
jordim@instance-5:/mount/share$ touch test
客户:

jordim@instance-4:/nfs/share$ ls
test
另外,请参见支架:

jordim@instance-4:/nfs/share$ df -h
Filesystem               Size  Used Avail Use% Mounted on
udev                     1.8G     0  1.8G   0% /dev
tmpfs                    370M  9.9M  360M   3% /run
/dev/sda1                9.7G  1.5G  8.2G  16% /
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    5.0M     0  5.0M   0% /run/lock
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    370M     0  370M   0% /run/user/1001
10.142.0.6:/mount/share   50G   52M   47G   1% /nfs/share

好了,现在您只有一个具有r/w磁盘的实例和任意多个具有只读权限的客户端。

我对持久SSD的理解是,它们只能全部以只读方式装入,或者只有一个可以以r/w方式装入。假设您有3个用户。我一刻也不认为你可以将一个R/W和另外两个R/W同时安装为只读。
jordim@instance-5:/mount$ sudo vim /etc/exports