0

Would you explain me how is possible to set up a configuration like this (example) (LAMP):

  1. 1 Main server (in europe for example) with database, static files, php, etc.
  2. Other servers in others continents (reducing network time)

    • site.fr, site.de, site.co.uk etc would be pointed to the ip of the Europe server
    • site.jp etc would be pointed to the Asian server

Considering the code and the database are the same for all servers which is the best way to have this without having to manually dump every day the database of the "satellite" server?

(And there is an hosting company where you can choose the localization of servers?)

Thanks a lot for every suggestions

dynamic
  • 740
  • 6
  • 17
  • 32

1 Answers1

1

Hmmm. You can do that in many ways, the top one I think right now are caching and replication.

  • Caching would allow your localized servers to cache content and serve it faster for the near clients. You main server would still get the bulk of the dynamic stuff but with a good caching you can offload most of the static content to the satellite servers.
  • Replication is the technique to keep data automatically synchronized between servers. It works better between servers on the same lan segmento or close enough to have a good speed, but you can check and see if it works for you. You can use rsync or drbd to sync php or static data between the servers and use the MySQL replication features to keep the DB synchronized.

Particularly I would go for a strong caching/static replication, or maybe caching + DB replication having the satellite servers be read only and make all update to data to be performed on the main server. Little complex, but very scalable. There are other techniques like caching result pages (result from dynamic pages) that also can be used to improve the infrastructure.

EDIT: Good article about memcached and mysql.

coredump
  • 12,713
  • 2
  • 36
  • 56
  • `Caching would allow your localized servers to cache content and serve it faster for the near clients.` How my localized server can cache content if all the datas are on the main server? Please be specific (and consider I am not talking on how to speed up the dynamic page load time, I need synch between satellite servers) – dynamic Mar 09 '11 at 14:07
  • I was talking about the non-dynamic part of the site, but you can cache the result of dynamic pages for some minutes on the satellite servers. Like for 5 to 10 minutes, but to do that you need a way to cache it correctly (I think `memcached` has something like it) and a way to deal with validation of the data. – coredump Mar 09 '11 at 14:19
  • I have already a chacing system on my main server that's not worries me and isn't really a topic of this questions – dynamic Mar 09 '11 at 14:22
  • Not really. You want a solution to make *satellite* sites serve stuff from the main server faster. If you cache the content (including the dynamic generated one) on the *satellite* servers you will be effectively serving data from the main server, faster. You can use sync and make various distributed servers that mirror your first, and that has good and bad sides, as well as the caching solution. I am just showing you my ideas. – coredump Mar 09 '11 at 14:27
  • `You want a solution to make satellite sites serve stuff from the main server **faster**` Actually I am asking something that is behind this.. How to sync those satellite servers with my main.. the cache part comes after this. – dynamic Mar 09 '11 at 14:31
  • And I am telling you that if you cache your entire site, including the results/dynamic pages, you don't need to sync it :) But if you really want, my answer includes drbd, rsync and mysql replication as sync solutions – coredump Mar 09 '11 at 14:33
  • @yes123 what @coredump is saying is, cache the content from the main server *on the localized servers* so that when visitors pull the content they get it from a local server. This is the basis of how many services from providers like Akamai work, and *is* a good solution to the question you're asking. Not the only one, but it is not off topic. – Josh Mar 09 '11 at 14:33
  • @both: ok so do you mean: the localized server for each local request will forward the request to main server (over standard internet) then it will cache the results. Basically on this solution i don't need even to install a db (maybe neither php)? Do i got it right? – dynamic Mar 09 '11 at 14:40
  • That's correct @yes123 – Josh Mar 09 '11 at 14:44
  • which solution could you suggest for it? And how to manage the generic updates that could come in? TTL? – dynamic Mar 09 '11 at 15:00
  • @yes updates go to the main server and invalidate data on the cache so new requests get fresh data. Or you can define that information can be out of sync for a TTL and force invalidations after that time. It depends on your app. – coredump Mar 09 '11 at 15:08