CN110719232A - Data transmission method and device, mobile terminal and storage medium - Google Patents

Data transmission method and device, mobile terminal and storage medium Download PDF

Info

Publication number
CN110719232A
CN110719232A CN201910942274.5A CN201910942274A CN110719232A CN 110719232 A CN110719232 A CN 110719232A CN 201910942274 A CN201910942274 A CN 201910942274A CN 110719232 A CN110719232 A CN 110719232A
Authority
CN
China
Prior art keywords
data
category
returned
returned data
server
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
CN201910942274.5A
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.)
Beijing Opper Communication Co Ltd
Original Assignee
Beijing Opper Communication 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 Beijing Opper Communication Co Ltd filed Critical Beijing Opper Communication Co Ltd
Priority to CN201910942274.5A priority Critical patent/CN110719232A/en
Publication of CN110719232A publication Critical patent/CN110719232A/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/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6275Queue scheduling characterised by scheduling criteria for service slots or service orders based on priority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6295Queue scheduling characterised by scheduling criteria using multiple queues, one for each individual QoS, connection, flow or priority

Abstract

The application discloses a data transmission method, a device, a mobile terminal and a storage medium, wherein the data transmission method comprises the following steps: acquiring returned data to be returned to a server by a client; identifying a category corresponding to the returned data; if the category is the first category, caching the returned data in a cache queue in a memory; if the category is a second category, storing the return data in a disk, wherein the real-time requirement of the data of the first category during transmission is higher than that of the data of the second category during transmission; and sending the return data buffered in the buffer queue or the return data stored in the disk to the server. The method can ensure the real-time performance and the integrity of data return.

Description

Data transmission method and device, mobile terminal and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to a data transmission method, an apparatus, a mobile terminal, and a storage medium.
Background
Mobile terminals, such as mobile phones, tablet computers, etc., have become one of the most common consumer electronic products in people's daily life. With the development of the service of the mobile terminal, the data return amount of the application of the mobile terminal is larger and larger, the real-time requirement on the data return is higher and higher, and the real-time performance of the data return is difficult to guarantee for the current transmission scheme of the returned data.
Disclosure of Invention
In view of the above problems, the present application provides a data transmission method, apparatus, mobile terminal and storage medium to improve the above problems.
In a first aspect, an embodiment of the present application provides a data transmission method, where the method includes: acquiring returned data to be returned to a server by a client; identifying a category corresponding to the returned data; if the category is the first category, caching the returned data in a cache queue in a memory; if the category is a second category, storing the return data in a disk, wherein the real-time requirement of the data of the first category during transmission is higher than that of the data of the second category during transmission; and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
In a second aspect, an embodiment of the present application provides a data transmission apparatus, where the apparatus includes: the client side comprises a data acquisition module, a data identification module, a first storage module, a second storage module and a data sending module, wherein the data acquisition module is used for acquiring returned data to be returned to the server by the client side; the data identification module is used for identifying the category corresponding to the returned data; the first storage module is used for caching the returned data in a cache queue in a memory if the category is a first category; the second storage module is used for storing the returned data in a disk if the category is a second category, and the real-time requirement of the data of the first category during transmission is higher than that of the data of the second category during transmission; the data sending module is used for sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
In a third aspect, an embodiment of the present application provides a mobile terminal, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the data transfer method provided by the first aspect above.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, and the program code may be called by a processor to execute the data transmission method provided in the first aspect.
According to the scheme provided by the application, the returned data to be returned to the server by the client are obtained, the category corresponding to the returned data is identified, if the category is the first category, the returned data is cached in the cache queue in the memory, and if the category is the second category, the returned data is stored in the disk, wherein the real-time requirement of the first category of data during transmission is higher than the real-time requirement of the second category of data during transmission, then the returned data cached in the cache queue or the returned data stored in the disk are sent to the server, so that the returned data with high real-time requirement is realized, when returned, the returned data is cached in the cache queue in the memory, then the returned data in the cache queue is sent to the server, and the real-time performance of the returned data is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a flow chart of a data transmission method according to an embodiment of the application.
FIG. 2 illustrates a schematic diagram of a data transfer method according to one embodiment of the present application.
Fig. 3 shows a flow chart of a data transmission method according to another embodiment of the present application.
Fig. 4 shows a flowchart of step S220 in a data transmission method according to another embodiment of the present application.
Fig. 5 shows a flow chart of a data transmission method according to yet another embodiment of the present application.
Fig. 6 shows a flow chart of a data transmission method according to yet another embodiment of the present application.
FIG. 7 shows a block diagram of a data transmission device according to an embodiment of the present application.
Fig. 8 shows a block diagram of a data identification module in a data transmission device according to an embodiment of the present application.
FIG. 9 is a block diagram illustrating a first memory module in a data transfer device according to one embodiment of the present application.
Fig. 10 is a block diagram of a mobile terminal for executing a data transmission method according to an embodiment of the present application.
Fig. 11 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a data transmission method according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
With the rapid development of the services of the mobile terminal, more and more data need to be returned by the application program of the mobile terminal, the data volume is larger and larger, and the demand is more complex. On the basis of ensuring the reliability and integrity of mass data transmission, higher requirements are also put forward on the real-time property of data transmission. For example, an Application program (APP) may generate a large amount of log data during running, and the log data may need to be transmitted back to a server of a third party, so that the server of the third party feeds back corresponding data to the APP.
The traditional transmission scheme of data needing to be returned by an application program is that returned data is put into a distributed message queue, and in order to prevent data loss, the message queue stores the data into a disk, that is, the data is stored in a disk-dropping manner, and then the data is taken out of the disk to be returned, so that the reliability and integrity of the returned data during returning are ensured.
The inventor finds that, after a long time of research, when returning the returned data generated by the application program, performing the disk-dropping storage operation will significantly increase the delay of the data return. Particularly, when the storage medium for the disk-dropping storage is a mechanical disk, the delay condition is more prominent, so that the real-time performance of the data with high real-time requirement during returning is difficult to ensure.
In view of the above problems, the inventor proposes a data transmission method, an apparatus, a mobile terminal and a storage medium provided in the embodiments of the present application, where data with high real-time requirement during transmission is cached in a cache queue in a memory, and data with low real-time requirement is subjected to disk-dropping storage, and then the data is returned to a server, so as to meet the real-time requirement during data return. The specific data transmission method is described in detail in the following embodiments.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a data transmission method according to an embodiment of the present application. The data transmission method is used for caching data with high real-time requirement in transmission into a cache queue in a memory, performing disk-dropping storage on the data with low real-time requirement, and then transmitting the data back to the server, so that the real-time requirement in data transmission back is met. In a specific embodiment, the data transmission method is applied to the data transmission apparatus 400 shown in fig. 7 and the mobile terminal 100 (fig. 10) configured with the data transmission apparatus 400. The following will describe a specific flow of the embodiment by taking a mobile terminal as an example, and it is understood that the mobile terminal applied in the embodiment may be a smart phone, a tablet computer, a smart watch, and the like, which is not limited herein. As will be described in detail with respect to the flow shown in fig. 1, the data transmission method may specifically include the following steps:
step S110: and acquiring returned data to be returned to the server by the client.
In the embodiment of the application, the client installed in the mobile terminal can generate return data which needs to be returned to the server when the client runs. The client may be an Application program (APP) installed in the mobile terminal. The returned data may include log data (e.g., service access log, permission log, account log, etc.) generated during the operation of the client, operation data of the user, device data of the mobile terminal, etc., and the returned data is used for being returned to the server which has a demand on the data generated during the operation of the client. The server may be a server corresponding to the client, or may also be a third-party server, which is not limited herein. For example, when the browser application runs, access data for a web page in the browser application may be transmitted back to a server of a browser vendor, so that the browser vendor optimizes content recommended in the browser, and the like; for another example, when the game application runs, the state data of the user for the device may be returned to the server of the game application vendor, so that the game application vendor optimizes the game, and the like.
In some embodiments, as shown in fig. 2, the backhaul data generated in the client may be transmitted to the data receiving module through the data backhaul module, so as to trigger backhaul of the backhaul data. The data postback module can call a data postback function in a Software Development Kit (SDK) of the client and initiate a POST request, so as to transmit postback data to the data receiving module. The data receiving module can be an HTTP Server module, the POST is one of eight HTTP request methods specified by HTTP/1.1 protocol, and the POST method is generally used for submitting data to the Server.
Step S120: and identifying the category corresponding to the returned data.
In the return data generated by the client of the mobile terminal, some return data need to be transmitted to the server in real time, so that the server can acquire the return data in time. For some backtransmission data, it is desirable to maintain its integrity and reliability without being lost at will. Therefore, the returned data can be identified to confirm the requirement of returning the returned data.
In the embodiment of the application, the category corresponding to the returned data can be identified to determine the real-time requirement when the returned data is returned. It can be understood that the type corresponding to the returned data may be preset, and the types corresponding to the returned data are different, and the real-time requirements during returning are also different.
In some embodiments, the category corresponding to the returned data may be determined by analyzing the field in the returned data and then according to the content of the set field in the analysis result. In other embodiments, the category to which the returned data belongs may be determined according to the content type of the returned data by identifying the content type of the returned data. Of course, the specific manner for determining the category corresponding to the backhaul data may not be limited, and for example, the category corresponding to the backhaul data may also be determined by identifying the type of the client. As shown in fig. 2, after the returned data reaches the data receiving module, the data receiving module may identify the category corresponding to the returned data to determine the processing manner of the returned data.
Step S130: and if the category is the first category, caching the returned data in a cache queue in a memory.
In the embodiment of the application, the category corresponding to the returned data can be obtained by identifying the category corresponding to the returned data. And when returning the returned data, determining which channel to enter for transmission during returning according to the category corresponding to the returned data.
In some embodiments, if the category corresponding to the backhaul data is the first category, the backhaul data may enter a transmission channel with high real-time performance for transmission. Specifically, the returned data can be buffered in a buffer queue in the memory, and the returned data entering the buffer queue can be sent to the server, so that the returned data can be sent to the server in real time.
Step S140: and if the type is a second type, storing the return data in a disk, wherein the real-time requirement of the first type of data during transmission is higher than that of the second type of data during transmission.
In some embodiments, if the category corresponding to the backhaul data is the second category, the backhaul data may enter a transmission channel with lower real-time performance than the transmission channel in step S130 for transmission. Specifically, the real-time requirement of the second type of data during transmission is lower than that of the first type of data during transmission, so that the returned data can be stored in the disk, and the returned data stored in the disk can be taken out and sent when being sent to the server.
Step S150: and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
In the embodiment of the application, after the returned data is cached in the cache queue in the memory or the returned data is stored in the disk in a landing manner, the returned data in the cache queue or the returned data in the disk can be sent to the server. As can be understood, when the return data is cached in the cache queue in the memory, the return data is retrieved from the cache queue and sent to the server; and when the return data is stored in the disk, the return data is taken from the corresponding folder of the disk and sent to the server.
As a specific implementation manner, as shown in fig. 2, when the data receiving module determines that the category corresponding to the returned data is the first category, the data receiving module may cache the returned data in a cache queue of the memory module, and after the returned data enters the cache queue, the returned data is immediately taken away by the data pushing module including the data pushing logic, and a POST request is sent to send the returned data to the server in real time. When the data receiving module determines that the category corresponding to the returned data is the second category, the data receiving module stores the returned data in a storage system (a magnetic disk), and then takes the returned data out of the storage system and sends the returned data to the server.
According to the data transmission method provided by the embodiment of the application, the type corresponding to the returned data is identified by obtaining the returned data to be returned to the server, the returned data is cached in the cache queue in the memory if the type is the first type, and the returned data is stored in the disk if the type is the second type, wherein the real-time requirement of the first type of data during transmission is higher than the real-time requirement of the second type of data during transmission, and then the returned data cached in the cache queue or the returned data stored in the disk are sent to the server, so that the returned data with high real-time requirement is realized, the returned data is cached in the cache queue in the memory during returning, and then the returned data in the cache queue is sent to the server, and the return real-time performance of the returned data is improved.
Referring to fig. 3, fig. 3 is a schematic flow chart illustrating a data transmission method according to another embodiment of the present application. The method is applied to the mobile terminal, and will be described in detail with respect to the flow shown in fig. 3, where the data transmission method may specifically include the following steps:
step S210: and acquiring returned data to be returned to the server by the client.
In the embodiment of the present application, step S210 may refer to the contents of the foregoing embodiments, which are not described herein again.
Step S220: classifying the returned data according to a preset classification strategy to obtain a class corresponding to the returned data, wherein the classification strategy is used for classifying the data according to the real-time requirement of the data during transmission.
In the embodiment of the present application, a preset classification policy may be stored in the mobile terminal, where the classification policy is used to classify data according to real-time requirements of the data during transmission, so as to classify returned data with different real-time requirements into different categories. When the mobile terminal identifies the category corresponding to the returned data, the classification strategy can be called to classify the returned data, so as to obtain the category corresponding to the returned data.
In some embodiments, the classification policy may identify the category corresponding to the returned data according to the content of the set field in the returned data, or may identify the corresponding category of the returned data according to the content type of the returned data, which is not limited herein.
In some embodiments, referring to fig. 4, classifying the backhaul data according to a preset classification policy to obtain a category corresponding to the backhaul data may include:
step S221: and checking the returned data to determine whether the returned data is legal data.
It can be understood that, when the returned data is returned, the returned data may be checked to determine the validity of the returned data, avoid the access of illegal data, and prevent the intrusion of illegal persons (e.g. hackers) into the interface.
In some embodiments, a preset verification key may be added to the returned data, so that when the returned data is verified, the verification key in the returned data may be verified, when the verification of the key passes, the returned data is determined to be legal data, and when the verification of the key does not pass, the returned data is determined not to be legal data. For example, if the first 5 bits of the returned data are used to store the verification key, the key verification may be performed on the first 5 bits of the key data, so as to determine whether the returned data is legal.
Step S222: and if the returned data is legal data, analyzing the returned data to obtain an analysis result.
In the embodiment of the present application, when it is verified that the returned data is legal, it indicates that the returned data can be returned, so that the returned data can be analyzed to obtain an analysis result of the returned data, so as to classify the returned data according to the analysis result. The analysis result may include the content of each field of the returned data, the content type of the returned data, the data amount of the returned data, the generation time of the returned data, and the like, and the specific analysis result may not be limited.
Step S223: and classifying the returned data according to the analysis result and a preset classification strategy to obtain the corresponding category of the returned data.
In the embodiment of the present application, after the analysis result of the returned data is obtained, the returned data may be classified according to the analysis result and by using a preset classification policy, so as to obtain the category corresponding to the returned data. The different analysis results in the classification policy may correspond to different categories, for example, if the content of the set field is different, the category corresponding to the returned data is different, and if the data amount of the returned data is different, the category corresponding to the returned data is different, which is not limited herein.
In some embodiments, the parsing result may include a data identification of the backtransmission data. The data identifier of the returned data may be data content of a set field in the returned data preset between the partners. Specifically, the data identifier may be a buried point in the set field, and the buried point may be used as an identifier for the returned data to determine the category corresponding to the returned data, for example, the buried point corresponding to the first category may be 00, the buried point corresponding to the second category may be 01, which is not limited herein, and the specific buried point may be determined jointly by the collaborators.
In this embodiment, the classifying the returned data according to the analysis result and a preset classification policy to obtain a category corresponding to the returned data may include:
and obtaining the category corresponding to the returned data based on a preset classification strategy, and adding a label corresponding to the returned data identifier to the returned data, wherein the label is used for representing the category of the returned data.
It can be understood that, based on the classification policy, a category corresponding to the data identifier can be identified, where the category is a category corresponding to the returned data, and a tag corresponding to the data identifier can be added to the returned data, where the tag can be used to characterize the category of the returned data, and the category of the returned data can be known according to the tag. As shown in fig. 2, after the data receiving module adds a tag to the returned data, it can be determined that the returned data is sent to the memory module to be cached in the cache queue of the memory, or the returned data is stored in the disk.
Step S230: and if the category is the first category, caching the returned data in a cache queue in a memory.
Step S240: and if the type is a second type, storing the return data in a disk, wherein the real-time requirement of the first type of data during transmission is higher than that of the second type of data during transmission.
Step S250: and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
In the embodiment of the present application, steps S230 to S250 may refer to the contents of the foregoing embodiments, and are not described herein again.
The data transmission method provided in the embodiment of the application obtains the category corresponding to the returned data after checking and analyzing the returned data by obtaining the returned data to be returned to the server generated by the client, caches the returned data in the cache queue in the memory when the category corresponding to the returned data is the first category, and stores the returned data in the disk when the category corresponding to the returned data is the second category, wherein the real-time requirement of the first category of data during transmission is higher than the real-time requirement of the second category of data during transmission, and then sends the returned data cached in the cache queue or the returned data stored in the disk to the server, thereby realizing the returned data with high real-time requirement, caching the returned data in the cache queue in the memory during returning, and then sending the returned data in the cache queue to the server, the real-time performance of data return is improved.
Referring to fig. 5, fig. 5 is a schematic flowchart illustrating a data transmission method according to another embodiment of the present application. The method is applied to the mobile terminal, and will be described in detail with respect to the flow shown in fig. 5, where the data transmission method may specifically include the following steps:
step S310: and acquiring returned data to be returned to the server by the client.
In the embodiment of the present application, the step S310 may refer to the contents of the foregoing embodiments, and is not described herein again.
Step S320: and acquiring the priority corresponding to the server according to a pre-stored priority list.
In the embodiment of the present application, when the category corresponding to the returned data is identified, the category corresponding to the returned data may be determined according to the priority of the server to which the returned data is to be returned. The mobile terminal may store a priority list in advance, where the priority list includes priorities corresponding to the servers, and the higher the priority of the server is, the higher the real-time performance of the return data that needs to be returned to the server is.
Step S330: and when the priority is the first priority, determining that the category corresponding to the returned data is the first category.
Step S340: and when the priority is a second priority, determining that the category corresponding to the returned data is a second category, wherein the first priority is higher than the second priority.
In some embodiments, if the priority corresponding to the server is the first priority, the category corresponding to the returned data that needs to be returned to the server is the first category; if the priority corresponding to the server is the second priority, the category corresponding to the returned data that needs to be returned to the server is the second category. The first priority is higher than the second priority, and the higher the priority of the server is, the higher the real-time performance of the demand of the return data which needs to be returned to the server is, so that the real-time performance demand of the data corresponding to the first category is higher than the real-time performance demand of the data corresponding to the second category during transmission. By determining the type of the returned data according to the priority of the server, namely determining the real-time performance of data transmission, the priority of the server of the partner can be set according to the relationship of different partners, and the real-time performance of the returned data transmitted to the server of the partner can be further determined.
Step S350: and if the category is the first category, caching the returned data in a cache queue in a memory.
Step S360: and if the type is a second type, storing the return data in a disk, wherein the real-time requirement of the first type of data during transmission is higher than that of the second type of data during transmission.
Step S370: and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
The data transmission method provided by the embodiment of the application includes the steps of obtaining return data to be returned to a server, which is generated by a client, determining the type corresponding to the return data according to the priority of the server, caching the return data in a cache queue in a memory when the type corresponding to the return data is a first type, storing the return data in a disk when the type corresponding to the return data is a second type, wherein the real-time requirement of the first type of data during transmission is higher than the real-time requirement of the second type of data during transmission, sending the return data cached in the cache queue or the return data stored in the disk to the server, so that the return data with high real-time requirement is cached in the cache queue of the memory during return, and then sending the return data in the cache queue to the server, the real-time performance of data return is improved.
Referring to fig. 6, fig. 6 is a schematic flowchart illustrating a data transmission method according to still another embodiment of the present application. The method is applied to the mobile terminal, and will be described in detail with respect to the flow shown in fig. 6, where the data transmission method may specifically include the following steps:
step S410: and acquiring returned data to be returned to the server by the client.
Step S420: and identifying the category corresponding to the returned data.
In the embodiment of the present application, reference may be made to the contents of the foregoing embodiment in step S410 and step S420.
Step S430: and if the category is the first category, judging whether the current data volume in the cache queue reaches a cache threshold value.
In this embodiment of the application, when the category corresponding to the returned data is identified as the first category and the returned data is cached in the cache queue in the memory, the data amount in the cache queue may be determined, and whether the data amount reaches the cache threshold value is determined. The buffer threshold may be determined according to the size of the memory that can be allocated to the data backhaul service, or may be determined according to a configuration file, which is not limited herein.
It can be understood that the buffering threshold, the data inflow speed, and the data outflow speed of the buffer queue in the memory affect the real-time data transmission efficiency, and therefore, when the data amount in the buffer queue reaches the buffering threshold, the transmission efficiency of the new returned data is affected.
Step S440: and if the buffer threshold value is reached, buffering the returned data in the buffer queue in the memory after removing part of the data in the buffer queue.
In the embodiment of the application, when the data amount in the buffer queue reaches the buffer threshold, part of the data in the buffer queue can be removed, so that the returned data can be buffered in the buffer queue in time, and the buffer queue can be sent to the server in time subsequently. It can be understood that, for the first category of return data, the real-time requirement is high, and the data needs to be fed back to the server in time, but if the data is not sent to the server in time, the value is lost, so the data can be cleared, and the latest return data is cached in the cache queue and sent to the server. And if the data amount in the buffer queue does not reach the buffer threshold, the returned data can be directly buffered in the buffer queue in the memory.
In some embodiments, when the amount of data in the buffer queue reaches the buffer threshold, the portion of data in the buffer queue that needs to be cleared may be determined according to the buffer time when the data is buffered in the buffer queue. Specifically, the partial data with the earliest cache time may be selected as the partial data to be cleared.
In some embodiments, the data to be cleared in the buffer queue may also be all data in the buffer queue. It can be understood that, when the data amount in the buffer queue reaches the buffer threshold, all the data in the buffer queue is cleared, so that the returned data can be buffered in the buffer queue and simultaneously transmitted to the server immediately, thereby improving the real-time performance of the returned data and meeting the service requirement.
In other embodiments, the data to be cleared may also be taken out from the buffer queue and stored in the disk for subsequent transmission to the server, so that although the real-time performance of the previous return data during return cannot be guaranteed, the integrity of the return data is also guaranteed.
Step S450: and if the type is a second type, storing the return data in a disk, wherein the real-time requirement of the first type of data during transmission is higher than that of the second type of data during transmission.
In the embodiment of the present application, step S450 may refer to the contents of the foregoing embodiments, and is not described herein again.
Step S460: and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
In the embodiment of the present application, step S460 may refer to the contents of the foregoing embodiments, and is not described herein again.
In some embodiments, when the backhaul data buffered in the cache queue is sent to the server, there may be a plurality of different backhaul data in the cache queue being transmitted back to the same or different servers, so that for the plurality of different backhaul data, a plurality of threads may be started to respectively transmit back the plurality of different backhaul data, that is, each thread corresponds to the backhaul data, thereby increasing the backhaul efficiency of the backhaul data.
In some embodiments, the backhaul data stored in the disk, in addition to being sent to the server, can be permanently stored in the disk, so that the backhaul data can be subsequently sent to other servers according to other business requirements.
In this embodiment, the data transmission method may further include: and if the type is the third type, caching the returned data in a cache queue in a memory, and storing the returned data in a disk. It can be understood that some backhaul data may need to be timely transmitted back to the server and also need to be stored on the disk for subsequent verification, secondary use, and the like, and therefore, the category corresponding to this type of backhaul data may be set as the third category, so as to simultaneously cache the backhaul data in the cache queue in the memory and store the backhaul data in the disk.
Further, the sending the returned data buffered in the buffer queue or the returned data stored in the disk to the server includes: and sending the return data buffered in the buffer queue to the server. It can be understood that, when the returned data is cached in the cache queue in the memory and the returned data is stored in the disk, the returned data in the cache queue only needs to be sent to the server, thereby ensuring the return real-time performance of the returned data.
The returned data stored in the disk can be used for verification, subsequent secondary utilization and the like. Therefore, the data transmission method may further include: receiving data requests sent by other servers; and responding to the data request, and sending the return data stored in the disk to the other servers.
In some embodiments, when the class corresponding to the returned data is identified as the first class and it is determined that the returned data is to pass through the transmission channel with high real-time performance (that is, the returned data in the buffer queue is returned after passing through the buffer queue buffered in the memory), when the data amount in the buffer queue reaches the set threshold but does not reach the buffer threshold, the returned data may be cleared in order to avoid that the data amount in the buffer queue subsequently reaches the buffer threshold after the returned data is buffered in the buffer queue, and therefore, the returned data may also be stored to the disk while the returned data is buffered in the buffer queue, so as to avoid the loss of the returned data.
According to the data transmission method provided by the embodiment of the application, return data to be returned to a server, which are generated by a client, are acquired, then the category corresponding to the return data is determined, when the category corresponding to the return data is a first category, whether the data quantity of a cache queue in a memory reaches a cache threshold value is judged, if the data quantity reaches the cache threshold value, at least part of the data in the cache queue is cleared, then the return data is cached in the cache queue in the memory, and when the category corresponding to the return data is a second category, the return data is stored in a disk, wherein the real-time requirement of the first category of data during transmission is higher than the real-time requirement of the second category of data during transmission. In addition, when the category corresponding to the returned data is the third category, the returned data is cached in the cache queue in the memory and stored in the disk, and then the returned data cached in the cache queue or the returned data stored in the disk is sent to the server, so that the returned data with high real-time requirement is realized.
Referring to fig. 7, a block diagram of a data transmission apparatus 400 according to an embodiment of the present disclosure is shown. The data transmission apparatus 400 is applied to the mobile terminal, and the data transmission apparatus 400 includes: a data acquisition module 410, a data identification module 420, a first storage module 430, a second storage module 440, and a data transmission module 450. The data obtaining module 410 is configured to obtain returned data to be returned to the server by the client; the data identification module 420 is configured to identify a category corresponding to the returned data; the first storage module 430 is configured to, if the category is a first category, cache the returned data in a cache queue in a memory; the second storage module 440 is configured to store the backhaul data in a disk if the category is a second category, where a real-time requirement of the first category of data during transmission is higher than a real-time requirement of the second category of data during transmission; the data sending module 450 is configured to send the returned data buffered in the buffer queue or the returned data stored in the disk to the server.
In some embodiments, the data identification module 420 may be specifically configured to: classifying the returned data according to a preset classification strategy to obtain a class corresponding to the returned data, wherein the classification strategy is used for classifying the data according to the real-time requirement of the data during transmission.
In this embodiment, the classifying, by the data identifying module 420, the returned data according to a preset classification policy to obtain a category corresponding to the returned data may include: checking the returned data to determine whether the returned data is legal data; if the returned data is legal data, analyzing the returned data to obtain an analysis result; and classifying the returned data according to the analysis result and a preset classification strategy to obtain the corresponding category of the returned data.
Further, the analysis result includes a data identifier of the returned data. The data identification module 420 classifies the returned data according to the analysis result and a preset classification policy, and obtains a category corresponding to the returned data, including: and obtaining the category corresponding to the returned data based on a preset classification strategy, and adding a label corresponding to the data identifier to the returned data, wherein the label is used for representing the category of the returned data.
In some embodiments, referring to fig. 8, the data identification module 420 may include: a priority acquisition unit 421, a first determination unit 422, and a second determination unit 423. The priority obtaining unit 421 is configured to obtain a priority corresponding to the server according to a pre-stored priority list; the first determining unit 422 is configured to determine, when the priority is a first priority, that the category corresponding to the backhaul data is a first category; the second determining unit 423 is configured to determine, when the priority is a second priority, that the category corresponding to the backhaul data is a second category, where the first priority is higher than the second priority.
In some embodiments, referring to fig. 9, the first storage module 430 may include a data amount determination unit 431 and a data buffer unit 432. The data amount judgment unit 431 is configured to judge whether the current data amount in the cache queue reaches a cache threshold value if the category is a first category; the data buffering unit 432 is configured to, if the buffering threshold is reached, buffer the returned data in the buffer queue in the memory after the part of the data in the buffer queue is cleared.
In some embodiments, the data transmission apparatus 400 may further include a third storage module. The third storage module is configured to cache the returned data in a cache queue in the memory and store the returned data in a disk if the category is a third category.
In this embodiment, the data sending module 450 may specifically be configured to: and sending the return data buffered in the buffer queue to the server.
Further, the data transmission apparatus 400 may further include a request receiving module. The request receiving module is used for receiving data requests sent by other servers; the data sending module 450 may be further configured to send the returned data stored in the disk to the other server in response to the data request.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
To sum up, according to the scheme provided by the application, the returned data to be returned to the server by the client is obtained, the category corresponding to the returned data is identified, if the category is the first category, the returned data is cached in the cache queue in the memory, and if the category is the second category, the returned data is stored in the disk, wherein the real-time requirement of the first category of data during transmission is higher than the real-time requirement of the second category of data during transmission, and then the returned data cached in the cache queue or the returned data stored in the disk is sent to the server, so that the returned data with high real-time requirement is realized, and when returned, the returned data is cached in the cache queue in the memory, and then the returned data in the cache queue is sent to the server, so that the real-time performance of data return is improved.
Referring to fig. 10, a block diagram of a mobile terminal according to an embodiment of the present application is shown. The mobile terminal 100 may be a smart phone, a tablet computer, a smart watch, an electronic book, or other mobile terminals capable of running an application. The mobile terminal 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more programs configured to perform a method as described in the aforementioned method embodiments.
Processor 110 may include one or more processing cores. The processor 110 interfaces with various components throughout the mobile terminal 100 using various interfaces and lines, and performs various functions of the mobile terminal 100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120 and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 110 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 110, but may be implemented by a communication chip.
The Memory 120 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, code sets, or instruction sets. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
Referring to fig. 11, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (11)

1. A method of data transmission, the method comprising:
acquiring returned data to be returned to a server by a client;
identifying a category corresponding to the returned data;
if the category is the first category, caching the returned data in a cache queue in a memory;
if the category is a second category, storing the return data in a disk, wherein the real-time requirement of the data of the first category during transmission is higher than that of the data of the second category during transmission;
and sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
2. The method of claim 1, wherein the identifying the category to which the backhaul data corresponds comprises:
classifying the returned data according to a preset classification strategy to obtain a class corresponding to the returned data, wherein the classification strategy is used for classifying the data according to the real-time requirement of the data during transmission.
3. The method according to claim 2, wherein the classifying the backhaul data according to a predetermined classification policy to obtain a class corresponding to the backhaul data comprises:
checking the returned data to determine whether the returned data is legal data;
if the returned data is legal data, analyzing the returned data to obtain an analysis result;
and classifying the returned data according to the analysis result and a preset classification strategy to obtain the corresponding category of the returned data.
4. The method according to claim 3, wherein the parsing result includes a data identifier of the returned data, and the classifying the returned data according to the parsing result and a predetermined classification policy to obtain a class corresponding to the returned data comprises:
and obtaining the category corresponding to the returned data based on a preset classification strategy, and adding a label corresponding to the data identifier to the returned data, wherein the label is used for representing the category of the returned data.
5. The method of claim 1, wherein the identifying the category to which the backhaul data corresponds comprises:
acquiring the corresponding priority of the server according to a pre-stored priority list;
when the priority is a first priority, determining that the category corresponding to the returned data is a first category;
and when the priority is a second priority, determining that the category corresponding to the returned data is a second category, wherein the first priority is higher than the second priority.
6. The method of claim 1, wherein the buffering the return data in a buffer queue in a memory if the category is the first category comprises:
if the category is a first category, judging whether the current data volume in the cache queue reaches a cache threshold value;
and if the buffer threshold value is reached, buffering the returned data in the buffer queue in the memory after removing part of the data in the buffer queue.
7. The method according to any one of claims 1-6, further comprising:
if the type is a third type, caching the returned data in a cache queue in a memory, and storing the returned data in a disk;
the sending the returned data buffered in the buffer queue or the returned data stored in the disk to the server includes:
and sending the return data buffered in the buffer queue to the server.
8. The method of claim 7, further comprising:
receiving data requests sent by other servers;
and responding to the data request, and sending the return data stored in the disk to the other servers.
9. A data transmission apparatus, characterized in that the apparatus comprises: a data acquisition module, a data identification module, a first storage module, a second storage module and a data transmission module, wherein,
the data acquisition module is used for acquiring return data to be returned to the server by the client;
the data identification module is used for identifying the category corresponding to the returned data;
the first storage module is used for caching the returned data in a cache queue in a memory if the category is a first category;
the second storage module is used for storing the returned data in a disk if the category is a second category, and the real-time requirement of the data of the first category during transmission is higher than that of the data of the second category during transmission;
the data sending module is used for sending the return data buffered in the buffer queue or the return data stored in the disk to the server.
10. A mobile terminal, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-8.
11. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1 to 8.
CN201910942274.5A 2019-09-30 2019-09-30 Data transmission method and device, mobile terminal and storage medium Pending CN110719232A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910942274.5A CN110719232A (en) 2019-09-30 2019-09-30 Data transmission method and device, mobile terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910942274.5A CN110719232A (en) 2019-09-30 2019-09-30 Data transmission method and device, mobile terminal and storage medium

Publications (1)

Publication Number Publication Date
CN110719232A true CN110719232A (en) 2020-01-21

Family

ID=69212115

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910942274.5A Pending CN110719232A (en) 2019-09-30 2019-09-30 Data transmission method and device, mobile terminal and storage medium

Country Status (1)

Country Link
CN (1) CN110719232A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112684878A (en) * 2020-12-24 2021-04-20 维沃移动通信(杭州)有限公司 Data transmission method and electronic equipment
CN112770356A (en) * 2021-01-06 2021-05-07 维沃移动通信有限公司 Data transmission method and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844524A (en) * 2017-10-12 2018-03-27 金蝶软件(中国)有限公司 Data processing method, data processing equipment, computer equipment and storage medium
US20190114202A1 (en) * 2017-10-13 2019-04-18 Beijing Baidu Netcom Science And Technology Co., Ltd. Task scheduling method and apparatus of artificial intelligence heterogeneous hardware, device and readable medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844524A (en) * 2017-10-12 2018-03-27 金蝶软件(中国)有限公司 Data processing method, data processing equipment, computer equipment and storage medium
US20190114202A1 (en) * 2017-10-13 2019-04-18 Beijing Baidu Netcom Science And Technology Co., Ltd. Task scheduling method and apparatus of artificial intelligence heterogeneous hardware, device and readable medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112684878A (en) * 2020-12-24 2021-04-20 维沃移动通信(杭州)有限公司 Data transmission method and electronic equipment
CN112684878B (en) * 2020-12-24 2022-09-30 维沃移动通信(杭州)有限公司 Data transmission method and electronic equipment
CN112770356A (en) * 2021-01-06 2021-05-07 维沃移动通信有限公司 Data transmission method and electronic equipment

Similar Documents

Publication Publication Date Title
CN108200134B (en) Request message management method and device, and storage medium
CN109152095B (en) Wireless network connection method for terminal
WO2021109767A1 (en) Network device and method for reducing transmission delay therefor
CN113316926A (en) Domain name processing method and device, electronic equipment and storage medium
CN109495378B (en) Method, device, server and storage medium for detecting abnormal account
WO2021189257A1 (en) Malicious process detection method and apparatus, electronic device, and storage medium
CN110719232A (en) Data transmission method and device, mobile terminal and storage medium
WO2020257991A1 (en) User identification method and related product
CN111312233A (en) Voice data identification method, device and system
CN111541555A (en) Group chat optimization method and related product
WO2021057623A1 (en) Memory recovery method and apparatus, electronic device and storage medium
CN115964319A (en) Data processing method for remote direct memory access and related product
CN109766508A (en) Signal auditing method, device and electronic equipment
CN107197000B (en) Static and dynamic hybrid caching method, device and system
CN115039392A (en) Message processing method, device and system and server
CN103906066B (en) The harassing and wrecking screen method that a kind of user-generated content is mentioned and device
CN114285838A (en) File uploading method, device, system, storage medium and electronic equipment
CN110708293B (en) Method and device for distributing multimedia service
CN109766347B (en) Data updating method, device, system, computer equipment and storage medium
CN111813529B (en) Data processing method, device, electronic equipment and storage medium
CN110020290B (en) Webpage resource caching method and device, storage medium and electronic device
CN112099736A (en) Data storage method and device, electronic equipment and storage medium
CN116418893A (en) Data management method and corresponding device
CN114281724A (en) Data transmission method and device and electronic equipment
CN107222559B (en) Information calling method

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100125 1503, 15th floor, building 2, yard 10, Chaoyang Park South Road, Chaoyang District, Beijing

Applicant after: Beijing opper Communication Co.,Ltd.

Address before: 100080 12-02, 12-05, 10th floor, building 38, Haidian Street, Haidian District, Beijing

Applicant before: Beijing opper Communication Co.,Ltd.