Distributed Systems Frequently Asked Questions

1. Distributed Problem

1. Distributed session problem.

       By redis session can be stored or introduced directly into the spring-session-redis-start plug-in, distributed control session, of course, also be used iphash nginx, but he was directly bind ip to a server, will cause liabilities are not balanced.

2. Data consistency issues.

       It can be solved by a distributed transaction framework, or eventually consistent solution.

3. offerings and other issues

       When api processing business, we must make validating form repeat treatment. The repetitive processing of the same service, a parameter can be made encapsulating the service base class, but also other specific parameters inherited from the type of packaging, then control aop intercept duplicate submission form.

4. Global id problem

       Redis increment can be used to achieve the overall sequence. You can also use uuid, uuid is poor readability, and must be a string of storage space is relatively large.

5. Distributed lock problems

       You can use zookepper, or redis achieve distributed lock, but personally recommend optimistic locking to control.

2. High concurrency issues

       1. How to improve qps interface?

       ① ehcache may be used to make a secondary cache and redis improve qps interface.

       For example, after the registration ② need to send the phone verification code, send mail. It can also be used to decouple the queue, improving qps.

3. availability problems

       1. clever use caching to prevent penetration of requests directly to the database.

       2. Use Hystrix prevent avalanche effect. Prevent the accumulation of services.

      

Guess you like

Origin www.cnblogs.com/chenfei-java/p/12649989.html