N02SRT Posted August 22, 2014 Share Posted August 22, 2014 Hi all, I was browsing prestashop directory, and came accross this file: config/db_slave_server.inc.php Does this file allow you to specify a read only server for database replication? If not what does it do? I have tried googling it, and have found no results. Thanks in advanced! -Steve Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 Anyone? Link to comment Share on other sites More sharing options...
El Patron Posted August 22, 2014 Share Posted August 22, 2014 this turns out to be much more complicate than in my opionion is necessary, and not at the ps level. This requires another server with mysql sync, the slave would be your read only. ps core and modules is designed to use slave for reads in certain areas. for starters you can learn more here http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html rackspace article for cloud http://www.rackspace.com/knowledge_center/article/mysql-master-master-replication who then tell us easier to use cloud http://www.rackspace.com/cloud/databases/ tip: there are many cloud services that will offer this feature...so look to the cloud, stay away from legacy. Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 El Patron, First off thank you for replying. I understand the need for multiple servers, and I know how to setup replication on MySQL. My question is, Does Prestashop have the capability to do read/write separation, and is this the file I need to edit to do so? Thanks Link to comment Share on other sites More sharing options...
El Patron Posted August 22, 2014 Share Posted August 22, 2014 El Patron, First off thank you for replying. I understand the need for multiple servers, and I know how to setup replication on MySQL. My question is, Does Prestashop have the capability to do read/write separation, and is this the file I need to edit to do so? Thanks excellent question. I pm'ed a community member to see if he knows. still, the cloud makes this easier. whey cpanel/plesk etc. does not have api for this creation makes seems a little lazy. also I think ps will detect the slave...but we shall see what others have to say. Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 (edited) excellent question. I pm'ed a community member to see if he knows. still, the cloud makes this easier. whey cpanel/plesk etc. does not have api for this creation makes seems a little lazy. Im using all dedicated servers, so no plesk/cpanel. XD Thank you. I am setting this up in my own datacenter, and have several servers that I can utilize. Being able to accomplish this would give me scaleability, reliability, and in some cases more performance. I figure its worth a try. Edited August 22, 2014 by N02SRT (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted August 22, 2014 Share Posted August 22, 2014 Thank you. I am setting this up in my own datacenter, and have several servers that I can utilize. Being able to accomplish this would give me scaleability, reliability, and in some cases more performance. I figure its worth a try. yes, I think it is worth effort....when you enable ps internal profiling config/defines.inc.php define('_PS_DEBUG_PROFILING_', true); you should see the slave reads...(not sure usually we only see no slave stats) Link to comment Share on other sites More sharing options...
bellini13 Posted August 22, 2014 Share Posted August 22, 2014 from what i can see, the only place that uses that file is the DB class. When a Db instance is created, the calling function would have to specify if the master or slave should be used. 1) DB::getInstance() would always use the master 2) DB::getInstance(true) would use the master 3) DB::getInstance(false) would use a slave (if existing) 4) DB::getInstance(_PS_USE_SQL_SLAVE_) would use the value defined in config/defines.inc.php, which is 0 by default. So if you do have slave servers to use, I believe you need to do the following 1) define your slave servers in db_slave_server.inc.php 2) update defines.inc.php so that _PS_USE_SQL_SLAVE_ would be true If you search the Prestashop source code for "_PS_USE_SQL_SLAVE_", you will see all the areas that could potentially use a slave server. Mostly limited to the classes, some controllers and most of the stats modules. 2 Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 from what i can see, the only place that uses that file is the DB class. When a Db instance is created, the calling function would have to specify if the master or slave should be used. 1) DB::getInstance() would always use the master 2) DB::getInstance(true) would use the master 3) DB::getInstance(false) would use a slave (if existing) 4) DB::getInstance(_PS_USE_SQL_SLAVE_) would use the value defined in config/defines.inc.php, which is 0 by default. So if you do have slave servers to use, I believe you need to do the following 1) define your slave servers in db_slave_server.inc.php 2) update defines.inc.php so that _PS_USE_SQL_SLAVE_ would be true If you search the Prestashop source code for "_PS_USE_SQL_SLAVE_", you will see all the areas that could potentially use a slave server. Mostly limited to the classes, some controllers and most of the stats modules. Ok, thank you very much! This is exactly what I was looking for. So my next question would be, being that not all areas can use the slave function, would it be worth it to set it up? Thanks again both of you. -Steve Link to comment Share on other sites More sharing options...
Dh42 Posted August 22, 2014 Share Posted August 22, 2014 Let me first start by saying I haven't used it, but yes it supports it. To turn it on, put the servers in the file like the example, then go to the defines.inc.php and set it to 1. It should be around line 171. Link to comment Share on other sites More sharing options...
Dh42 Posted August 22, 2014 Share Posted August 22, 2014 Just a question, what kind of traffic are you expecting and do you keep stock in the store? Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 Just a question, what kind of traffic are you expecting and do you keep stock in the store? We stock close to 100,000 items and expect close to 3500~ concurrent users. Link to comment Share on other sites More sharing options...
Dh42 Posted August 22, 2014 Share Posted August 22, 2014 How are you setting the frontend server up? One server cannot handle that kind of concurrent load, you will have to load balance on the frontend. A dual current model xeon should handle the database though. Link to comment Share on other sites More sharing options...
N02SRT Posted August 22, 2014 Author Share Posted August 22, 2014 How are you setting the frontend server up? One server cannot handle that kind of concurrent load, you will have to load balance on the frontend. A dual current model xeon should handle the database though. I am running a Zen load balancer with 6 apache webservers and 8 MySQL servers Link to comment Share on other sites More sharing options...
Dh42 Posted August 22, 2014 Share Posted August 22, 2014 If that is all for that one site you are overkilling the backend, you can more than likely get away with one mysql server. A couple of tips make sure you have sticky sessions turned on and only run one server with the img and caching directories and sym link it to the other servers. Or just run one server with all of the image and caching and link the other front end servers to it. There might be some useful information in this, http://dh42.com/blog/prestashop-scalability/ Link to comment Share on other sites More sharing options...
Recommended Posts