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.

Scaling Bitbucket’s Database

86 pointsby WalterSobchakover 5 years ago

16 comments

adamfeldmanover 5 years ago
"Bitbucket uses PostgreSQL with one primary read-write database and N read-only replicas."
hinkleyover 5 years ago
I am architecting a project that is at a smaller scale but bears some resemblance, and I’ve already settled that I will be very careful about GET vs POST&#x2F;PUT semantics and route all traffic of the former only to the replicas and all of the latter through a connection pool to the primary. That, I expect, will hold me well into &gt;1% of their traffic.<p>I’m not sure if I’ve missed something with their LSN work or if this indicates that the GET semantics horse has already escaped their proverbial barn. Within the call-response of a single request, which they seem to be talking about, none of this should be necessary. Right?<p>However a cascade of narrowly-spaced follow-up requests could easily catch you in this trick. Lie. Whatever you wish to call it.
cryptonectorover 5 years ago
Bitbucket is a perfect case for sharding. You could have one DB of users, and N DBs of user data, with the first referencing the latter, and then distribute user data among the latter. You could do this straight up with PostgreSQL without any special server-side software. You could also have a PG server using FDW to act as a proxy for all the DBs a client needs to be talking to. There are many other options too.
zzzeekover 5 years ago
Bitbucket (mostly via Atalassian) worked very hard to chase everyone off their platform in the vain hopes that the OSS community would start using Jira. Clearly they bet wrong, but unfortunately they aren&#x27;t going to get any users back for a very long time.
评论 #22338956 未加载
评论 #22338495 未加载
评论 #22337722 未加载
评论 #22338014 未加载
caseyf7over 5 years ago
Does storing the LSNs in Redis and Elasticache create the same race condition they are trying to avoid or am I missing something?
nihil75over 5 years ago
Yea I&#x27;m not taking advice from a service that&#x27;s down once a week
评论 #22337420 未加载
rosstafarian0over 5 years ago
Is it just me or does looking at write logs to determine read consistency just seem like a really bad way to do this vs a different load balancing strategy?
评论 #22339015 未加载
评论 #22339857 未加载
ykevinatorover 5 years ago
It&#x27;s amazing that Atlassian still exists.
lykr0nover 5 years ago
Curious that they use LSN tracking vs making the replication synchronous. I would be curious to see the performance numbers and the reasoning behind the choice.
评论 #22337629 未加载
saga92over 5 years ago
Oracle offers DML redirection for active dataguard setup where a write operation on the replica database is redirected to the primary database to allow applications that make infrequent writes to actively run on the Active Data Guard replica database. Also the write operation completes when the replica has seen the write from the primary thereby eliminating the race condition avoiding such complex reengineering
评论 #22338850 未加载
loic-sharmaover 5 years ago
That&#x27;s really neat! I wonder, could you store the PostgreSQL log sequence numbers in a cookie to save the round-trip to Redis?
评论 #22338729 未加载
halestockover 5 years ago
I found it interesting that their cloud version of bitbucket uses Django while their self-hosted stack is almost entirely Java.
评论 #22338994 未加载
sedatkover 5 years ago
Step 1: Remove Mercurial support.
ngrillyover 5 years ago
&gt; we find a replica that is as up to date as the user&#x27;s saved LSN<p>The article doesn&#x27;t explain how they know the current LSN of each replica?
评论 #22339378 未加载
qeternityover 5 years ago
10ms to do a redis get? What am I missing here...
评论 #22337905 未加载
评论 #22339384 未加载
doubleunplussedover 5 years ago
Still salty about them dropping mercurial support without providing any migration tools, and planning to just delete data without any archiving.
评论 #22338417 未加载
评论 #22338561 未加载
评论 #22337416 未加载