The point is that RPC is a remote call. Remote call means that the client sends the called interface, parameters, parameter types, methods, return values, return value types, etc. (These are called method signatures) are sent to the server through the above protocol to inform the server of the interface methods that need to be called. This process is the realization process of RPC! HTTP and RPC are two different things!
In terms of performance, HTTP itself is based on TCP protocol and belongs to the application layer protocol, so the HTTP protocol itself will occupy a lot of resources (memory, bandwidth, etc.). In the process of implementation, and the performance is definitely not as fast as the RPC protocol directly through TCP, no matter how optimized HTTP is, it is definitely not as good as TCP! On the other hand, TCP relies on bytecode. At present, it is generally adopted to send the interface information called by the client to the server in a serialized way. Serialization framework also contains many (Hession, Protobuf, Kryo, etc. ). The highest serialization performance is Kryo, and the smallest bytecode after serialization is Protobuf. The smaller the bytecode after serialization, the less bandwidth it occupies, the shorter the serialization time and the shorter the thread IO waiting time. Therefore, there are many technologies that can be discussed at the specific application level, and you can choose the corresponding technology according to your own hardware capabilities!
Welcome people who love technology to discuss!