TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Twilio incident and Redis

188 pointsby flyingyetialmost 12 years ago

8 comments

zackmorrisalmost 12 years ago
What caught my attention was where Twilio said the redis-slaves were timing out to the redis-master:<p><a href="http://www.twilio.com/blog/2013/07/billing-incident-post-mortem.html" rel="nofollow">http:&#x2F;&#x2F;www.twilio.com&#x2F;blog&#x2F;2013&#x2F;07&#x2F;billing-incident-post-mor...</a><p>I think timeouts should be abolished for the vast majority of software today.<p>The usual reasoning goes something like this: for a TCP connection, if you don&#x27;t hear from the server for some period of time, you can assume that something is &quot;wrong&quot; and drop the connection. The fallacy is, the TCP connection is not really important to the shared state of two devices. From the very beginning (I&#x27;m talking 1970s!), devices should have been using tokens to identify one another, regardless of communication status. The tokens could be saved in nonvolatile memory on servers so that jobs could always continue where they left off.<p>Instead we have a whole slew of nondeterministic pathological cases -exactly- like the one that hit Twilio. If you take on the burden of timeouts, you end up with dozens of places in your code (even more, potentially) where you just don&#x27;t know what to do if you lose communication.<p>If you don&#x27;t take on the burden of timeouts, then you can just track each connection and all it costs you is storage space, which is practically free today and getting cheaper every year. With credentials from the client, you don&#x27;t even have to worry about duplicate connections. You can write your client-server code deterministically and stick to the logic, and easily stress test failure modes.
评论 #6100070 未加载
评论 #6101788 未加载
评论 #6100667 未加载
aidosalmost 12 years ago
Very clear and thoughtful post from antirez, as ever.<p>It&#x27;s worth reading his post on how persistence works in Redis (and other dbs). It&#x27;s very interesting and gives great insights as to what goes on down in dbs to try to keep our data safe - particularly for those of us how don&#x27;t ever interact with that layer directly.<p><a href="http://oldblog.antirez.com/post/redis-persistence-demystified.html" rel="nofollow">http:&#x2F;&#x2F;oldblog.antirez.com&#x2F;post&#x2F;redis-persistence-demystifie...</a>
eblumealmost 12 years ago
It&#x27;s good to see Twilio post this! That being said - yeah, I really am concerned that Twilio is using an ephemeral database to store such important data. Why not simply use Postgres? Is Twilio really making so many transactions per second that Postgres won&#x27;t scale?
评论 #6099517 未加载
评论 #6099578 未加载
评论 #6099599 未加载
评论 #6099494 未加载
评论 #6099897 未加载
评论 #6099532 未加载
评论 #6099970 未加载
评论 #6101611 未加载
评论 #6099518 未加载
mountaineeralmost 12 years ago
Here&#x27;s the Twilio post-mortem thread on HN: <a href="https://news.ycombinator.com/item?id=6093954" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6093954</a>
评论 #6099986 未加载
mbillie1almost 12 years ago
I&#x27;m curious if you&#x27;re using anything other than redis-cli to set the master&#x2F;slave relationships, and if you have any failover mechanism. I&#x27;ve used corosync&#x2F;pacemaker for a high-availability redis cluster, but without an awful lot of confidence (we likely misconfigured it, to be fair).<p>Just &quot;slaveof &lt;masterip&gt;&quot; and other redis-cli commands? Or are you using any automated process?<p>Or has anyone else got a great redis failover&#x2F;HA solution that they&#x27;d care to share?<p>(I apologize for this having nothing to do with Twilio; I&#x27;m just curious)
评论 #6102045 未加载
mountaineeralmost 12 years ago
Twilio definitely uses ec2, it&#x27;s been an oft-highlighted choice in many presentations and posts over the years.<p>- <a href="http://www.slideshare.net/twilio/twilio-voice-applications-with-amazon-aws-s3-and-ec2-presentation" rel="nofollow">http:&#x2F;&#x2F;www.slideshare.net&#x2F;twilio&#x2F;twilio-voice-applications-w...</a><p>- <a href="http://www.twilio.com/engineering/2011/04/22/why-twilio-wasnt-affected-by-todays-aws-issues/" rel="nofollow">http:&#x2F;&#x2F;www.twilio.com&#x2F;engineering&#x2F;2011&#x2F;04&#x2F;22&#x2F;why-twilio-wasn...</a>
Vitalyalmost 12 years ago
Just like I commented on the original incident report post, I think systems like Redis are not suitable to work as a db for payment processing and transaction storage. Reading through the report I can&#x27;t imagine something like this happening with a payment system built around Postgres. Not unless you are doing something incredibly stupid. And stupid those guys are not.<p>They are obviously bright guys meaning well, and yet they&#x27;ve designed and implemented payment system with such a bad failure mode.<p>I do understand that they have a LOT of billing events, and have to update customer billable amounts for each of them. But instead of holding the customer balances in Redis and doing payment processing on top of that, my paranoia would most probably lead me to only store &#x27;amount to charge&#x27; in Redis and update it as frequently as needed, and store customer balances and transactions in an RDBMS. And only change during actual charge event. This way, if Redis data were to be lost, I&#x27;d under-charge my customers and not over-double-tripple charge them. The failure mode becomes less disastrous.
评论 #6101279 未加载
MichaelGGalmost 12 years ago
I do not understand why, when updating a balance from a CC transaction, you wouldn&#x27;t be using transactions.<p><pre><code> Start Transaction Update Balances Call CC Processor Commit </code></pre> That would eliminate &quot;the billing system charged customer credit cards to increase account balances without being able to update the balances themselves&quot; -- you don&#x27;t go call a non-transactional CC processor until you&#x27;ve actually been able to process the update in your own system (which you can easily rollback).<p>If you&#x27;re worried about Commits failing (due to not using pessimistic locking, for instance), then separate it into two transactions. That way when you go to process the CC the next time, you have a record stating there&#x27;s already a transaction in-flight.<p>For financial records, I&#x27;d expect a bit more care. Sounds like they had proper records, but only as a backup&#x2F;logging.<p>(Even for telecom, in which I work. There are fully ACID databases that have no problems handling millions of transactions&#x2F;sec. In-flight balance information is trivial to handle.)
评论 #6101397 未加载
评论 #6100263 未加载