MySQL replication speed

Suppose we have 3 servers on a local network:

APP - php application server

MASTER - Mysql db server

SLAVE - Mysql db slave server (MASTER replication)

In one code block (php), the APP is inserted into the MASTER , retrieves last_insert_id, which it then uses to select the data that it just inserted from SLAVE .

So the question is, will SLAVE happen during replication to have data from the MASTER ? Does it affect the load on the MASTER or SLAVE ?

And finally, if there is a problem with the available data, is there a way to ensure that the latest data is received from SLAVE ?

+3
source share
2 answers

Since MySQL replication time is an uncontrolled variable (even in the right implementations, there may be problems with replication or blocking), it is better not to rely on data replication. You can break the problem into two situations:

1) I am a user performing a CUD operation, I expect subsequent R operations to reflect the change I just made. In this case, you absolutely must pull the data from the wizard, because the user expects that his change will affect.

2) , , CUD , , ( 99% , , , PHP *).

# 1 , , , . - , x y , , .

  • , , ( ) . - memcached .
+5

, SLAVE MASTER.

INSERT, UPDATE DELETE, , -, , , .

SLAVE MASTER , , MASTER, , 2 1 , , , .

0

Source: https://habr.com/ru/post/1715301/


All Articles