← Back to Upcase

Distributed databases because of geographic latency


(Mike Munroe) #1

Scenario:
Web server and database running on a server in Boston.
There is a worldwide user base that accesses the site. Most users have typical page load speeds, but users in China experience heavy network latency.

My first thought to solve the problem is to install another server in one of our companies data centers in China that would run another web server and database instance. The URL for users in China or other parts of Asia would be something similar to asia.productname.com, so that traffic routes to the server based in China.

Part of this solution would require master/master replication of the databases. I have read mixed reviews of PostgreSQL support for master/master replication. I know MySQL supports master/master replication fairly well.

My question is if anyone on the forum has experience working with a similar set up?
Has anyone successfully set up PostgreSQL master/master replication? Were there major issues?
What about suggestions on other ways to deal with the latency problem, if any?*

*The product is mostly serving news and commentary that is updated very frequently throughout the day, so the database is very write heavy. I point that out in case someone wanted to suggest some caching strategies.


(Theodore Widom) #2

Hi Mike,

I just finished up a project for a company in Mainland China.

I can’t speak to your specific setup, since we just hosted everything inside China.

What I can say is that you are on the right track in wanting users in China to be served from inside China. However, IMO it’s probably the Great Firewall – not the geography – that is slowing things down the most.

So it’s not for sure that users elsewhere in Asia would benefit from being served from China, and I would test the actual speeds people elsewhere in Asia will get before you switch everyone over to the China server – it still might be faster for them to be served from the US.

I’d be interested to hear how you end up addressing this