The difference between Dubbo RPC and ordinary Http request

1. What is Dubbo interface

The Dubbo interface is an open source Alibaba dedicated to providing high-performance and transparent RPC remote service invocation solutions and SOA service governance solutions. The Dubbo framework bid farewell to the traditional web service service model, and then switched to the provider and consumer models for service. Why is it high-performance? A single dedicated service can be provided in a server cluster so that it is not mixed with other services. At the same time, the Dubbo interface has SOA scheduling to achieve load balancing by monitoring each server . The consumer side does not need to pay attention to how the provider side is implemented. It only needs to subscribe in the registry to request services from the corresponding server, which achieves high performance and transparency. After all, the Dubbo interface is a distributed service framework.

Second, the difference between Dubbo and Http

2.1 dubbo
  1. Number of connections: single connection
  2. Connection mode: long socket connection, avoiding the overhead of repeatedly creating TCP connections. For most service calls, service consumers are much larger than service providers. The volume of calls between services is very large. Using a single connection prevents service providers from being overwhelmed. Using long connections can reduce the handshake verification of service connections.
  3. Transmission method: NIO asynchronous transmission
  4. Transmission protocol: TCP
  5. Serialization method: Hessian binary serialization
  6. You can customize the protocol without adding irrelevant request header information,
  7. Security: At the beginning of the design of Dubbo, the internal network communication was basically considered, and there was basically no consideration in security, which is far worse than the security of Http.
  8. Applicable scenarios:
    (1) Incoming and outgoing parameter data packets are small (recommended to be less than 100K);
    (2) There are more consumers than providers
    (3) rpc long connection, higher transmission efficiency, customizable routing, applicable Interconnect with internal systems
2.2 http
  1. Number of connections: multiple connections
  2. Connection mode: short connection,
  3. Transmission method: synchronous transmission
  4. Transmission protocol: Http
  5. Serialization method: form serialization (JSON)
  6. The Http protocol will have a series of Http headers. These contents often occupy several K of data. When the amount of access is particularly huge, these irrelevant data are actually a burden.
  7. Security: high
  8. Scope of application:
    (1) Incoming and outgoing data packets are mixed in size
    (2) It can be accessed through URL, and can be accessed in the browser
    (3) HTTP short connection, the protocol is standardized and easy to read, easy to connect to external systems, suitable for upper layers Business module

Note: The http1.1 protocol uses a short connection by default, and each request requires a three-way handshake; and the http2.0 protocol began to change the default socket connection to a long connection

Guess you like

Origin blog.csdn.net/sinat_34241861/article/details/112559582