CN113923163A - Long connection message channel based current limiting method and system - Google Patents

Long connection message channel based current limiting method and system Download PDF

Info

Publication number
CN113923163A
CN113923163A CN202111219941.0A CN202111219941A CN113923163A CN 113923163 A CN113923163 A CN 113923163A CN 202111219941 A CN202111219941 A CN 202111219941A CN 113923163 A CN113923163 A CN 113923163A
Authority
CN
China
Prior art keywords
client
connection
server
request
current
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
Application number
CN202111219941.0A
Other languages
Chinese (zh)
Inventor
张文洁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Eshore Technology Co Ltd
Original Assignee
Guangdong Eshore Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Eshore Technology Co Ltd filed Critical Guangdong Eshore Technology Co Ltd
Priority to CN202111219941.0A priority Critical patent/CN113923163A/en
Publication of CN113923163A publication Critical patent/CN113923163A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a flow limiting method based on a long connection message channel, relates to the technical field of communication, and solves the technical problem of service breakdown caused by access of a large number of clients in a short time. The invention also discloses a flow limiting system based on the long connection message channel. According to the invention, through the scheme of combining the server and the client, the server is preferentially ensured to obtain a good current limiting effect, and meanwhile, the problem of instantaneous high concurrency scene caused by the client is reduced.

Description

Long connection message channel based current limiting method and system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and a system for limiting a current based on a long connection message channel.
Background
The current limiting technology is a technology for protecting the continuous normal operation of the system service by realizing a specific algorithm or introducing a queue to control the concurrent access when the high concurrent system service reaches a certain rate or threshold. The current limiting technology is generally realized by adopting semaphore, sliding window, counter and other modes, and current limiting can be finished by introducing cache, message middleware and other modes.
The long connection system generally comprises a client and a server, wherein the client actively initiates a request for establishing long connection to the server, and interactive communication is started after the request is verified by the server. When a large number of client-side scenes are oriented, the server is easy to crash due to overlarge pressure caused by massive long connection, so that the current-limiting control needs to be carried out by the server, and degradation, queuing or service rejection is carried out after a certain concurrency is achieved.
However, only limited by the server, if the service fails, the service breakdown caused by the fact that a large number of clients enter the system once in a short time cannot be prevented, and the fact that the clients cannot be reconnected for a long time is also influenced.
Disclosure of Invention
The technical problem to be solved by the present invention is to solve the above-mentioned deficiencies of the prior art, and an object of the present invention is to provide a long connection message channel based current limiting method capable of preventing service collapse.
The invention also aims to provide a long-connection-based message channel current limiting system capable of preventing service breakdown.
In order to achieve the first purpose, the invention provides a long connection message channel-based current limiting method, which comprises a step of limiting current at a server according to the current connection number and a step of limiting current at a client according to the connection failure number.
As a further improvement, the step of limiting the current at the server according to the current connection number includes:
setting an initial threshold value of connection number degradation at the server side, and allowing the maximum number of received connections; after receiving the request from the client, the server judges whether the server is degraded currently according to the current connection number;
if the current connection number is smaller than the initial threshold value, the request of the client side is legal, the server side and the client side directly establish long connection, and after the long connection channel is established successfully, the current connection number is added with 1;
if the initial threshold value is not more than the current connection number and less than the maximum connection number, the server actively degrades to a limiting level, responds to a connection failure result according to the request times of the client, returns the address of the server connected next time and re-request time, and records the request times of the client;
and if the maximum connection number is less than or equal to the current connection number, the server actively degrades to the highest level, rejects the connection request of the client, and returns a failure result and re-request time.
Further, when the server actively degrades to a limit level and the number of requests of the client reaches a set retry number, the server allows the connection request of the client to pass through, and returns a success result.
Further, the re-request time is determined by the request times of the client, and the interval for returning the next re-request time is longer when the request times of the client are recorded to be larger.
Further, the step of limiting the flow at the client according to the connection failure times includes:
setting a longest retry interval time at the client;
when the client side is connected for the first time, the client side directly requests the server side to establish a long connection channel;
when the client receives a failure result and re-request time returned by the server, the client requests to establish a long connection channel again after sleeping for the re-request time;
when the client sends a request and reaches the set unresponsive time, the client fails to receive a result returned by the server, the number of connection failures is added by 1, next retry interval time is determined according to the number of connection failures, and the client sleeps for the next retry interval time and then requests to establish a long connection channel again.
Further, the next retry interval is based on the client algorithm, and is equal to the connection failure times and a random number.
Further, when the longest retry interval time is less than or equal to the next retry interval time, the client sleeps for the longest retry interval time and then requests to establish the long connection channel again.
Further, after the client is disconnected from the server, the current connection number is decreased by 1.
In order to achieve the second purpose, the invention provides a long connection message channel based current limiting system, which comprises a server and a client, wherein the server is in communication connection with the client, and the server and the client establish a long connection channel according to the long connection message channel based current limiting method.
As a further improvement, the server includes at least one server, and the client includes at least one of a smartphone, a smart watch, a tablet, and a PC.
Advantageous effects
Compared with the prior art, the invention has the advantages that:
according to the invention, through the scheme of combining the server and the client, the server is preferentially ensured to obtain a good current limiting effect, and meanwhile, the problem of instantaneous high concurrency scene caused by the client is reduced.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The invention will be further described with reference to specific embodiments shown in the drawings.
Referring to fig. 1, a method for limiting a flow based on a long connection message channel includes a step of limiting a flow at a server according to a current connection number and a step of limiting a flow at a client according to a connection failure number.
The step of limiting the current at the server according to the current connection number comprises the following steps:
setting an initial threshold V of connection number degradation at a server side, and allowing the maximum connection number M to be received; after receiving the request from the client, the server judges whether the server is degraded currently according to the current connection number;
if the current connection number is smaller than the initial threshold value V, the request of the client side is legal, the server side and the client side directly establish long connection, and after the long connection channel is established successfully, the current connection number is added with 1; when the client is disconnected with the server, subtracting 1 from the current connection number;
if the initial threshold value V is less than or equal to the current connection number and less than the maximum connection number M, the server actively degrades to a limiting level, responds to a connection failure result according to the request times of the client, returns the address of the server connected next time and the re-request time, and records the request times of the client; when the request times of the client reach the set retry times, the server allows the connection request of the client to pass through and returns a success result;
and if the maximum connection number M is less than or equal to the current connection number, the server actively degrades to the highest level, rejects the connection request of the client, and returns a failure result and re-request time.
The re-request time is determined by the request times of the client, and the more the request times of the client are recorded, the longer the interval for returning to the next re-request time is.
The step of limiting the flow at the client according to the connection failure times comprises the following steps:
setting a longest retry interval time T at the client;
when the client side is connected for the first time, the client side directly requests the server side to establish a long connection channel;
when the client receives the failure result and the re-request time returned by the server, the client sleeps for the re-request time and then requests for establishing a long connection channel again;
when the client sends a request and reaches the set unresponsive time, the client cannot receive a result returned by the server, the connection failure times are added by 1, next retry interval time is determined according to the connection failure times, and the client requests to establish a long connection channel again after sleeping for the next retry interval time; and resetting the connection failure times after the connection is successful.
The next retry interval is determined by the client algorithm, and is a constant of the connection failure times and random numbers, so that the number of clients initiating requests at the same time can be reduced to a certain extent, and the connection power is increased.
And when the longest retry interval T is less than or equal to the next retry interval, the client sleeps for the longest retry interval T and then requests to establish the long connection channel again.
A flow limiting system based on a long connection message channel comprises a server and a client, wherein the server is in communication connection with the client, and the server and the client establish the long connection channel according to the flow limiting method based on the long connection message channel. The server comprises at least one server, and the client comprises at least one of a smart phone, a smart watch, a tablet and a PC.
According to the invention, through the scheme of combining the server and the client, the server is preferentially ensured to obtain a good current limiting effect, and meanwhile, the problem of instantaneous high concurrency scene caused by the client is reduced.
The above is only a preferred embodiment of the present invention, and it should be noted that it is obvious to those skilled in the art that several variations and modifications can be made without departing from the structure of the present invention, which will not affect the effect of the implementation of the present invention and the utility of the patent.

Claims (10)

1. A flow limiting method based on a long connection message channel is characterized by comprising a step of flow limiting at a server side according to the current connection number and a step of flow limiting at a client side according to the connection failure number.
2. The method as claimed in claim 1, wherein the step of limiting the flow at the server according to the current connection number comprises:
setting an initial threshold value of connection number degradation at the server side, and allowing the maximum number of received connections; after receiving the request from the client, the server judges whether the server is degraded currently according to the current connection number;
if the current connection number is smaller than the initial threshold value, the request of the client side is legal, the server side and the client side directly establish long connection, and after the long connection channel is established successfully, the current connection number is added with 1;
if the initial threshold value is not more than the current connection number and less than the maximum connection number, the server actively degrades to a limiting level, responds to a connection failure result according to the request times of the client, returns the address of the server connected next time and re-request time, and records the request times of the client;
and if the maximum connection number is less than or equal to the current connection number, the server actively degrades to the highest level, rejects the connection request of the client, and returns a failure result and re-request time.
3. The method as claimed in claim 2, wherein when the server actively degrades to a limit level and the number of requests from the ue reaches a predetermined number of retries, the server allows the connection request from the ue to pass through and returns a success result.
4. The method as claimed in claim 2, wherein the re-request time is determined by the number of requests of the ue, and the interval for returning to the next re-request time is longer as the number of requests of the ue is greater.
5. The method as claimed in claim 1, wherein the step of throttling at the ue according to the number of connection failures includes:
setting a longest retry interval time at the client;
when the client side is connected for the first time, the client side directly requests the server side to establish a long connection channel;
when the client receives a failure result and re-request time returned by the server, the client requests to establish a long connection channel again after sleeping for the re-request time;
when the client sends a request and reaches the set unresponsive time, the client fails to receive a result returned by the server, the number of connection failures is added by 1, next retry interval time is determined according to the number of connection failures, and the client sleeps for the next retry interval time and then requests to establish a long connection channel again.
6. The long-connection-based message channel throttling method of claim 5, wherein the next retry interval is based on a client algorithm, and the next retry interval is a constant number of connection failures.
7. The method as claimed in claim 5, wherein when the longest retry interval is less than or equal to the next retry interval, the ue sleeps for the longest retry interval and requests to establish the long connection channel again.
8. The method as claimed in claim 1, wherein the current number of connections is decreased by 1 when the ue is disconnected from the server.
9. A long connection message channel based current limiting system, comprising a server and a client, wherein the server is in communication connection with the client, and the server and the client establish a long connection channel according to the long connection message channel based current limiting method claimed in any one of claims 1 to 8.
10. The long-connection message channel based current limiting system of claim 9, wherein the server comprises at least one server and the client comprises at least one of a smart phone, a smart watch, a tablet, and a PC.
CN202111219941.0A 2021-10-20 2021-10-20 Long connection message channel based current limiting method and system Pending CN113923163A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111219941.0A CN113923163A (en) 2021-10-20 2021-10-20 Long connection message channel based current limiting method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111219941.0A CN113923163A (en) 2021-10-20 2021-10-20 Long connection message channel based current limiting method and system

Publications (1)

Publication Number Publication Date
CN113923163A true CN113923163A (en) 2022-01-11

Family

ID=79241625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111219941.0A Pending CN113923163A (en) 2021-10-20 2021-10-20 Long connection message channel based current limiting method and system

Country Status (1)

Country Link
CN (1) CN113923163A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666207A (en) * 2022-03-17 2022-06-24 福建天晴数码有限公司 Scheme and system for client to request protection for server
WO2023231309A1 (en) * 2022-06-02 2023-12-07 天翼数字生活科技有限公司 Terminal device log request control method and system, and server

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829139A (en) * 2006-03-30 2006-09-06 阿里巴巴公司 Message repeating method and system
CN101741747A (en) * 2009-12-23 2010-06-16 上海交通大学 NFS (Network File System) flow control method for UDP (User Datagram Protocol) protocol
CN101909256A (en) * 2010-08-19 2010-12-08 中兴通讯股份有限公司 Method for querying user information and multimedia message center
CN102958101A (en) * 2012-12-03 2013-03-06 李俊 Method for avoiding wireless channel congestion on wireless communication terminal
CN104247340A (en) * 2012-03-22 2014-12-24 阿卡麦科技公司 Ethods and systems for performing message exchange accounting
CN106603598A (en) * 2015-10-15 2017-04-26 阿里巴巴集团控股有限公司 Method for processing service request and apparatus thereof
CN106612238A (en) * 2015-10-21 2017-05-03 阿里巴巴集团控股有限公司 Flow control method, device and system
CN109088828A (en) * 2018-08-03 2018-12-25 网宿科技股份有限公司 server overload control method and system
CN109697113A (en) * 2018-12-29 2019-04-30 广州华多网络科技有限公司 Request method, apparatus, equipment and the readable storage medium storing program for executing retried
CN109784065A (en) * 2018-12-04 2019-05-21 北京达佳互联信息技术有限公司 Access control method, device, server and storage medium
CN110290070A (en) * 2019-05-15 2019-09-27 北京三快在线科技有限公司 A kind of flow control methods, device, equipment and readable storage medium storing program for executing
CN110932988A (en) * 2019-10-31 2020-03-27 北京三快在线科技有限公司 Flow control method and device, electronic equipment and readable storage medium
CN110971561A (en) * 2018-09-28 2020-04-07 阿里巴巴集团控股有限公司 Access request processing method, device and equipment
CN111314433A (en) * 2020-01-20 2020-06-19 北京字节跳动网络技术有限公司 Message transmission method and device and electronic equipment
CN111935782A (en) * 2020-06-29 2020-11-13 福建天泉教育科技有限公司 Optimization method of client retry mechanism and storage medium
CN111953635A (en) * 2019-05-15 2020-11-17 福建天晴数码有限公司 Interface request processing method and computer-readable storage medium
CN113032410A (en) * 2019-12-25 2021-06-25 阿里巴巴集团控股有限公司 Data processing method and device, electronic equipment and computer storage medium

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1829139A (en) * 2006-03-30 2006-09-06 阿里巴巴公司 Message repeating method and system
CN101741747A (en) * 2009-12-23 2010-06-16 上海交通大学 NFS (Network File System) flow control method for UDP (User Datagram Protocol) protocol
CN101909256A (en) * 2010-08-19 2010-12-08 中兴通讯股份有限公司 Method for querying user information and multimedia message center
CN104247340A (en) * 2012-03-22 2014-12-24 阿卡麦科技公司 Ethods and systems for performing message exchange accounting
CN102958101A (en) * 2012-12-03 2013-03-06 李俊 Method for avoiding wireless channel congestion on wireless communication terminal
CN106603598A (en) * 2015-10-15 2017-04-26 阿里巴巴集团控股有限公司 Method for processing service request and apparatus thereof
CN106612238A (en) * 2015-10-21 2017-05-03 阿里巴巴集团控股有限公司 Flow control method, device and system
CN109088828A (en) * 2018-08-03 2018-12-25 网宿科技股份有限公司 server overload control method and system
CN110971561A (en) * 2018-09-28 2020-04-07 阿里巴巴集团控股有限公司 Access request processing method, device and equipment
CN109784065A (en) * 2018-12-04 2019-05-21 北京达佳互联信息技术有限公司 Access control method, device, server and storage medium
CN109697113A (en) * 2018-12-29 2019-04-30 广州华多网络科技有限公司 Request method, apparatus, equipment and the readable storage medium storing program for executing retried
CN110290070A (en) * 2019-05-15 2019-09-27 北京三快在线科技有限公司 A kind of flow control methods, device, equipment and readable storage medium storing program for executing
CN111953635A (en) * 2019-05-15 2020-11-17 福建天晴数码有限公司 Interface request processing method and computer-readable storage medium
CN110932988A (en) * 2019-10-31 2020-03-27 北京三快在线科技有限公司 Flow control method and device, electronic equipment and readable storage medium
CN113032410A (en) * 2019-12-25 2021-06-25 阿里巴巴集团控股有限公司 Data processing method and device, electronic equipment and computer storage medium
CN111314433A (en) * 2020-01-20 2020-06-19 北京字节跳动网络技术有限公司 Message transmission method and device and electronic equipment
CN111935782A (en) * 2020-06-29 2020-11-13 福建天泉教育科技有限公司 Optimization method of client retry mechanism and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114666207A (en) * 2022-03-17 2022-06-24 福建天晴数码有限公司 Scheme and system for client to request protection for server
CN114666207B (en) * 2022-03-17 2023-06-06 福建天晴数码有限公司 Scheme and system for client to request and protect server
WO2023231309A1 (en) * 2022-06-02 2023-12-07 天翼数字生活科技有限公司 Terminal device log request control method and system, and server

Similar Documents

Publication Publication Date Title
CN113923163A (en) Long connection message channel based current limiting method and system
CN108696884B (en) Method and device for improving paging type 2 performance of dual-card dual-standby equipment
US20040006714A1 (en) Method and system for veryfying the authenticity of a first communication participants in a communications network
CN108401002B (en) File transmission method and equipment
US11863436B2 (en) Intelligent internet traffic routing
CN101707618B (en) Authentication control method, device, system and authentication server
CN108924485B (en) Client real-time video stream interrupt processing method and system and monitoring system
CN111404918A (en) Cloud mobile phone distributed service emergency authentication method, device and system
CN112291501A (en) Video conference control method and device
CN113852866B (en) Media stream processing method, device and system
WO2020259381A1 (en) Method for processing mib message of lte system message, apparatus, base station, and storage medium
CN114885392A (en) Data transmission method, communication equipment and computer readable storage medium
CA2767076C (en) System and method for processing multimedia messaging service
US20050125836A1 (en) Shared wireless video downloading
US10588153B2 (en) System and method for restricting random access procedure-related activity in connection with a background application
CN112584408A (en) Method and device for reestablishing radio link failure and electronic equipment
CN110972140A (en) Method and device for processing information in telecommunication 4G mobile network
US20240073654A1 (en) Methods and systems for charging including a service usage based charging trigger condition
CN111615073B (en) Real-time data sharing method, device and system for 5G base station
EP2885940B1 (en) Throttling cell notification
CN108271071B (en) Method and device for improving video definition
CN116828022B (en) Method, device, equipment and medium for managing connection relation with server
CN116528375B (en) Bandwidth prediction method, bandwidth prediction device, and computer-readable storage medium
WO2023241049A1 (en) Ott call service control method, controller, and storage medium
EP4025008A1 (en) Voice-over-new-radio user identification method and base station

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