vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello I m a bit new with mysql. i want to use master/slave replication with mysql to implement load balancing. i can redirect the write to the master and use one of the slave for the read. but how the read after write should be implemented ? for exemple: -you are searching in a list of item (on a slave) -you modify an item (on a master) -you refresh the item list: as it is a read request, it should be redirected to the slave but is the slave sync'ed with master now ? if not, the user will not see his update and he can think that he has to modify again the item. what is the best way to handle this case : - refreshing from master after modif ? - waiting than the slave is sync'ed ? - other ? |
| |||
| patrice wrote: > Hello > > I m a bit new with mysql. > i want to use master/slave replication with mysql to implement load > balancing. > i can redirect the write to the master and use one of the slave for the > read. > > but how the read after write should be implemented ? > for exemple: > -you are searching in a list of item (on a slave) > -you modify an item (on a master) > -you refresh the item list: > as it is a read request, it should be redirected to the slave > but is the slave sync'ed with master now ? > if not, the user will not see his update and he can think that he has to > modify again the item. > > what is the best way to handle this case : > - refreshing from master after modif ? > - waiting than the slave is sync'ed ? > - other ? > > > mysql replication is designed to be almost synchronous. i suggest that you run this command SHOW SLAVE STATUS\G on your master server, then look at the parameter seconds_behind_master. it should be close to zero if you have a good network. |
| ||||
| "lark" <hamzee@sbcdeglobalspam.net> a écrit dans le message de news:_QTbi.3695$bP5.2881@newssvr19.news.prodigy.ne t... > mysql replication is designed to be almost synchronous. i suggest that > you run this command > > SHOW SLAVE STATUS\G > > on your master server, then look at the parameter seconds_behind_master. > it should be close to zero if you have a good network. thank you for the answer. i ve effectively noticed that the slave is quickly updated. but i guess it can exists some situation where the slave is not updated immediatly (if multiple write are already pending) so maybe i have to record a counter for each table in a special table, inc'it at each update, and wait (with a timeout the user can cancel) until the counter on the slave is >= before resending the query from the slave. |
| Thread Tools | |
| Display Modes | |
|
|