Smart healthcare – Best Practices for micro services

Time:2021-11-25

01 product analysis and positioning

Smart healthcare - Best Practices for micro services

Product positioning in analysis

02 microservice architecture design

Smart healthcare - Best Practices for micro services

Microservice architecture design
  • Business centric
  • High cohesion and low coupling
  • highly autonomous
  • Elastic design
  • Logging and monitoring
  • automation

03 evolution of real-time message push technology

Smart healthcare - Best Practices for micro services

Evolution of real-time message push technology
  • Access layer load balancing is based on HTTP seven layer load balancing, evolving from ha to nginx
  • Ha supports TCP and HTTP protocols, supports 8 load balancing strategies, supports URL health detection and heartbeat detection. It works in layer 4 and layer 7 of the network, but it does not support WS protocol well, resulting in WS message accumulation
  • Nginx supports HTTP protocol, works in network layer 7, supports websocket protocol, supports port health detection, and supports powerful regular matching rules
  • Nginx shunt:
server 172.16.125.76:8066 weight=10;  
 server 172.16.125.76:8077 down;  
 server 172.16.0.18:8066 max_fails=3 fail_timeout=30s;  
 server 172.16.0.18:8077 backup;  
  • Ha shunt:
server web01 192.168.137.203:80  check inter 2000 fall 3 weight 10

04 request interface idempotency

Smart healthcare - Best Practices for micro services

Request interface idempotency
  • Verify that the granularity is small, the framework layer and the business layer have zero intrusion: the filter and interceptor are not OK, and the business layer annotates AOP
  • Filtering duplicate requests: AOP surrounds the notification. The pre notification checks the existence of the key, and the post notification releases the key. The key already has a filtering request
  • Concurrent request: multi-threaded query of key and creation of key are not OK. Redis single thread + is used to ensure the atomicity of key operation, and distributed lock is introduced
  • Atomic operation of key release: only the key of its own thread can be released. If an exception occurs, it should be released in final. Redis transaction is introduced and watch monitors the key
  • Extreme case: normal business takes time and the key is expired; Redis master-slave or cluster, master node crashes, slave node is not upgraded, and data synchronization is not successful, resulting in data loss. Redisson distributed Java solution is introduced to renew the contract regularly, and cluster data is stored in distributed memory grid

05 service governance

Smart healthcare - Best Practices for micro services

Service governance
  • Challenges brought by service:
  • More and more services and complex configuration management
  • Complex dependencies between services
  • Load balancing between services
  • Service expansion
  • Service monitoring
  • service degradation
  • Service authentication
  • Service online and offline
  • Service document
  • Service governance is a systematic project, including: service registration and discovery, distributed configuration distribution and dynamic hot loading, service invocation and load balancing, fault tolerance and degradation current limiting, gateway and authentication, internal and external network isolation, service scheduling, service survival and detection, invocation link and tracking, service function availability inspection, continuous publishing and automatic autonomy

Recommended Today

Apache sqoop

Source: dark horse big data 1.png From the standpoint of Apache, data flow can be divided into data import and export: Import: data import. RDBMS—–>Hadoop Export: data export. Hadoop—->RDBMS 1.2 sqoop installation The prerequisite for installing sqoop is that you already have a Java and Hadoop environment. Latest stable version: 1.4.6 Download the sqoop installation […]