CN110995857B - Real-time high-concurrency long-connection timeout fast processing method - Google Patents

Real-time high-concurrency long-connection timeout fast processing method Download PDF

Info

Publication number
CN110995857B
CN110995857B CN201911297986.2A CN201911297986A CN110995857B CN 110995857 B CN110995857 B CN 110995857B CN 201911297986 A CN201911297986 A CN 201911297986A CN 110995857 B CN110995857 B CN 110995857B
Authority
CN
China
Prior art keywords
array
vehicle
time
vin
pointer
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.)
Active
Application number
CN201911297986.2A
Other languages
Chinese (zh)
Other versions
CN110995857A (en
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.)
FJ Motor Group Yudo New Energy Automobile Co Ltd
Original Assignee
FJ Motor Group Yudo New Energy Automobile 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 FJ Motor Group Yudo New Energy Automobile Co Ltd filed Critical FJ Motor Group Yudo New Energy Automobile Co Ltd
Priority to CN201911297986.2A priority Critical patent/CN110995857B/en
Publication of CN110995857A publication Critical patent/CN110995857A/en
Application granted granted Critical
Publication of CN110995857B publication Critical patent/CN110995857B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Cardiology (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to a real-time high-concurrency long-connection overtime fast processing method, which comprises the following steps: s1: constructing an array P with the length L and the address index i ═ 0,1,2, … …, L-1, wherein each element P (i) in the array comprises a vehicle identification set, the length L of the array P is a time threshold, and constructing a cross relationship table S2: starting the system; s3: initializing an array; s4: starting a thread and initializing a pointer value T; s5: acquiring signal data of all vehicles in the system within unit pointer time; s6: judging whether a vehicle sends a signal within the unit pointer time S7: and judging whether an ending instruction is received. According to the technical scheme, the mode that the array P (the length L of the array P is a time threshold) is preset in the cache, the cross relation table is adopted, and the pointer is set is adopted, in the processing process, the information of the unresponsive vehicles in the system is deleted in the cycle time period of the array, only the information of the responsive vehicles in the time period is reserved, the overall data volume of the array is small, and the traversal time period is short.

Description

Real-time high-concurrency long-connection timeout fast processing method
Technical Field
The invention relates to the field of car networking, in particular to a real-time high-concurrency long-connection timeout fast processing method.
Background
In the internet of vehicles industry, a TCP long connection mode is adopted between a terminal vehicle and a server, the real-time requirement of data is very high, after the vehicle reaches hundreds of thousands, the resource requirement of a server maintenance link is higher and higher, under the vehicle stop state, the terminal vehicle can enter a dormant state according to the design modes of self protection, resource saving and the like, the link disconnection requirement can be generated at the moment, and after the link is disconnected, how to release the resource efficiently and accurately in real time by the server is also an important influence factor for improving the terminal concurrent access amount.
At present, a common method is to store a unique vehicle identifier, a link id and the last reported data time in a Map, start an independent thread, and judge whether a link is overtime and needs to disconnect a recovered resource by periodically polling the Map and comparing whether the time exceeds an overtime threshold value. When the data reaches a certain amount, the traversal time period is long, and the real-time, efficient and accurate effect cannot be achieved.
Disclosure of Invention
Therefore, a real-time high-concurrency long-connection timeout fast processing method needs to be provided, which can form an original timeout threshold time zone short cycle, delete unresponsive vehicle data in real time, enable the overall data volume of an array to be small, enable the traversal time period to be short, close and disconnect the corresponding links responding within a short preset time in the cycle, and recycle resources.
In order to achieve the above object, the inventor provides a real-time high-concurrency long connection timeout fast processing method, which includes the following steps:
s1: constructing an array P with the length L and the address index i ═ 0,1,2, … …, L-1, wherein each element P (i) in the array comprises a vehicle identification set,
constructing a cross relation table, wherein the cross relation table comprises a response vehicle identification and a corresponding address subscript i of the last time the vehicle is written into the array P;
constructing a pointer;
s2: starting the system;
s3: initializing an array P, wherein each element P (i) in the array comprises all vehicle identification sets in the system;
s4: starting a thread and initializing a pointer value T;
s5: acquiring signal data of all vehicles in the system within unit pointer time;
s6: judging whether a vehicle sends a signal within unit pointer time; if yes, updating the cross-relationship table and the array P, and if not, deleting P (i) the vehicle identification set in the data unit of which the i is equal to T by the array P;
s7: and judging whether the receiving of the ending instruction is ended or not, if so, ending the signal acquisition and the data processing, otherwise, returning to the step S5 if T is equal to T + 1.
Further, the length L of the array P is a second value of the time threshold.
Further, the initialization pointer value is obtained by dividing the time for starting the system into a number of seconds, converting the number of seconds into a number of seconds, and dividing the number of seconds by L to obtain a remainder.
Further, the unit hand time is 1 s.
Further, the vehicle signal is a heartbeat packet signal reported by a vehicle terminal.
Further, the time threshold is 120 s.
Further, the vehicle identification is a vehicle-mounted terminal identification.
Further, the processing method of the cross relationship table and the array in the step S6 is as follows: if the vehicle-mounted terminal identification does not exist in the cross relationship table, writing the vehicle identification and the value i (i is T) which send signals into the cross relationship table, deleting the vehicle identification set in the data unit i (i) which is T by the array P, and writing the vehicle identification which sends signals into the array P; if the vehicle-mounted terminal identification exists in the cross relation table, updating the value of i, enabling i to be T, deleting the vehicle identification set in the data unit of P (i) and P (i) in the data unit of i to T, and writing the vehicle-mounted terminal identification which sends a signal.
The method is characterized in that the length of the array is set by presetting the array P (, the cross relation table and setting the pointer in the cache, the pointer value is defined by time, the pointer is associated with the address subscript of the array to form a short cycle of a time period, and the corresponding link which does not respond within a preset time threshold is closed and disconnected within 1 cycle period.
Drawings
Fig. 1 is a flowchart of a real-time high concurrency long connection timeout fast processing method according to an embodiment of the present invention.
Detailed Description
In order to explain technical contents, structural features, objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in combination with the embodiments.
In the embodiment, the vehicle-mounted terminal connection platform adopts TCP long connection, the terminal state is ensured to be online and active through a heartbeat mode, the reported heartbeat interval is set to be 60 seconds by referring to the definition of a national standard protocol, the platform processing principle is that if heartbeat data is not received within 120 seconds, the heartbeat data is considered to be overtime, and meanwhile, a link is disconnected and resources are recycled. Therefore, the present embodiment sets the array length L as the time threshold 120, and the address index includes (0, 1,2, 3 … … 119)120 values. And each vehicle-mounted terminal identification code in the array has a corresponding link, when the value of each vehicle-mounted terminal identification code in the array exists, the link is kept connected, and when the value of each vehicle-mounted terminal identification code in the array does not exist, the link is disconnected.
Referring to fig. 1, a flowchart of a real-time high concurrency rate connection fast processing method according to an embodiment of the present invention is shown.
S1: firstly, presetting an array P in a cache, wherein the length of the array P is 120; the address subscript of each element p (i) in the array is 0,1,2, … …, 119; each element P (i) in the array comprises a vehicle identification set List < vin >, and vin is the unique identification of the vehicle-mounted terminal;
meanwhile, a cross relation table Map < vin, i > is preset in the cache and comprises a signal vehicle identifier and a corresponding address subscript i of the last time the vehicle writes into the array P;
presetting a global pointer, setting an initial value as the fraction of a second (converted into a second) of the current time and the remainder of 120;
s2: the start-up of the system is carried out,
s3: initializing an array P, wherein each element P (i) in the array comprises all vehicle identification sets in the system;
s4, starting a thread and calculating a pointer value T;
in this embodiment, there are 5 vehicles in the system, vin (a), vin (b), vin (c), vin (d), vin (e). Thus, in P (i), vin (a), vin (b), vin (c), vin (d), and vin (e) are included.
And calculating an initial pointer value T, wherein the initial pointer value is obtained by dividing the time for starting the system into a minute and a second value, and the second value is divided by L to obtain the remainder.
In this embodiment, the time for starting the system is 12 o' clock, 2 min 0 sec, and the minutes and seconds are: 2 minutes and 0 seconds, and the remainder is 0 in terms of 120s and 120 s. Therefore, the initial pointer value T is 0 in this embodiment.
S5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by taking 1s as a unit pointer time and a pointer value T equal to 0;
s6: judging whether a vehicle sends a signal within unit pointer time 1S; when receiving the heartbeat packet reported by the vehicle-mounted terminal vin (a), the server writes i ═ T ═ 0 and vin (a) into a cross relationship table, which is MAP (vin (a), 0); meanwhile, the array P (0) is emptied of vin (a), vin (b), vin (c), vin (d), vin (e), and then written into vin (a).
S7: no end instruction is collected, T is 0+1 is 1, and the process returns to step S5:
s5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by taking 1s as a unit pointer time and a pointer value T as 1;
s6: judging whether a vehicle sends a signal within unit pointer time 1S; the server side empties the vin (a), the vin (b), the vin (c), the vin (d) and the vin (e) stored in the array P (1) when not receiving the heartbeat packet reported by the vehicle-mounted terminal,
s7: no end instruction is collected, T ═ 1+1 ═ 2, the process returns to step S5:
s5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by taking 1s as a unit to indicate time and setting a pointer value T to 2;
s6: judging whether a vehicle sends a signal within unit pointer time 1S; when the server side does not receive the heartbeat packet reported by the vehicle-mounted terminal, the server side empties vin (a), vin (b), vin (c), vin (d) and vin (e) stored in the array P (2),
s7: if no end command is collected, T is 2+1 is 3, and the process returns to step S5:
s5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by taking 1s as a unit pointer time and a pointer value T (2);
s6: judging whether a vehicle sends a signal within unit pointer time 1S; the server side empties the vin (a), the vin (b), the vin (c), the vin (d) and the vin (e) stored in the array P (2) when not receiving the heartbeat packet reported by the vehicle-mounted terminal,
s7: if no end command is collected, T + 2+1 is 3, and the process returns to step S5:
s5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by taking 1s as a unit to indicate time and a pointer value T (3);
s6: judging whether a vehicle sends a signal within unit pointer time 1S; the server receives the heartbeat packet reported by the vehicle-mounted terminal vin (a), vin (b), vin (d), updates the heartbeat packet into MAP (vin (a), (3), MAP (vin (b), (3), MAP (vin) (d), (3), and clears the vin (a), (vin) (b), vin (c), vin (d), and vin (e) stored in the array P (3) and writes the vin (a), (vin), (b), and vin (d).
S7: if no end command is collected, T is 2+1 is 3, and the process returns to step S5:
……
the server side does not receive the heartbeat packet reported by the vehicle-mounted terminal in the T-4 s-119, and clears the vin (a), vin (b), vin (c), vin (d) and vin (e) stored in the array P (4) -P (119).
S6: if no end command is collected, T119 +1 120, the process returns to step S4:
s5: acquiring heartbeat packet signal data of all vehicles vin (a), vin (b), vin (c), vin (d) and vin (e) in the system by using 1s as a unit pointer time, wherein a pointer value T is 120 and 120 is 0;
s6: judging whether a vehicle sends a signal within unit pointer time 1S; the server receives the heartbeat packets reported by the vehicle-mounted terminal vin (a), vin (b) and vin (d), updates the cross relationship table into MAP (vin (a), 0), MAP (vin (b), 0), MAP (vin (d) and 0), clears the vin (a) stored in the array P (0) and writes the vin (a), vin (b) and vin (d).
S7: and receiving an ending instruction, and ending the acquisition and data processing.
When T is 119S, the data of the in-vehicle terminal e is not present in the entire array of cache data, and the link corresponding to e is automatically disconnected, thereby recovering the resource. According to the technical scheme, the server does not receive heartbeat packet data corresponding to the vehicle-mounted terminal in the time threshold of 120s, and the link is disconnected.
In the processing process, the identifiers of the vehicles in the system are continuously deleted in the array within the cycle time period, and finally, only the information of the response vehicles within the time period is reserved, so that the overall data volume of the array is small, the traversal time period is short, and the real-time, efficient and accurate effect can be achieved.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal device including a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or terminal device. Without further limitation, an element defined by the phrases "comprising … …" or "comprising … …" does not exclude the presence of additional elements in a process, method, article, or terminal that comprises the element. Further, herein, "greater than," "less than," "more than," and the like are understood to exclude the present numbers; the terms "above", "below", "within" and the like are to be understood as including the number.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.

Claims (5)

1. A real-time high-concurrency long-connection timeout fast processing method is characterized by comprising the following steps:
s1: constructing an array P with the length L and the address index i ═ 0,1,2, … …, L-1, wherein each element P (i) in the array comprises a vehicle identification set, and the length L of the array P is a second value of a time threshold;
constructing a cross relation table, wherein the cross relation table comprises a signal vehicle identification and an address subscript of the last time the vehicle is written into the array P;
constructing a pointer;
s2: starting the system;
s3: initializing an array P, wherein each element P (i) in the array comprises all vehicle identification sets in the system;
s4: starting a thread, initializing a pointer value T, wherein the calculation method of the initialization pointer value is that after the time for starting the system is divided into minutes and seconds, the minutes and seconds value is converted into a seconds value, and the seconds value is divided by L in an integer manner, and then the remainder is obtained;
s5: in unit pointer time, data acquisition is carried out on signals of all vehicles in the system, wherein the signals of the vehicles are heartbeat packet signals reported by a vehicle terminal;
s6: judging whether a vehicle sends a signal within unit pointer time; if yes, updating the cross-relationship table and the array P, and if not, deleting P (i) the vehicle identification set in the data unit of which the i is equal to T by the array P;
s7: and judging whether the receiving of the ending instruction is ended or not, if so, ending signal acquisition and data processing, otherwise, enabling T to be T +1, if T does not reach the time threshold, returning to the step S5, if T reaches the time threshold, verifying whether each vehicle identifier in the array exists or not, if so, returning to the step S4, and if not, disconnecting the corresponding link and recycling resources.
2. The processing method according to claim 1, wherein the unit hand time is 1 s.
3. The process of claim 1, wherein the time threshold is 120.
4. The processing method according to claim 1, wherein the vehicle identifier is a vehicle-mounted terminal identifier.
5. The processing method according to claim 4, wherein the processing method of the cross relation table and the array in the step S6 is as follows: if the vehicle-mounted terminal identification does not exist in the cross relationship table, writing the vehicle identification and the value i (i is T) which send signals into the cross relationship table, deleting the vehicle identification set in the data unit i (i) which is T by the array P, and writing the vehicle identification which sends signals into the array P; if the vehicle-mounted terminal identification exists in the cross relation table, updating the value of i, enabling i to be T, deleting the vehicle identification set in the data unit of P (i) and P (i) in the data unit of i to T, and writing the vehicle-mounted terminal identification which sends a signal.
CN201911297986.2A 2019-12-17 2019-12-17 Real-time high-concurrency long-connection timeout fast processing method Active CN110995857B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911297986.2A CN110995857B (en) 2019-12-17 2019-12-17 Real-time high-concurrency long-connection timeout fast processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911297986.2A CN110995857B (en) 2019-12-17 2019-12-17 Real-time high-concurrency long-connection timeout fast processing method

Publications (2)

Publication Number Publication Date
CN110995857A CN110995857A (en) 2020-04-10
CN110995857B true CN110995857B (en) 2022-07-01

Family

ID=70094519

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911297986.2A Active CN110995857B (en) 2019-12-17 2019-12-17 Real-time high-concurrency long-connection timeout fast processing method

Country Status (1)

Country Link
CN (1) CN110995857B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115633005A (en) * 2022-10-26 2023-01-20 云度新能源汽车有限公司 Real-time high-concurrency connection processing method and processing system thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012024909A1 (en) * 2010-08-27 2012-03-01 中兴通讯股份有限公司 Long connection management apparatus and link resource management method for long connection communication
CN104900082A (en) * 2015-05-15 2015-09-09 四川大学 Data transmission method and device for traffic situation sensing
CN105743716A (en) * 2016-04-21 2016-07-06 大连理工大学 Method for dynamic planning of Ethernet network path of train
CN108900370A (en) * 2018-06-08 2018-11-27 努比亚技术有限公司 It is long to connect multiple overtime judgment method, device and computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080109470A1 (en) * 2003-09-11 2008-05-08 Mcgee Steven James Method to enable the heartbeat beacon for homeland security and homeland defense interoperability
US8935654B2 (en) * 2011-04-21 2015-01-13 Accenture Global Services Limited Analysis system for test artifact generation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012024909A1 (en) * 2010-08-27 2012-03-01 中兴通讯股份有限公司 Long connection management apparatus and link resource management method for long connection communication
CN104900082A (en) * 2015-05-15 2015-09-09 四川大学 Data transmission method and device for traffic situation sensing
CN105743716A (en) * 2016-04-21 2016-07-06 大连理工大学 Method for dynamic planning of Ethernet network path of train
CN108900370A (en) * 2018-06-08 2018-11-27 努比亚技术有限公司 It is long to connect multiple overtime judgment method, device and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于HTTP长连接的消息推送平台的研究与实现;杨文婷;《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》;20130715(第7期);全文 *

Also Published As

Publication number Publication date
CN110995857A (en) 2020-04-10

Similar Documents

Publication Publication Date Title
WO2022227711A1 (en) Parking route sharing method and apparatus, and device and storage medium
CN110995857B (en) Real-time high-concurrency long-connection timeout fast processing method
CN114301938B (en) Vehicle-road cooperative vehicle event determining method, related device and computer program product
CN109947729B (en) Real-time data analysis method and device
US20220020068A1 (en) Method for generating billing information, terminal, server, and system
CN111367952B (en) Paging query method, system and computer readable storage medium for cache data
CN113489653A (en) Message sending method and device and computer equipment
CN111130673B (en) Vehicle-mounted terminal time synchronization method and system
CN107846419B (en) Method and system for transmitting OBD data of vehicle engine
CN117474091A (en) Knowledge graph construction method, device, equipment and storage medium
CN110609555B (en) Method, apparatus, electronic device, and computer-readable storage medium for signal control
CN116582851A (en) Vehicle-ground LTE wireless network access method, device, equipment and storage medium
CN116450176A (en) Version updating method and device, electronic equipment and storage medium
CN113297218B (en) Multi-system data interaction method, device and system
CN102811154B (en) Resource acquisition method and network server system
CN114553944A (en) Early warning message pushing method and system
CN114036195A (en) Data request processing method, device, server and storage medium
CN104735097A (en) Information collecting method and system
CN110794714A (en) Automatic cleaning method and system for community seats
CN111343101A (en) Server current limiting method and device, electronic equipment and readable storage medium
CN115277675B (en) Data stream processing method, device, electronic equipment and readable storage medium
CN115063998B (en) Auxiliary driving data transmission method, device and equipment
KR101703303B1 (en) Device and method for managing environment of system
CN113360688B (en) Method, device and system for constructing information base
CN115571072B (en) Head-up display mode conversion method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant