建立有弹性的支付系统的10个提示

During the past five years I’ve worked on a lot of different parts of Shopify’s payment infrastructure and helped onboard dozens of developers in one way or another. Some people came from different programming languages, others used Ruby before but were new to the payments space. What was mostly consistent among new team members was little experience in building systems at Shopify’s scale—it was new for me too when I joined.

在过去的五年里,我在Shopify的支付基础设施的许多不同部分工作,并以这样或那样的方式帮助几十个开发人员加入。有些人来自不同的编程语言,有些人以前用过Ruby,但对支付领域很陌生。在新的团队成员中,最一致的是在Shopify这样的规模下,没有什么构建系统的经验--在我加入时,这对我来说也是新的。

It’s hard to learn something when you don’t know what you don’t know. As I learned things over the years—sometimes the hard way—I eventually found myself passing on these lessons to others. I distilled these topics into a presentation I gave to my team and boiled that down into this blog post. So, without further ado, here are my top 10 tips and tricks for building resilient payment systems.

当你不知道自己不知道什么时,就很难学到东西。随着我多年来学到的东西--有时是以艰难的方式--我最终发现自己把这些经验传给了别人。我把这些话题提炼成我给我的团队做的演讲,并把它归纳为这篇博文。因此,不再赘述,这里是我建立有弹性的支付系统的十大技巧和窍门。

1. Lower Your Timeouts

1.降低你的超时量

Ruby’s built-in Net::HTTP client has a default timeout of 60 seconds to open a connection to a server, 60 seconds to write data, and another 60 seconds to read a response. For online applications where a human being is waiting for something to happen, this is too long. At least there’s a default timeout in place. HTTP clients in other programming languages, like http.Client in Go and http.request in Node.JS don’t have a default timeout at all! This means an unresponsive server could tie up your resources indefinitely and increase your infrastructure bill unnecessarily.

Ruby内置的Net::HTTP 客户端有一个默认的超时时间,即60秒打开一个与服务器的连接,60秒写入数据,再60秒读取响应。对于有人在等待事情发生的在线应用来说,这太长了。至少有一个默认的超时时间。其他编程语言中的HTTP客户端,如Go中的http.Client 和Node.JS中的http.request ,根本就没有默认超时!这意味着一个没有反应的服务器可能会无限期地占用你的资源,并不必要地增加你的基础设施费用。

Timeouts can also be set in data stores. For example MySQL has the MAX_EXECUTION_TIME optimizer hint for setting a per-SELECT ...

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

ホーム - Wiki
Copyright © 2011-2024 iteam. Current version is 2.134.0. UTC+08:00, 2024-09-28 10:19
浙ICP备14020137号-1 $お客様$