I have few VPS and Cloud servers across the globe and I am setting up a database of which will accessed by all servers.
When setting up my database, I will buy another VPS or Cloud server and host it near to the most busy server of all.
All servers have and serve the same content. So if my database server is in San Fransisco and I try to access it from my Romanian server, there will be a performance issue.
How do developers deal with this situations?
What is the best way to achieve a fair amount of performance in all servers? Is it better to host a database on a database-ready server? (Amazon RDS, Azure SQL) or host my own database server?
By all means, the pricing is an issue so the less expensive the better.
UPDATE:
Basically I have 8 servers and about to build 1 database server. Content on the database will be around 30KB maximum for each user but users can be up to 500,000. So the connections is not for a massive amount of data and not everytime the user visits the site will have a connection to the database. Its just I am not sure how slow it will be to and from the server. My question mainly is, what do people usually do. I do have a CDN and it is not what I am looking for. I use Akamai’s CDN but for a database, the charge what all my servers costs for 6 months.
Are you trying to build your own CDN to better serve main customer groups in two countries?
Lets say if you have two HTTP servers, one in San Fransisco and one in Bucharest. If you have both servers access the same DB server, there will still be latency issues between your HTTP servers and the DB server.
One way is to have two HTTP servers and two DB servers. One is a master server, and one is a slave server. The slave server is read-only, and write queries will be directed to the master server.
Another way is the cache the contents on your HTTP servers using memcached or other caching methods. Either way, you want to minimize having to make remote DB queries to a server further away.
Depending on your load, the easiest way might just be hosting in a third location that is good latency to both locations you are serving. For example, if you want to serve Asia and North America, then Tokyo or Hong Kong are good choices. Unfortunately I do not know what locations are suitable between North America and Europe. It will save you money and headache.
For static content, Amazon CloudFront is a good solution.