CN112769898A - Service calling method, system, equipment and medium based on HTTP2.0 - Google Patents
Service calling method, system, equipment and medium based on HTTP2.0 Download PDFInfo
- Publication number
- CN112769898A CN112769898A CN202011524883.8A CN202011524883A CN112769898A CN 112769898 A CN112769898 A CN 112769898A CN 202011524883 A CN202011524883 A CN 202011524883A CN 112769898 A CN112769898 A CN 112769898A
- Authority
- CN
- China
- Prior art keywords
- user request
- server
- processing result
- processing
- client
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000004590 computer program Methods 0.000 claims description 6
- 230000000903 blocking effect Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Abstract
The invention relates to a service calling method, a system, equipment and a medium based on HTTP2.0, comprising the following steps: s1: acquiring a user request, serializing the user request by a client, and sending the user request to a proxy server; s2: the proxy server receives the serialized user request and sends the serialized user request to the server; s3: the server receives the serialized user request and carries out deserialization processing; s4: the server processes the user request to obtain a processing result; s5: and the proxy server sends the processing result to the client for execution. Compared with the prior art, the method and the device effectively improve the processing efficiency of the user request, prevent the situation that each request can be subjected to repeated handshake and slow start due to the fact that connection cannot be reused, prevent subsequent requests from being blocked, and improve the loading speed of the user page.
Description
Technical Field
The invention relates to a HTTP2.0 service calling method, in particular to a HTTP 2.0-based service calling method, system, equipment and medium.
Background
With the gradual enrichment and development of internet contents, more contents on a webpage begin to be displayed, the typesetting becomes more exquisite, and more complex interaction is introduced. The total amount of data and the number of requests that a user loads to open a home page of a web site are also increasing. Currently, most portal site home page sizes exceed 2M, and the number of requests can reach as many as 100. Another widespread application is client apps on the mobile internet, which vary widely in http usage among apps of different nature.
There are two main factors affecting a network request, bandwidth and latency. Today's network infrastructure has enabled bandwidth to be greatly increased, most of the time delay has been affecting response speed.
The HTTP1 protocol commonly used by the current web pages is complained of two problems of connection reuse failure and head of line blocking at most. The inability of the connections to be multiplexed results in each request experiencing a three-way handshake and slow start. The influence of three-way handshake is obvious in a high-delay scene, and the influence of slow start on a large file request is large. The head of line blocking may result in bandwidth being underutilized and subsequent health requests being blocked. Head of line blocking is the largest source of network experience before HTTP1. Healthy requests can be affected by unhealthy requests and the loss of such experience is affected by the network environment, occurs randomly and is difficult to monitor.
Disclosure of Invention
The present invention is directed to a method, system, device and medium for service invocation based on HTTP2.0, which overcome the above-mentioned drawbacks of the prior art.
The purpose of the invention can be realized by the following technical scheme:
a service calling method based on HTTP2.0 comprises the following steps:
s1: acquiring a user request, serializing the user request by a client, and sending the user request to a proxy server;
s2: the proxy server receives the serialized user request and sends the serialized user request to the server;
s3: the server receives the serialized user request and carries out deserialization processing;
s4: the server processes the user request to obtain a processing result;
s5: and the proxy server sends the processing result to the client for execution.
Preferably, the specific steps of processing the user request and acquiring the processing result by the server include:
step 01: the server judges whether a processing interface corresponding to the user request can be found, if so, the step 02 is carried out, otherwise, the step 06 is carried out;
step 02: the server processes the user request, judges whether event data exist in the user request or not, if yes, enters step 03, and otherwise enters step 04;
step 03: the server caches and processes the event data;
step 04: performing service processing on the user request to obtain a service processing result;
step 05: sending the processing result to a proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server;
step 06: and sending the non-processing interface as a processing result to the proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server.
Preferably, the specific step of the client executing the processing result includes: and the client carries out deserialization on the processing result and then carries out service logic execution.
Preferably, the client serializes the user request based on protobuf.
An HTTP 2.0-based service calling system comprises a client, a proxy server and a server,
the client is used for acquiring the user request, serializing the user request, sending the user request to the proxy server, acquiring and executing a processing result corresponding to the user request,
the proxy server is used for receiving the serialized user request, sending the serialized user request to the server, sending the processing result to the client,
the server is used for receiving the serialized user request, performing deserialization processing, processing the user request and acquiring a processing result.
Preferably, the server processes the user request, and the specific step of obtaining the processing result includes:
step 01: the server judges whether a processing interface corresponding to the user request can be found, if so, the step 02 is carried out, otherwise, the step 06 is carried out;
step 02: the server processes the user request, judges whether event data exist in the user request or not, if yes, enters step 03, and otherwise enters step 04;
step 03: the server caches and processes the event data;
step 04: performing service processing on the user request to obtain a service processing result;
step 05: sending the processing result to a proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server;
step 06: and sending the non-processing interface as a processing result to the proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server.
Preferably, the specific step of the client executing the processing result includes: and the client carries out deserialization on the processing result and then carries out service logic execution.
Preferably, the client serializes the user request based on protobuf.
A terminal device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the HTTP2.0 based service invocation method when executing the computer program.
A computer readable storage medium having stored thereon computer readable instructions, which, when executed by a processor of a computer, cause the computer to execute a HTTP2.0 based service invocation method as described above.
Compared with the prior art, the service calling method and system based on the HTTP2.0 can effectively process the user request, judge whether a processing interface corresponding to the user request can be found or not in the processing process based on the HTTP2.0 protocol, judge whether event data exist in the user request or not and process the event data by adopting a corresponding method, effectively improve the processing efficiency of the user request, prevent the situation that each request can experience multiple times of handshake and slow start due to the fact that connection cannot be reused, prevent subsequent requests from being blocked, improve the loading speed of a user page and effectively reduce network delay.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments. Note that the following description of the embodiments is merely a substantial example, and the present invention is not intended to be limited to the application or the use thereof, and is not limited to the following embodiments.
Examples
An HTTP 2.0-based service invocation method, as shown in fig. 1, includes the following steps:
acquiring a user request, serializing the user request by a client, and sending the user request to a proxy server, wherein the client serializes the user request based on protobuf;
the proxy server receives the serialized user request and sends the serialized user request to the server;
the server receives the serialized user request and carries out deserialization processing;
the server processes the user request to obtain a processing result;
and the proxy server sends the processing result to the client for execution.
The specific steps of processing the user request and acquiring the processing result by the server include:
step 01: the server judges whether a processing interface corresponding to the user request can be found, if so, the step 02 is carried out, otherwise, the step 05 is carried out;
step 02: the server processes the user request, judges whether event data exist in the user request or not, if yes, enters step 03, and otherwise enters step 04;
step 03: the server caches and processes the event data;
step 04: performing service processing on the user request to obtain a service processing result;
step 05: sending the processing result to a proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server;
step 06: and sending the non-processing interface as a processing result to the proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server.
The specific steps of the client executing the processing result comprise: and the client carries out deserialization on the processing result and then carries out service logic execution.
In this embodiment, the application object of the present invention is composed of a server, a client and a proxy server, where one server may communicate with multiple clients at the same time, and the server may be deployed at a server of an original collaborative office system. A single server may also be used.
1. The deployment server is used for setting a port of the external public service;
2. and deploying the proxy server, and setting the connection between the proxy server and the server configuration.
3. And deploying a client mode. And setting an access address and a port of the proxy server.
The invention relates to a service calling method based on HTTP2.0, which comprises a client, a proxy server and a server, wherein the client is used for acquiring a user request, serializing the user request, sending the user request to the proxy server and acquiring and executing a processing result corresponding to the user request, the proxy server is used for receiving the serialized user request, sending the serialized user request to the server and sending the processing result to the client, and the server is used for receiving the serialized user request, performing anti-serialization processing and processing the user request to acquire the processing result.
The server processes the user request, and the specific step of obtaining the processing result comprises the following steps:
the specific steps of the client executing the processing result comprise: and the client carries out deserialization on the processing result and then carries out service logic execution.
The client serializes the user request based on protobuf.
A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the HTTP2.0 based service invocation method when executing the computer program.
A computer readable storage medium having stored thereon computer readable instructions, which, when executed by a processor of a computer, cause the computer to execute a HTTP2.0 based service invocation method as described above.
By adopting the method, the page loading time is reduced by 64 percent compared with http1.x, the page loading time is improved by 27 to 60 percent when the ssl is not started, and the page loading time is 39 to 55 percent after the ssl is started.
The above embodiments are merely examples and do not limit the scope of the present invention. These embodiments may be implemented in other various manners, and various omissions, substitutions, and changes may be made without departing from the technical spirit of the present invention.
Claims (10)
1. A service calling method based on HTTP2.0 is characterized by comprising the following steps:
s1: acquiring a user request, serializing the user request by a client, and sending the user request to a proxy server;
s2: the proxy server receives the serialized user request and sends the serialized user request to the server;
s3: the server receives the serialized user request and carries out deserialization processing;
s4: the server processes the user request to obtain a processing result;
s5: and the proxy server sends the processing result to the client for execution.
2. The HTTP 2.0-based service invocation method according to claim 1, wherein the S4 specifically includes:
step 01: the server judges whether a processing interface corresponding to the user request can be found, if so, the step 02 is carried out, otherwise, the step 06 is carried out;
step 02: the server processes the user request, judges whether event data exist in the user request or not, if yes, enters step 03, and otherwise enters step 04;
step 03: the server caches and processes the event data;
step 04: performing service processing on the user request to obtain a service processing result;
step 05: sending the processing result to a proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server;
step 06: and sending the non-processing interface as a processing result to the proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server.
3. The method for invoking a service based on HTTP2.0 as recited in claim 1, wherein the specific step of the client executing the processing result in S5 comprises: and the client carries out deserialization on the processing result and then carries out service logic execution.
4. The method for calling service based on HTTP2.0 as recited in claim 1, wherein the client serializes the user request based on protobuf in S1.
5. A service calling system based on HTTP2.0 is characterized by comprising a client, a proxy server and a server,
the client is used for acquiring the user request, serializing the user request, sending the user request to the proxy server, acquiring and executing a processing result corresponding to the user request,
the proxy server is used for receiving the serialized user request, sending the serialized user request to the server, sending the processing result to the client,
the server is used for receiving the serialized user request, performing deserialization processing, processing the user request and acquiring a processing result.
6. The HTTP 2.0-based service invocation system according to claim 5, wherein the server processes the user request, and the specific step of obtaining the processing result includes:
step 01: the server judges whether a processing interface corresponding to the user request can be found, if so, the step 02 is carried out, otherwise, the step 06 is carried out;
step 02: the server processes the user request, judges whether event data exist in the user request or not, if yes, enters step 03, and otherwise enters step 04;
step 03: the server caches and processes the event data;
step 04: performing service processing on the user request to obtain a service processing result;
step 05: sending the processing result to a proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server;
step 06: and sending the non-processing interface as a processing result to the proxy server, forwarding the processing result to the client by the proxy server, and finishing the processing by the server.
7. The HTTP 2.0-based service invocation system according to claim 5, wherein said specific step of the client executing the processing result includes: and the client carries out deserialization on the processing result and then carries out service logic execution.
8. The HTTP 2.0-based service invocation system according to claim 5, wherein said client serializes user requests based on protobuf.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the HTTP2.0 based service invocation method of any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor of a computer, cause the computer to perform an HTTP 2.0-based service invocation method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011524883.8A CN112769898A (en) | 2020-12-22 | 2020-12-22 | Service calling method, system, equipment and medium based on HTTP2.0 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011524883.8A CN112769898A (en) | 2020-12-22 | 2020-12-22 | Service calling method, system, equipment and medium based on HTTP2.0 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112769898A true CN112769898A (en) | 2021-05-07 |
Family
ID=75694604
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011524883.8A Pending CN112769898A (en) | 2020-12-22 | 2020-12-22 | Service calling method, system, equipment and medium based on HTTP2.0 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112769898A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040143670A1 (en) * | 2002-07-02 | 2004-07-22 | Pratik Roychowdhury | System, method and computer program product to avoid server overload by controlling HTTP denial of service (DOS) attacks |
CN102624895A (en) * | 2012-03-09 | 2012-08-01 | 亿赞普(北京)科技有限公司 | Method and system for processing network service request |
CN108337236A (en) * | 2017-12-28 | 2018-07-27 | 杭州马猴烧韭科技有限公司 | A kind of gRPC call methods and device based on Protobuf and HTTP/1.1 |
CN111082904A (en) * | 2019-12-06 | 2020-04-28 | 安徽芯智科技有限公司 | Rtos-based rpc communication method |
-
2020
- 2020-12-22 CN CN202011524883.8A patent/CN112769898A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040143670A1 (en) * | 2002-07-02 | 2004-07-22 | Pratik Roychowdhury | System, method and computer program product to avoid server overload by controlling HTTP denial of service (DOS) attacks |
CN102624895A (en) * | 2012-03-09 | 2012-08-01 | 亿赞普(北京)科技有限公司 | Method and system for processing network service request |
CN108337236A (en) * | 2017-12-28 | 2018-07-27 | 杭州马猴烧韭科技有限公司 | A kind of gRPC call methods and device based on Protobuf and HTTP/1.1 |
CN111082904A (en) * | 2019-12-06 | 2020-04-28 | 安徽芯智科技有限公司 | Rtos-based rpc communication method |
Non-Patent Citations (1)
Title |
---|
陈永祥等: "一种RIA分系统架构模式的研究与实现", 《计算机应用与软件》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107547629B (en) | Method and device for downloading client static resources, electronic equipment and readable medium | |
DE112013003289T5 (en) | Device, system and method for client-controlled session persistence between one or more clients and servers of a data center | |
US20150188986A1 (en) | Information processing apparatus, control method, and storage medium | |
CN111901157B (en) | Service deployment method, device, equipment and medium based on k8s | |
US10405365B2 (en) | Method and apparatus for web browsing on multihomed mobile devices | |
CN108093098A (en) | A kind of domain name mapping request sending method and device | |
CN111258627A (en) | Interface document generation method and device | |
WO2017185615A1 (en) | Method for determining service status of service processing device and scheduling device | |
CN108886533B (en) | Accelerating connections to host servers | |
CN109361712B (en) | Information processing method and information processing device | |
CN112769898A (en) | Service calling method, system, equipment and medium based on HTTP2.0 | |
CN105933298B (en) | Apparatus and method for performing transmission control protocol handshaking | |
CN108810070B (en) | Resource sharing method and device, intelligent equipment and storage medium | |
CN107707672B (en) | Method, device and equipment for reconstructing code with balanced load | |
CN111338928A (en) | Chrome-based browser testing method and device | |
US20140047014A1 (en) | Network access system | |
CN108509243A (en) | The method, apparatus and electronic equipment of a kind of page load in application | |
CN107506491B (en) | OSD data distribution method and device of distributed file system | |
CN114363204A (en) | Request monitoring method, network device and storage medium | |
CN114915565A (en) | Method and system for debugging network | |
CN110753043A (en) | Communication method, device, server and medium | |
CN109302446B (en) | Cross-platform access method and device, electronic equipment and storage medium | |
CN112771835A (en) | Processing method and device for outer chain rewriting | |
CN107317880B (en) | Method and device for realizing load balance | |
US10594657B1 (en) | Methods for parameterized sub-policy evaluation for fine grain access control during a session and devices thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210507 |
|
RJ01 | Rejection of invention patent application after publication |