The high-performance mysql book suggests that to outline the blog application, you might want to put the comment data through 2 fragments: firstly, on the fragment of the post about the person’s publication and on the fragment where the message is stored.
Thus, the question arises of how to reliably duplicate this data. Which of the following shard data duplication options is recommended?
Option 1: Make 2 separate insertions from a PHP script.
Pros: a) Logic is at the application level.
Cons: a) The user is held for two inserts. b) This logic should be duplicated for each client trying to insert similar data.
Conclusion: Seems reasonable.
Option 2: Create federated tables and use some trigger to handle duplicate insertion.
Pros: a) at the application level, no need to worry about multiple inserts
Cons: a) Each splinter must have a federated connection with each other splinter; b) The Federation will operate on machines on the local network, but as for two different sites. c) what happens if the connection to the federated server fails.
Conclusion: this does not seem to be a sound idea.
Option 3. Messages such as RabbitMQ
Pros: a) Different clients can insert data in one place, and all subscribers can consume the insert.
Cons: a) complex; b) may impose an overhead charge for hosting the messaging server and clients; c) not sure how he will work with the search service to find suitable fragments
Conclusion: Not Sure
Option 4: your suggestion?
I will be very grateful for your help.
source share