Is Twitter causally-consistent?
For the past 7-8 years, several research papers have used this example to motivate causal consistency. You must have read this example, right?
Well, being the empirical researchers we are, Aleksey and I wanted to put Twitter in to test for this scenario.
On September 25, we performed this test. (I also have a video recording of this. But since I can't stand to hear myself talk in recordings, I am not posting it. I sound really weird, man.)
I first blocked Aleksey on my Twitter account, and then tweeted that Aleksey drinks a lot of tea (it's true). When we checked Aleksey's timeline, we saw that his timeline indeed did not display my tweet.
Well, maybe not quite. Maybe this was because Aleksey and I were in the same region and our accounts fall in to the same datacenter. We thought maybe we should repeat the test with Aleksey connected to Twitter via a proxy, but then since Aleksey's laptop was away that day, we decided to test this at another time. (Maybe we should find someone from another region and arrange a cross-continental Twitter causality test this time.)
Anyways, this story gets more interesting. Keep reading.
I unblocked Aleksey, and Aleksey checked that he was following me again, and we called it a day.
But a couple days later, I was tweeting something and wanted to include a mention to @AlekseyCharapko in my tweet. But Twitter didn't autocomplete for me. I finally found his account after some searching on Twitter, and saw that Aleksey is not following me. What!? My student doesn't follow me on Twitter? Impossible. I showed this to Aleksey and he was also caught by surprise.
We then remembered about the Twitter test we did a couple days ago.
It must be that although I unblocked Aleksey after our test, a nightly batch job blocked him from my account and made his account unfollow me.
Reality is often stranger than the clean models we have. Real systems have a lot of back channels and processes.
There was discussion on this at Hacker News.
I don't know what happened after that which made his account unfollow mine again. It might be that since my tweet included a mention to him, Aleksey clicked on the notification and could see my tweets after that, and not in his timeline. We repeated the experiment, and found that after I blocked and unblocked him, he was indeed still unfollowing me.
1) What is the right way to test this?
Sending two consecutive tweets from one account and monitoring from another does not seem sufficient to test causal-consistency to me. The tweets are likely partitioned with the user_id, and so just session consistency or per-key ordering would give the impression of causal consistency, right?
To offset for this, we tried another test, where I tweet something, Ailidani reads it and presses the button on his drafted tweet, and Aleksey checks his feed for the result. It was no contest again. Twitter is so fast that it displayed my tweet on Aleksey's timeline immediately and Ailidani's tweet didn't stand a chance.
(Another thing to note for completeness. Under content preferences, we disable the "show me the best tweets first" to get a time ordered tweet stream.)
2) Where would you put your money?
So let's say we set up this 3-person cross continental Twitter causal consistency test. Where would you put your money on?
Can we infer something from what we know of Twitter architecture? This is a good start for reasoning. But again, in our 3 person test, per-key/object ordering does not help.
- Alice removes her boss from her friend list, and posts that on her feed that she is looking for a new job.
- Tom removes his mom from the friend list, and posts his Spring Break photos.
Well, being the empirical researchers we are, Aleksey and I wanted to put Twitter in to test for this scenario.
On September 25, we performed this test. (I also have a video recording of this. But since I can't stand to hear myself talk in recordings, I am not posting it. I sound really weird, man.)
I first blocked Aleksey on my Twitter account, and then tweeted that Aleksey drinks a lot of tea (it's true). When we checked Aleksey's timeline, we saw that his timeline indeed did not display my tweet.
So, this was kind of an anticlimax. Twitter passed the causal-consistency test easily. No need to publish more causal-consistency papers, right?@alekseycharapko drinks way too much tea.— Murat Demirbas (@muratdemirbas) September 25, 2018
Well, maybe not quite. Maybe this was because Aleksey and I were in the same region and our accounts fall in to the same datacenter. We thought maybe we should repeat the test with Aleksey connected to Twitter via a proxy, but then since Aleksey's laptop was away that day, we decided to test this at another time. (Maybe we should find someone from another region and arrange a cross-continental Twitter causality test this time.)
Anyways, this story gets more interesting. Keep reading.
I unblocked Aleksey, and Aleksey checked that he was following me again, and we called it a day.
But a couple days later, I was tweeting something and wanted to include a mention to @AlekseyCharapko in my tweet. But Twitter didn't autocomplete for me. I finally found his account after some searching on Twitter, and saw that Aleksey is not following me. What!? My student doesn't follow me on Twitter? Impossible. I showed this to Aleksey and he was also caught by surprise.
We then remembered about the Twitter test we did a couple days ago.
It must be that although I unblocked Aleksey after our test, a nightly batch job blocked him from my account and made his account unfollow me.
Reality is often stranger than the clean models we have. Real systems have a lot of back channels and processes.
MAD questions
0) Some clarification on this from someone at TwitterThere was discussion on this at Hacker News.
Here is the video segment that shows that after I unblocked Aleksey, he was able to see my tweets in his timeline.
This was after the Twitter test.— Murat Demirbas (@muratdemirbas) November 14, 2018
I unblocked @AlekseyCharapko and he was able to see my tweet which was obscure to his timeline when I blocked him. pic.twitter.com/idCx6qvuJz
1) What is the right way to test this?
Sending two consecutive tweets from one account and monitoring from another does not seem sufficient to test causal-consistency to me. The tweets are likely partitioned with the user_id, and so just session consistency or per-key ordering would give the impression of causal consistency, right?
To offset for this, we tried another test, where I tweet something, Ailidani reads it and presses the button on his drafted tweet, and Aleksey checks his feed for the result. It was no contest again. Twitter is so fast that it displayed my tweet on Aleksey's timeline immediately and Ailidani's tweet didn't stand a chance.
(Another thing to note for completeness. Under content preferences, we disable the "show me the best tweets first" to get a time ordered tweet stream.)
2) Where would you put your money?
So let's say we set up this 3-person cross continental Twitter causal consistency test. Where would you put your money on?
Can we infer something from what we know of Twitter architecture? This is a good start for reasoning. But again, in our 3 person test, per-key/object ordering does not help.
Underlying storage (Manhattan) supports sequential ordering of per-object updates and they fan-out writes to per-user timelines. And it makes sense to do, so probably yes. https://t.co/zNca2y6Xxa— Andrey Satarin (@asatarin) November 13, 2018
Anecdotally, I've never observed causality violation in twitter timelines.
Comments