Service Framework Pigeon Architecture
? Pigeon provides jar package access, which runs in Tomcat on the line
? Monitor-cat, responsible for call link analysis, abnormal monitoring alarm, etc.
? Configuration Center-lion, responsible for some switch configuration reads
? governor-Service Governance Portal
? A interface is defined as a service, and each service has a unique identity
Registration and discovery of services
? Registration information includes service name, IP, port, group, etc.
? The service provider is automatically registered after the initialization is complete, or it can be registered through the API or the management side
? Service caller discovers services through service name
Registry (Zookeeper)
/dp/server/com.dianping.iphub.ipservice
10.66.1.1:5020,10.66.1.2:5020
Logout of the service
? Service address to avoid temporary node instability by zookeeper persistent node storage
? When you close Tomcat, the pigeon script is called to remove the native service address from the registry
? For residual invalid addresses, there is a separate heartbeat service that detects invalid service addresses for zookeeper deletion
? Client for invalid service address, internal heartbeat detection mechanism, etc. to ensure
Programmatic, serialization
? Based on Hessian serialization, Netty implements custom TCP protocol formats, low development costs, and defines service interfaces through Java interface
? Based on thrift serialization, a custom TCP protocol format is implemented through Netty, with higher performance and a slightly higher development cost, defining the service interface by defining IDL or annotation methods.
More convenient access to other languages, thrift will have some system such as method does not support overloading, struct does not support inheritance, etc.
Call pattern
? Sync, synchronous wait return call
? Future, can be implemented in parallel to make multiple requests, the total time is the slowest request execution time, the recommended way
? Callback, emitting a result without waiting for return, result callback, fully asynchronous
? Oneway, no need to return results
Client Heartbeat
? The Heart jumper thread client initiates, sends periodically, the service side responds, 5 consecutive times does not succeed in the local route cache to remove the server node, after the removal of the next attempt to re-connect
Client Load Balancing
? A variety of load balancing policies, the default is adaptive policy, the client calculates the number of in-transit requests destined for each server-side node, and the new request prioritizes the node sending the least number of requests in transit
? Warm-up control, for a newly-started node on the server side, the client presses from slow to fast frequency, the request is gradually sent to this node, to prevent the server has just started a large number of requests in the node to cause a large number of timeouts
? You can also customize the load balancing policy
Service Limit Flow
? Can be in the service side of a service interface to a certain method, for different caller application of the request traffic QPS limit, after exceeding the threshold, the caller will receive a service rejection exception, in the future will be limited to the end of the call
? The server controls the number of threads that are consumed by requests from any interface, preventing a single interface from running out of all available threads in the thread pool
Service isolation
? The server will monitor the timeout for each interface by default, and the interface requests that are timed out will automatically be routed to a separate slow thread pool, and if the interface returns to normal, it will return to the normal shared thread pool for processing
? You can also configure a separate thread pool for some interface methods, with the remaining public pools
Service Monitoring analysis and alarms
? Monitoring System Cat (open source) Analysis call link, including call volume, TP time, exception, request and response size, interval time-consuming detail, QPS, etc.
Project Address: Https://github.com/dianping/pigeon
Monitoring system used: Central Application Tracking
Project Address: Https://github.com/dianping/cat
Monitoring System Environment Construction: http://www.cnblogs.com/softidea/p/5719331.html
Volkswagen Reviews Service Framework Pigeon