How Wikipedia Deploy Openstack Swift

Openstack Swift 在 Wikipedia 的部署和使用

主要参考资料:

查看源代码:

Wikimeida NOC, Mediawiki 文件后端存储配置(包括 shard), Github version

Wikipedia 使用 swift 存储所有的多媒体数据,包括图片音频视频文档。其中 scalar 集群负责对图片,视频音频等根据需要进行 resize 或者格式转换。varnish 集群负责数据的cache。

In terms of raw bits on disk, the largest project is clearly the Wikimedia Commons, the free media repository integrated with all of the Wikimedia projects. In addition, many projects allow their own local media uploads. As a result, across all wikis, Wikimedia stores millions of images, sounds, and other media files.

Pasted from: http://blog.wikimedia.org/2012/02/09/scaling-media-storage-at-wikimedia-with-swift/

Swift 在 Wikipedia 的部署情况

wikipedia 现在的swift集群共有三个 swfit eqiad cluster, swift codfw cluster, swift esams cluster. 其中 esams cluster 是备份集群,用于同步 eqiad 集群中的内容。

在 cluster 中,可以使用机器的名字区分其角色,be 代表 storage 层(back end), fe 代表 proxy servers 集群(front end)。

There are currently (July 2014) two swift clusters running (esamsand eqiad). esams is used to sync files (manually) from eqiad every now and then (though it is currently pending expansion due to lack of disk space) whereas eqiad is in production to serve originals and thumbnails.

Pasted from: https://wikitech.wikimedia.org/wiki/Swift/Icehouse

各个 swift 集群的实时状态可以通过 ganglia 监控可以看到。

Wikipedia 考虑过使用 ceph 代替 swift,但是并没有成功。具体信息见:https://wikitech.wikimedia.org/wiki/Media_storage

Because of Swift’s certain limitations and in particular geographically-aware replication between datacenters which affected the eqiad migration, as well as certain Swift’s shortcomings with data consistency and performance, as of 2013 Ceph with its Swift-compatible layer (radosgw) is also being evaluated for the same purpose, with pmtpa running Swift and eqiad running Ceph and a final decision between the two to be taken in late 2013.

Pasted from: https://wikitech.wikimedia.org/wiki/Media_storage

Swift 中数据的组织方式

Wikipedia 最初是使用文件的方式存储数据的,这样就需要建立多层的目录结构,避免一个目录中包含过多的文件(目录相当于一张表,记录了目录下每个文件,文件名到 inode 的映射关系,这个表的规模过大会导致查表操作很耗时)。在对象存储系统中,数据的地址空间是平的,即,不存在多级目录,所有的对象都被放在 containers 内,但是当一个 container 内的对象过多时依然会出现同样的问题。因此还是需要对对象进行划分。

Wikipedia 组织数据的方式:

$wmfSwiftBigWikis = array( # DO NOT change without proper migration first
    'commonswiki', 'dewiki', 'enwiki', 'fiwiki', 'frwiki', 'hewiki', 'huwiki', 'idwiki',
    'itwiki', 'jawiki', 'rowiki', 'ruwiki', 'thwiki', 'trwiki', 'ukwiki', 'zhwiki'
);

Historically, files were put under directories on a filesystem and directories were sharded per wiki in a two-level hierarchy of 16 shards per level, totaling 256 uniformly sharded directories. On the Swift era, the hope was that such a sharding scheme would be unneeded, as the backend storage would handle such a complexity. This hope ultimately proved to be untrue and for certain wikis, the amount of objects per container is large enough that it created scalability problems on Swift. To address this issue, multiple containers were created for those large projects. These were shared into a flat (one level) 256 shards (00-ff), with the exception of the deleted zone that was sharded to 1296 shards (00-zz). The list of large projects that has sharded containers is currently defined in three places: a) MediaWiki’s $wmfSwiftBigWikis, b) Swift’s shard_container_list (proxy-server.conf, via puppet) and c) under the rewrite Varnish’s rewrite configuration in puppet.

Pasted from: https://wikitech.wikimedia.org/wiki/Media_storage

thumbnail image 请求的处理流程

First request for a thumbnail image

Category: Tags:
blog comments powered by Disqus