Jump to content

Multi-server setup


Recommended Posts

We have a multilingual e-commerce (12 languages) ready to combine into a multi-store system. In order to enhance page load times as well as to benefit from local IP addresses, we need to run the sites on 3 separate server locations across the globe (1 master and 2 slaves). Each store has the same inventory (250 categories, 25.000 products). Question is, will PrestaShop allow a multi-server setup based on MySQL replication? We would love to see this feature in one of the next versions.

Link to comment
Share on other sites

  • 1 year later...

Hi DH42, thanks for your answer.

How exactly would you setup such a thing? I have tested a mysql replication setup of the whole database on my localhost which was far to slow. I assume the whole result sets were transmitted between the two hosts and therefore a lot of traffic is generated. The only think I stumbled upon was Federated tables http://en.wikipedia....MySQL_Federated whiche might be worth a shot. From experience I only need to share product and customer(address and so on) tables which I realised with mysql views atm. But this only works if the different installations work on the same host with one db server. Another downside is, that the setup is hard to mantain (e.g. update installation). So if you have other solutions or expirience it would be nice to have new input on howto realize something like that prefomant.

Best regards, trip

Edited by Trip (see edit history)
Link to comment
Share on other sites

The easiest way that I can think of doing it is to get a couple dedicated servers, one for running mysql and one for your website compiled files. Then I would use something like cloudflare for serving your static files.

 

Running tests on your local machine is close to useless depending on what your machine is. I have a dedicated server, it has 32 cores running at 3.2 ghz 16 gig of ram and high speed sata drives. My work pc is a lot slower and runs a different operating system so its not really a comparison.

 

What kind of traffic numbers and transactions per day are you getting that makes you think you would need something like this?

  • Like 1
Link to comment
Share on other sites

Hi there,

thanks for your input.

I am already using cloudflare on one of my installations which is performing great e.g. in USA but compared to other websites which are hosted in my case in Thailand there is still remarkable network latency as my server is located in europe. If there is no easy way around I will use cloudflare with country tld to geotarget my websites but if possible I would prefer to host some installations in the targeted contries at least one for europe and one for asia to also profit from the thailand server ip.

As I said, the performance of a cloudlare setup is acceptable but not very well compared to servers located in thailand. Another way around might be to just host the static files here on a cheap webspace and keep files in sync with rsync,scp or stuff like that but it would not benefit from a country server ip and still network latency, dns resolving and so on might have negative impact.

I think I will start with a simple cloudflare setup but anyway when I was researching the question I and maybe other people are curious how to solve such problems and what is best practise to keep databases in sync over long distance server installations?

So some ideas sound good. I think I will have to make more benchmarks to see where exactly the bottlenecks(static files, dns, network latency) are and see if there are possible optimisations.

Best regards, Trip

Link to comment
Share on other sites

  • 1 year later...

The easiest way that I can think of doing it is to get a couple dedicated servers, one for running mysql and one for your website compiled files. Then I would use something like cloudflare for serving your static files.

 

Running tests on your local machine is close to useless depending on what your machine is. I have a dedicated server, it has 32 cores running at 3.2 ghz 16 gig of ram and high speed sata drives. My work pc is a lot slower and runs a different operating system so its not really a comparison.

 

What kind of traffic numbers and transactions per day are you getting that makes you think you would need something like this?

 

I ran across this and thought I'd share.  it's from rackspace but using cloud servers..

http://www.rackspace.com/knowledge_center/article/mysql-replication-masterslave

Link to comment
Share on other sites

Hi El Patron,

thanks for the input but I would second Dh42 now. There are lots of possilbilitis like fast DNS service, cdn etc.pp. die reduce latency.

Mysql replication is great but I think really for absolute "pros".

Afaik a master slave setup is complicated as you would have to take into account that you read the results from the slave but have to write your orders, customers, shopping carts on the master server. Otherwise they will not be present on every slave node. You could use a master-master setup but then you need to use a different autoincrement offsets.

 

If you are using master-slave replication, than most likely you will design your application the way to write to master and read from slave or several slaves. But when you are using master-master replication you are going to read and write to any of master servers. So, in this case the problem with autoincremental indexes will raise. When both servers will have to add a record (different one each server simultaneously) to the same table. Each one will assign them the same index and will try to replicate to the salve, this will create a collision. Simple trick will allow to avoid such collisions on MySQL server.

 

 From http://erlycoder.com/43/mysql-master-slave-and-master-master-replication-step-by-step-configuration-instructions-

 Bottom line.. I think this is far to complicated ;)

Greetz, Trip

Edited by Trip (see edit history)
Link to comment
Share on other sites

Hi El Patron,

thanks for the input but I would second Dh42 now. There are lots of possilbilitis like fast DNS service, cdn etc.pp. die reduce latency.

Mysql replication is great but I think really for absolute "pros".

Afaik a master slave setup is complicated as you would have to take into account that you read the results from the slave but have to write your orders, customers, shopping carts on the master server. Otherwise they will not be present on every slave node. You could use a master-master setup but then you need to use a different autoincrement offsets.

 From http://erlycoder.com/43/mysql-master-slave-and-master-master-replication-step-by-step-configuration-instructions-

 Bottom line.. I think this is far to complicated ;)

Greetz, Trip

 

after looking at this, I agree for the most part on legacy host this requires to much access and am surprised thatI did not see a api for hosting control panel..

 

but I did see how some cloud hosting solves this without having to set up the environment manually.

 

I was hoping for simple solution that might work for smaller business where we run two db's on same sever instead of two servers.

 

for anyone reading this, ps does support the reads on slave and even many modules have coded for it.

Link to comment
Share on other sites

Nice read DH42 although I would be carefull with the term "concurrent users".

Concurrent users without a time frame is not very accurate.

Anyway, I don't want to quarrel about that. I am more interested in - you recommend enabling apc in the performance settings. Do you have experience with that on a production server? The last time I've tested that I think I noticed that some values at least in the backend were not updated with APC user variables cache enabled possibly because the values we not flushed after update. Maybe this is fixed now but I did not want to risk it in on my live shop that such things happen.

Thanks in advance, Trip

Link to comment
Share on other sites

Concurrent means at once, like that is how many people are actively connected to the site in a session. Like here is a traffic shot of where I get the concurrent from, http://i.imgur.com/rQra1RF.png that, coupled with GA where you can see how many active poeple are on the site. Plus when you are load testing you can pick the number of active browsers viewing the site. 

 

As for the APC in production I have not had any issues with it. You can make apc not cache the backend by adjusting the configuration of it. 

  • Like 2
Link to comment
Share on other sites

  • 2 years later...
×
×
  • Create New...