Development problems in distributed systems

A distributed system, if the guarantee of access idempotency

Like solutions and ensure messages idempotency way, for example with an order to resolve multiple requests. The solution is to first generate a globally unique algorithm by snowflakes order ID, and then when writing database to determine whether there has been insert the order ID, if they have to give up direct insert operation.

Second, distributed systems, how to ensure that the order of the task

Two ways:

1. Add a service center through which the service to control their calling sequence, the message is sent to Service Award mq, in order to guarantee the order of the messages.

2. Distributed Lock

Third, the distributed coordination between the various service calls

Fourth, to achieve high availability by HA zookeeper

 This should be very common, such as hadoop, hdfs, yarn and many large data systems zk are selected based on HA high availability to develop mechanisms is an important process will generally call the shots prepared two main processes hung up immediately perceived by zk switch to the backup process.

Fifth, distributed session data problem

I suggest putting the data into the redis inside, other machines when the request directly to redis which read data.

Sixth, the solution distributed transactions

spring + JTA transaction is implemented in two phases - the "first asks if the individual services can be executed -" and then execute, submit

TTC program, handwritten business rollback.

Rollback message by the middleware.

Published 469 original articles · won praise 94 · Views 150,000 +

Guess you like

Origin blog.csdn.net/qq_37909508/article/details/102283817