碎片平衡。在Terabyte规模的情况下以零停机时间自信地移动商店

Shopify’s infrastructure supports over 1.7 million merchants during their entrepreneurship journey. A key component of the current infrastructure is the underlying fleet of MySQL database shards that together persist every shops’ critical data. As traffic patterns change and new merchants onboard onto the platform, it’s possible that resource intensive shops end up living in the same shards. Certain database shards become unbalanced in their database utilization, shop traffic, and load. It’s important to ensure the shards remain well-balanced to mitigate risk of database failure, improve productivity of the wider infrastructure, and ultimately guarantee buyers can always access their favorite shops. This post explains how we’re able to balance our MySQL shards by migrating shops across shards—entirely online and with virtually zero consumer-facing downtime.

Shopify的基础设施支持超过170万商家的创业历程。当前基础设施的一个关键组成部分是MySQL数据库的底层分片,这些分片共同保存着每个商店的关键数据。随着流量模式的变化和新的商户加入平台,资源密集型的商店有可能最终生活在相同的分块中。某些数据库分片在其数据库利用率、商店流量和负载方面变得不平衡。重要的是要确保分片保持良好的平衡,以减少数据库故障的风险,提高更广泛的基础设施的生产力,并最终保证买家能够始终访问他们最喜欢的商店。这篇文章解释了我们如何通过在各分片之间迁移商店来平衡我们的MySQL分片--完全是在线的,而且几乎没有面向消费者的停机时间。

A Brief Overview of Shopify’s Current Architecture

Shopify当前架构的简要概述

To fully understand shard balancing, it helps to briefly review Shopify’s architecture. Shopify’s application runtime is currently podded: the infrastructure is composed of many pods (not to be confused with Kubernetes Pods). A pod is an isolated instance of Shopify consisting of an individual MySQL database shard, along with other datastores like Redis and Memcached. Every pod houses a unique subset of shops on the platform. Web requests for shops are processed by a load balancer that consults a routing table and forwards the request to the correct pod based on the shop.

为了充分理解分片平衡,简单回顾一下Shopify的架构是有帮助的。Shopify的应用程序运行时间目前是poded的:基础设施是由许多pod(不要与Kubernetes Pods混淆)组成。一个pod是一个孤立的Shopify实例,由一个单独的MySQL数据库分片,以及其他数据存储,如Redis和Memcached组成。每个pod都是平台上的一个独特的商店子集。对商店的网络请求由负载平衡器处理,该负载平衡器查询路由表并根据商店将请求转发到正确的pod。

Shopify’s application runtime is split into multiple pods. Each pod contains its own MySQL shard. Here, a sample request to coolcucumbers.com is processed by a load balancer and forwarded to Pod 42. Pod 42 contains all the data required to serve traffic for Cool Cucumbers.

Shopify’s application ...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2024 iteam. Current version is 2.125.2. UTC+08:00, 2024-05-19 09:37
浙ICP备14020137号-1 $访客地图$