CN108092956B - Method and device for acquiring compression dictionary - Google Patents

Method and device for acquiring compression dictionary Download PDF

Info

Publication number
CN108092956B
CN108092956B CN201711249958.4A CN201711249958A CN108092956B CN 108092956 B CN108092956 B CN 108092956B CN 201711249958 A CN201711249958 A CN 201711249958A CN 108092956 B CN108092956 B CN 108092956B
Authority
CN
China
Prior art keywords
compression dictionary
user data
target
uncompressed user
target compression
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
CN201711249958.4A
Other languages
Chinese (zh)
Other versions
CN108092956A (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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201711249958.4A priority Critical patent/CN108092956B/en
Publication of CN108092956A publication Critical patent/CN108092956A/en
Application granted granted Critical
Publication of CN108092956B publication Critical patent/CN108092956B/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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The embodiment of the invention provides a method and a device for acquiring a compression dictionary, wherein the method for acquiring the compression dictionary is applied to a client and comprises the following steps: sending a data message to a server, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; and acquiring the target compression dictionary sent by the server to compress uncompressed user data by using the target compression dictionary, wherein the target compression dictionary is a data message sent by a client and received by the server, judging whether the data message carries the request identifier, and if so, establishing the target compression dictionary and sending the target compression dictionary to the client. By applying the embodiment of the invention, the client can acquire the compression dictionary from the server.

Description

Method and device for acquiring compression dictionary
Technical Field
The present invention relates to the field of data compression technologies, and in particular, to a method and an apparatus for obtaining a compression dictionary.
Background
In order to provide better service to users, internet companies need to know the usage habits and preferences of users by collecting a large amount of user data. Because the data volume of the user data is large, the user data can be compressed by the client side by using the compression dictionary and then uploaded to the server side. In practical applications, user data is typically stored in the form of key value pairs (values), and furthermore, the compression dictionary includes a correspondence of values to sequence numbers.
Because the resource data volume of the client is large and is continuously updated, in order to ensure the compression efficiency, new compression dictionaries need to be added at the client and the server in time. At present, the client and the server can obtain new compression dictionaries by upgrading software versions of the client and the server. However, since the client cannot be controlled to update the software version in time, the situation that the software version of the server is updated but the software version of the client is not updated may occur. At this time, the server side already acquires the new compression dictionary, and the client side does not acquire the new compression dictionary, in this scenario, the specific process of data transmission between the server side and the client side is as follows:
firstly, a client judges whether a compression dictionary corresponding to user data to be uploaded exists in an existing compression dictionary of the client, and specifically, whether a compression dictionary comprising a value exists in the existing compression dictionary can be determined according to the value in the user data; if so, compressing the user data by using the compression dictionary to generate compressed user data; if not, the uncompressed user data is uploaded to the server side.
Next, the server receives the user data sent by the client and judges whether the user data is compressed; if so, decompressing the user data by using a compression dictionary corresponding to the user data to obtain decompressed user data; if not, directly acquiring uncompressed user data.
It can be seen that, when the client lacks a compression dictionary, part of the user data cannot be compressed, but uploading uncompressed user data to the server occupies a large amount of traffic resources and bandwidth resources.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for acquiring a compression dictionary, so as to realize that a client acquires the compression dictionary from a server. The specific technical scheme is as follows:
the embodiment of the invention provides a method for obtaining a compression dictionary, which is applied to a client and comprises the following steps:
sending a data message to a server, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
and acquiring the target compression dictionary sent by the server to compress uncompressed user data by using the target compression dictionary, wherein the target compression dictionary is a data message sent by a client and received by the server, judging whether the data message carries the request identifier, and if so, establishing the target compression dictionary and sending the target compression dictionary to the client.
Optionally, before the step of sending the data packet to the server, the method further includes:
judging whether a target compression dictionary corresponding to the uncompressed user data exists in an existing compression dictionary of the client;
and if not, adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message.
Optionally, the storage format of the uncompressed user data is key value pair key: a value;
before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method further includes:
determining a corresponding relation between a target key in the uncompressed user data and a preset identifier;
and determining the corresponding relation between the target key and the identifier as the request identification.
Optionally, before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method further includes:
judging whether the times of the uncompressed user data appearing in a preset time period and the byte length of the uncompressed user data meet preset conditions or not;
and if so, executing the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message.
Optionally, the step of determining whether the number of times the uncompressed user data appears in a preset time period and the byte length of the uncompressed user data both meet preset conditions includes:
judging whether the product of the occurrence frequency of the uncompressed user data in a preset time period and the byte length of the uncompressed user data exceeds a preset threshold value or not;
if so, the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message is executed, including:
and if the product exceeds the preset threshold, the uncompressed user data meets the preset condition, and the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message is executed.
Optionally, the storage format of the uncompressed user data is key: the compression dictionary comprises a value and a preset serial number corresponding relation;
the step of obtaining the target compression dictionary sent by the server side includes:
receiving a corresponding relation between a target key in the uncompressed user data sent by the server and a target sequence number in the target compression dictionary, wherein the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and generating the target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
The embodiment of the invention also provides a method for acquiring the compression dictionary, which is applied to a server side and comprises the following steps:
receiving a data message sent by a client, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
establishing the target compression dictionary;
and sending the target compression dictionary to the client so that the client can acquire the target compression dictionary and compress the uncompressed user data by using the target compression dictionary.
Optionally, the step of receiving a data packet sent by a client, where the data packet includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, includes:
receiving a data message sent by the client, wherein the data message comprises uncompressed user data;
before the step of establishing the target compression dictionary, the method further comprises:
judging whether the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
if so, executing the step of establishing the target compression dictionary.
Optionally, the uncompressed user data includes a keyword key;
the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
the step of determining whether the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data includes:
judging whether the data message comprises the identifier or not;
if so, executing the step of establishing the target compression dictionary, comprising:
and if the data message comprises the identifier, determining that the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and executing the step of establishing the target compression dictionary.
Optionally, before the step of establishing the target compression dictionary, the method further includes:
judging whether the target compression dictionary is included in the compression dictionary stored at the server side;
if yes, determining the target compression dictionary from the stored compression dictionaries;
and if not, executing the step of establishing the target compression dictionary.
Optionally, the storage format of the uncompressed user data is key: a value; the compression dictionary comprises a corresponding relation between a value and a preset serial number;
prior to the step of sending the target compression dictionary to the client, the method further comprises:
establishing a corresponding relation between a target key in the uncompressed user data and a target sequence number in the target compression dictionary, wherein the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
the step of sending the target compression dictionary to the client includes:
and sending the corresponding relation between the target key and the target serial number to the client so that the client acquires the target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
The embodiment of the invention also provides a device for obtaining the compression dictionary, which is applied to a client, and the device comprises:
the device comprises a sending unit, a receiving unit and a processing unit, wherein the sending unit is used for sending a data message to a server side, and the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
and the obtaining unit is used for obtaining the target compression dictionary sent by the server so as to compress uncompressed user data by using the target compression dictionary, the target compression dictionary is a data message sent by a client and received by the server, whether the request identifier is carried in the data message is judged, and if yes, the target compression dictionary is established and sent to the client.
Optionally, the apparatus further comprises:
a judging unit, configured to judge whether a target compression dictionary corresponding to the uncompressed user data exists in an existing compression dictionary of the client;
an adding unit, configured to add, in the data packet, the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data if the determination result of the determining unit is that the target compression dictionary corresponding to the uncompressed user data does not exist in the existing compression dictionary of the client.
Optionally, the storage format of the uncompressed user data is key: a value;
the device further comprises:
the first determining unit is used for determining the corresponding relation between the target key in the uncompressed user data and a preset identifier;
and the second determining unit is used for determining the corresponding relation between the target key and a preset identifier as the request identifier.
Optionally, the apparatus further comprises:
a second judging unit, configured to judge whether the number of times the uncompressed user data appears in a preset time period and whether a byte length of the uncompressed user data both meet preset conditions;
an executing unit, configured to, if the determination result of the second determining unit is that the uncompressed user data meets the preset condition, execute the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet.
Optionally, the second determining unit is specifically configured to determine whether a product of a number of times that the uncompressed user data appears within a preset time period and a byte length of the uncompressed user data exceeds a preset threshold;
the execution unit is specifically configured to, if the product exceeds the preset threshold, make the uncompressed user data meet the preset condition, and execute the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet.
Optionally, the storage format of the uncompressed user data is key: the compression dictionary comprises a value and a preset serial number corresponding relation;
the acquisition unit includes: a receiving subunit and a generating subunit;
the receiving subunit is configured to receive a correspondence between a target key in the uncompressed user data sent by the server and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and the generating subunit is configured to generate the target compression dictionary according to the correspondence between the target key and the target serial number and the uncompressed user data.
The embodiment of the invention further provides a device for obtaining a compression dictionary, which is applied to a server side, and the device comprises:
the device comprises a receiving unit, a sending unit and a processing unit, wherein the receiving unit is used for receiving a data message sent by a client, and the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
a first establishing unit, configured to establish the target compression dictionary;
and the sending unit is used for sending the target compression dictionary to the client so that the client can acquire the target compression dictionary and use the target compression dictionary to compress the uncompressed user data.
Optionally, the receiving unit is specifically configured to receive a data packet sent by the client, where the data packet includes uncompressed user data;
the device further comprises:
a first judging unit, configured to judge whether the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
a first executing unit, configured to execute the first establishing unit if the determination result of the determining unit is that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data.
Optionally, the uncompressed user data includes a keyword key;
the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
the first determining unit is specifically configured to determine whether the data packet includes the identifier;
the first executing unit is specifically configured to, if the determination result of the first determining unit is that the data packet includes the identifier, determine that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and execute the first establishing unit.
Optionally, the apparatus further comprises:
a second judging unit, configured to judge whether the target compression dictionary is included in the compression dictionary already stored at the server;
a determining unit, configured to determine the target compression dictionary from the stored compression dictionary if the determination result of the second determining unit is that the target compression dictionary is included in the compression dictionary stored at the server side;
a second executing unit, configured to execute the first establishing unit if the determination result of the second determining unit is that the target compression dictionary is not included in the compression dictionary stored at the server side.
Optionally, the storage format of the uncompressed user data is key: a value;
the compression dictionary comprises a corresponding relation between a value and a preset serial number;
the device further comprises:
a second establishing unit, configured to establish a correspondence between a target key in the uncompressed user data and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
the sending unit is specifically configured to send the corresponding relationship between the target key and the target serial number to the client, so that the client obtains the target compression dictionary according to the corresponding relationship between the target key and the target serial number.
The invention further provides electronic equipment, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for finishing mutual communication through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any method for acquiring the compression dictionary when executing the program stored in the memory.
The present invention further provides a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any of the above-mentioned methods of obtaining a compression dictionary.
Embodiments of the present invention further provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform any of the above-described methods of obtaining a compression dictionary.
The embodiment of the invention provides a method and a device for acquiring a compression dictionary, firstly, a client sends a data message to a server, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; and then, the client acquires a target compression dictionary sent by the server, the target compression dictionary is obtained by judging whether the data message carries a request identifier for requesting the target compression dictionary corresponding to the uncompressed user data after the server receives the data message sent by the client, and if so, the target compression dictionary is established and sent to the client. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow chart of a method for obtaining a compression dictionary in accordance with an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for obtaining a compression dictionary according to an embodiment of the present invention;
FIG. 3 is another flow chart of a method for obtaining a compression dictionary in accordance with an embodiment of the present invention;
FIG. 4 is a diagram illustrating a system for retrieving a compression dictionary according to an embodiment of the present invention;
FIG. 5 is a block diagram of an apparatus for obtaining a compression dictionary according to an embodiment of the present invention;
FIG. 6 is a block diagram of still another apparatus for obtaining a compression dictionary according to an embodiment of the present invention;
FIG. 7 is a diagram of an electronic device according to an embodiment of the invention;
fig. 8 is another schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
In order to provide better service to users, internet companies need to know the usage habits and preferences of users by collecting a large amount of user data. Because the data volume of the user data is large, the user data can be compressed by the client side by using the compression dictionary and then uploaded to the server side. In practical applications, user data is usually stored in the form of key value pairs, and furthermore, the compression dictionary includes a correspondence of the value to the sequence number.
Because the resource data volume of the client is large and is continuously updated, in order to ensure the compression efficiency, new compression dictionaries need to be added at the client and the server in time. At present, the client and the server can obtain new compression dictionaries by upgrading software versions of the client and the server. However, since the client cannot be controlled to update the software version in time, the situation that the software version of the server is updated but the software version of the client is not updated may occur. At this time, the server side already acquires the new compression dictionary, and the client side does not acquire the new compression dictionary, in this scenario, the specific process of data transmission between the server side and the client side is as follows:
firstly, a client judges whether a compression dictionary corresponding to user data to be uploaded exists in an existing compression dictionary of the client, and specifically, whether a compression dictionary comprising a value exists in the existing compression dictionary can be determined according to the value in the user data; if so, compressing the user data by using the compression dictionary to generate compressed user data; if not, the uncompressed user data is uploaded to the server side.
Next, the server receives the user data sent by the client and judges whether the user data is compressed; if so, decompressing the user data by using a compression dictionary corresponding to the user data to obtain decompressed user data; if not, directly acquiring uncompressed user data.
It can be seen that, when the client lacks a compression dictionary, part of the user data cannot be compressed, but uploading uncompressed user data to the server occupies a large amount of traffic resources and bandwidth resources.
In order to solve the above problem, an embodiment of the present invention provides a method and an apparatus for obtaining a compression dictionary, where a client sends a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; then, after receiving a data message sent by a client, a server judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to uncompressed user data, and if so, establishes the target compression dictionary and sends the target compression dictionary to the client; and finally, the client acquires a target compression dictionary from the server. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
The embodiment of the invention provides a method for acquiring a compression dictionary, which is applied to a client. Referring to fig. 1, fig. 1 is a flowchart of a method for obtaining a compression dictionary according to an embodiment of the present invention, including the following steps:
step 101, sending a data message to a server.
The data message comprises uncompressed user data and a request identifier of a target compression dictionary corresponding to the uncompressed user data.
In this step, the client may send a data packet to the server, where the data packet includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, so as to enable the server to request to establish the target compression dictionary and send the target compression dictionary to the client through the request identifier.
Optionally, before step 101, the method for obtaining a compression dictionary provided in the embodiment of the present invention may further include:
judging whether a target compression dictionary corresponding to uncompressed user data exists in an existing compression dictionary of the client;
and if not, adding a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data in the data message.
Specifically, before sending a data packet to a server, a client may first determine whether the client already stores a target compression dictionary for compressing the user data; if yes, compressing the user data and then sending the user data to a server side, wherein in the case, the data packet comprises compressed data; if not, a request identifier for requesting a target compression dictionary corresponding to the user data may be added to the data message, in which case, the data message includes the uncompressed user data and the request identifier.
Optionally, before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method for obtaining the compression dictionary provided in the embodiment of the present invention may further include:
determining a corresponding relation between a target key in uncompressed user data and a preset identifier;
and determining the corresponding relation between the target key and the identifier as the request identification.
It should be noted that the storage format of the uncompressed user data may be key: value. Specifically, the client may determine a correspondence between a target key in the uncompressed user data and a preset identifier as the request identifier.
For example, the uncompressed user data may be: key0 value0& key1 value1, where the target key includes key0 and key1, and the corresponding values are value0 and value1, respectively; the preset identifier can be subscribing; then, the corresponding relationship between the target key and the subscribing may be determined as the request identifier, which is specifically denoted as subscribing 0, key 1. In this case, the data message sent by the client to the server may be key0 value0& key1 value1& reporting key0, key 1.
In a specific implementation process, the client may select part of the user data with higher compression efficiency, and request the target compression dictionary for the user data. Optionally, before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method for obtaining the compression dictionary provided in the embodiment of the present invention may further include:
judging whether the times of occurrence of the uncompressed user data in a preset time period and the byte length of the uncompressed user data meet preset conditions or not;
and if so, adding a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data in the data message.
Specifically, the preset condition may be set according to an actual situation, where the preset condition may include that the number of times of occurrence of the uncompressed user data exceeds a preset number threshold within a preset time period, and the byte length of the uncompressed user data exceeds a preset length threshold, and the like. When the uncompressed user data meets the preset condition, it can be considered that the user data belongs to user data with higher compression efficiency, and a request identifier for requesting a target compression dictionary is added to the data message. Therefore, the workload of the client and the server can be reduced, and the working efficiency is improved.
Further, the step of determining whether the uncompressed user data meets the preset condition includes:
judging whether the product of the occurrence frequency of the uncompressed user data in a preset time period and the byte length of the uncompressed user data exceeds a preset threshold value or not;
if so, the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data into the data message is executed, and the step includes:
and if the product of the number of times of occurrence of the uncompressed user data in a preset time period and the byte length of the uncompressed user data exceeds a preset threshold, the uncompressed user data meets a preset condition, and a step of adding a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data in the data message is executed.
Specifically, the preset condition may be set as whether a product of the number of times that the uncompressed user data appears within a preset time period and the byte length of the uncompressed user data exceeds a preset threshold, and if the product exceeds the preset threshold, it indicates that the user data meets the preset condition and belongs to user data with higher compression efficiency, and a request identifier for requesting a target compression dictionary may be added in the data message; if the product does not exceed the preset threshold, the user data does not meet the preset condition and does not belong to the user data with higher compression efficiency, and a request identifier for requesting a target compression dictionary does not need to be added in the data message.
Of course, preset conditions can be set according to actual requirements, so that the client can request the most appropriate dictionary according to the characteristics of the user.
And 102, acquiring a target compression dictionary sent by the server side, so as to compress uncompressed user data by using the target compression dictionary.
And the target compression dictionary is a data message sent by a client side and received by the server, whether the request identifier is carried in the data message or not is judged, and if so, the target compression dictionary is established and sent to the client side.
In this step, the client may obtain the target compression dictionary sent by the server, so that the client can use the target compression dictionary to compress the uncompressed user data; when receiving a data message from a client, a server may first determine whether the data message carries the request identifier, and if so, the server may establish a target compression dictionary for the user data and send the target compression dictionary to the client, so that the client obtains the target compression dictionary.
Optionally, step 102 may include:
receiving a corresponding relation between a target key in uncompressed user data sent by a server and a target serial number in a target compression dictionary, wherein the target serial number is a preset serial number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and generating a target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
Specifically, since the value in the user data generally includes more bytes, the server side directly sending the compression dictionary to the client side may occupy more traffic resources and bandwidth resources. In order to improve the sending efficiency, the server side can send the corresponding relation between the target key and the target serial number to the client side, so that the client side can obtain a target compression dictionary according to the corresponding relation and uncompressed user data; the target sequence number is a preset sequence number corresponding to the target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data.
For example, the uncompressed user data may be: the key0 value0& key1 value1, the received correspondence between the target key and the target serial number includes the correspondence between key0 and $ K0, and the correspondence between key1 and $ K1; then, the client, based on the received correspondence of key0 and $ K0 and the correspondence of key1 and $ K1, in combination with uncompressed user data key 0-value 0& key 1-value 1, can know that the target compression dictionary includes the correspondence of value0 and $ K0 and the correspondence of value1 and $ K1.
It can be seen that, in the method for obtaining a compression dictionary provided in the embodiment of the present invention, a client first sends a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; and then, the client acquires a target compression dictionary sent by the server, the target compression dictionary is obtained by judging whether the data message carries a request identifier for requesting the target compression dictionary corresponding to the uncompressed user data after the server receives the data message sent by the client, and if so, the target compression dictionary is established and sent to the client. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
In addition, in the embodiment of the invention, the client can determine the compression dictionary required by the user data with higher compression efficiency, and the server only needs to establish the corresponding compression dictionary according to the request of the client.
In one implementation mode, the client does not need to store any compression dictionary in advance in the initial situation, and only obtains the compression dictionary from the server in the processing process of the user data, so that the development cost of the client can be reduced.
Correspondingly, the embodiment of the invention also provides a method for acquiring the compression dictionary, which is applied to the server side. Referring to fig. 2, fig. 2 is a flowchart of another method for obtaining a compression dictionary according to an embodiment of the present invention, including the following steps:
step 201, receiving a data message sent by a client.
The data message comprises uncompressed user data and a request identifier of a target compression dictionary corresponding to the uncompressed user data.
In this step, the server may receive a data packet from the client, where the data packet includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, so that the server may establish the target compression dictionary corresponding to the uncompressed user data according to the request identifier and send the target compression dictionary to the client, so that the client may use the target compression dictionary to compress the user data.
Step 202, establishing a target compression dictionary.
In this step, the server may establish a target compression dictionary corresponding to the received user data.
Optionally, before step 202, the method for obtaining a compression dictionary according to the embodiment of the present invention may further include:
judging whether a target compression dictionary is included in a compression dictionary stored at a server side;
if yes, determining a target compression dictionary from the stored compression dictionaries;
if not, go to step 202.
Specifically, after receiving a data message including uncompressed user data and the request identifier, the server may determine whether a target compression dictionary is already stored, and if so, may determine the target compression dictionary from the stored compression dictionaries without newly creating a target compression dictionary, so as to improve work efficiency; if not, a target compression dictionary may be built by performing step 202.
And step 203, sending the target compression dictionary to the client so that the client can acquire the target compression dictionary and compress the uncompressed user data by using the target compression dictionary.
In this step, the server may send the established target compression dictionary to the client, so that the client may obtain the target compression dictionary and use the target compression dictionary to perform compression processing on the uncompressed user data.
Optionally, before step 203, the method for obtaining a compression dictionary provided in the embodiment of the present invention may further include:
establishing a corresponding relation between a target key in the uncompressed user data and a target serial number in a target compression dictionary, wherein the target serial number is a preset serial number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
correspondingly, step 203 may include:
and sending the corresponding relation between the target key and the target serial number to the client so that the client can obtain the target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
It should be noted that the compression dictionary may include a correspondence relationship between a value and a preset serial number.
Specifically, since the value in the user data generally includes more bytes, the server side directly sending the compression dictionary to the client side may occupy more traffic resources and bandwidth resources. In order to improve the sending efficiency, the server side can establish a corresponding relation between a target key in uncompressed user data and a target serial number in a target compression dictionary, and send the corresponding relation to the client side, so that the client side can obtain the target compression dictionary according to the corresponding relation and the uncompressed user data; the target sequence number is a preset sequence number corresponding to the target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data.
For example, the uncompressed user data may be: key0 value0& key1 value1, where target keys include key0 and key1, and the corresponding target values are value0 and value1, respectively; the target compression dictionary corresponding to the uncompressed user data comprises a corresponding relation between a target value0 and a preset serial number $ K0 and a corresponding relation between a target value1 and a preset serial number $ K1, wherein $ K0 is the preset serial number corresponding to value0, and $ K1 is the preset serial number corresponding to value 1; then, the correspondence between the target key and the target serial number established by the server includes a correspondence between the key0 and the $ K0, and a correspondence between the key1 and the $ K1. When the client receives the correspondence of key0 and $ K0 and the correspondence of key1 and $ K1, in combination with uncompressed user data key0 ═ value0& key1 ═ value1, it can be known that the target compression dictionary includes the correspondence of value0 and $ K0 and the correspondence of value1 and $ K1.
It can be seen that in the method for obtaining a compression dictionary provided in the embodiment of the present invention, a server receives a data message from a client, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; and then, the server side judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and if so, establishes the target compression dictionary and sends the target compression dictionary to the client side. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
In order to more clearly describe the method for obtaining a compression dictionary in the embodiment of the present invention, an embodiment of the present invention further provides a method for obtaining a compression dictionary, including a client and a server. Referring to fig. 3, fig. 3 is another flowchart of a method for obtaining a compression dictionary according to an embodiment of the present invention, including the following steps:
step 301, the client sends a data message to the server.
The data message comprises uncompressed user data and a request identifier of a target compression dictionary corresponding to the uncompressed user data.
The detailed process and technical effect of the present invention can refer to step 101 in the method for obtaining a compression dictionary shown in fig. 1, and are not described herein again.
Step 302, the server receives the data message sent by the client.
Wherein the data message comprises uncompressed user data.
In this step, the server may receive a data packet from the client, where the data packet includes uncompressed user data, and the server further needs to determine, through subsequent steps, whether the data packet includes a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and if the data packet includes the request identifier, the server may establish the target compression dictionary corresponding to the uncompressed user data according to the request identifier and send the target compression dictionary to the client, so that the client can perform compression processing on the user data using the target compression dictionary.
Step 303, the server side judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to uncompressed user data; if so, go to step 304.
In this step, the server may determine whether the received data packet carries a request identifier for requesting a target compression dictionary corresponding to uncompressed user data; if the request identifier is included, go to step 304; if the request identification is not included, the server side can directly acquire the uncompressed user data, and a target compression dictionary is not established by executing subsequent steps.
Optionally, the uncompressed user data includes a keyword key; the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
accordingly, step 303 may include:
judging whether the data message comprises an identifier or not;
if the data packet includes the identifier, it is determined that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and step 304 is performed.
Specifically, the request identifier of the target compression dictionary corresponding to the uncompressed user data includes a preset identifier and a corresponding relationship between the preset identifier and the target key in the uncompressed user data, so that the server can determine whether the data packet carries the request identifier by judging whether the data packet includes the identifier; if the data message includes the identifier, it indicates that the data message carries the request identifier, the subsequent step 304 may be performed, and if the data message does not include the identifier, it indicates that the data message does not carry the request identifier, the server may directly obtain the uncompressed user data, and the target compression dictionary is no longer established by performing the subsequent step.
It should be noted that, the specific processing procedure of the data packet not carrying the request identifier mentioned above may refer to the prior art.
For example, the data packet received by the server is key0 ═ value0& key1 ═ value1& suppressing ═ key0, key1, suppressing ═ key0, and key1 is a request identifier for requesting a target compression dictionary corresponding to uncompressed user data, where a preset identifier is suppressing, and target keys corresponding to the identifier are key0 and key 1; then, the server may determine whether the data packet carries the request identifier by determining whether the data packet includes the identifier signing.
Step 304, the server establishes a target compression dictionary.
The detailed process and technical effect of the present invention can refer to step 202 in the method for obtaining a compression dictionary shown in fig. 2, and are not described herein again.
Step 305, the server sends the target compression dictionary to the client.
The detailed process and technical effect of the present invention can refer to step 203 in the method for obtaining a compression dictionary shown in fig. 2, and are not described herein again.
Step 306, the client acquires the target compression dictionary sent by the server to compress the uncompressed user data by using the target compression dictionary.
The detailed process and technical effect of the present invention may refer to step 102 in the method for obtaining a compression dictionary shown in fig. 1, and are not described herein again.
It can be seen that, in the method for obtaining a compression dictionary provided in the embodiment of the present invention, a client first sends a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; next, the server receives a data message from the client; the server side judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to uncompressed user data, if so, the server side establishes the target compression dictionary and sends the target compression dictionary to the client side; and finally, the client acquires the target compression dictionary sent by the server. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
The embodiment of the invention also provides a system for acquiring the compression dictionary. Referring to fig. 4, fig. 4 is a schematic diagram of a system for obtaining a compression dictionary according to an embodiment of the present invention.
In fig. 4, the system for obtaining the compression dictionary includes a server, a client a, a client B, and a client C, and the work flow of the system is as follows:
firstly, a client sends a data message to a server.
Specifically, the client may send a data packet to the server, where the data packet includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, so as to enable the server to establish the target compression dictionary and send the target compression dictionary to the client through the request identifier.
And secondly, the server receives the data message sent by the client.
Specifically, the server may receive the data packet from the client, so that the server may establish a target compression dictionary corresponding to the uncompressed user data according to the request identifier and send the target compression dictionary to the client, so that the client can compress the user data by using the target compression dictionary. .
And thirdly, the server side judges whether the target compression dictionary is included in the compression dictionary stored in the server side, if so, the fourth step is executed, and if not, the fifth step is executed.
Specifically, after receiving a data message including uncompressed user data and the request identifier, the server may determine whether a target compression dictionary is already stored, and if so, may determine the target compression dictionary from the stored compression dictionaries without newly creating a target compression dictionary, so as to improve work efficiency; if not, a target compression dictionary may be built by performing the fifth step.
And fourthly, if so, the server side determines a target compression dictionary from the stored compression dictionaries.
Specifically, when the server side stores the target compression dictionary, the server side can determine the target compression dictionary from the stored compression dictionary without newly building the target compression dictionary, so that the working efficiency is improved.
And fifthly, establishing a target compression dictionary by the server.
Specifically, when the server side does not store the target compression dictionary, the server side may establish the target compression dictionary.
And sixthly, the server side sends the target compression dictionary to the client side.
Specifically, the server may send the target compression dictionary found in the fourth step or established in the fifth step to the client.
And seventhly, the client acquires the target compression dictionary sent by the server so as to compress the uncompressed user data by using the target compression dictionary.
Specifically, the client may obtain a target compression dictionary sent by the server, so that the client can compress uncompressed user data by using the target compression dictionary; when receiving a data message from a client, a server may first determine whether the data message carries the request identifier, and if so, the server may establish a target compression dictionary for the user data and send the target compression dictionary to the client, so that the client obtains the target compression dictionary.
It should be noted that, for detailed steps and technical effects of the processing flow of the system for generating a compression dictionary, reference may be made to the related descriptions in the method for generating a compression dictionary shown in fig. 1, fig. 2, and fig. 3, and no further description is given here.
As can be seen, in the system for acquiring a compression dictionary provided in the embodiment of the present invention, a client first sends a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; next, the server receives a data message from the client; the server side judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, if so, the server side searches or establishes the target compression dictionary and sends the target compression dictionary to the client side; and finally, the client acquires the target compression dictionary sent by the server. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
The embodiment of the invention further provides a device for acquiring the compression dictionary, which is applied to the client. Referring to fig. 5, fig. 5 is a block diagram of an apparatus for acquiring a compression dictionary according to an embodiment of the present invention, the apparatus including:
a sending unit 501, configured to send a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
an obtaining unit 502, configured to obtain a target compression dictionary sent by a server, so as to perform compression processing on uncompressed user data by using the target compression dictionary, where the target compression dictionary is a data packet sent by a client and received by the server, and determine whether the data packet carries a request identifier, and if so, establish the target compression dictionary and send the target compression dictionary to the client.
Optionally, the apparatus further comprises:
the judging unit is used for judging whether a target compression dictionary corresponding to uncompressed user data exists in an existing compression dictionary of the client;
and the adding unit is used for adding a request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message if the judging result of the judging unit is that the target compression dictionary corresponding to the uncompressed user data does not exist in the existing compression dictionary of the client.
Optionally, the storage format of the uncompressed user data is key value pair key: a value;
the device still includes:
the first determining unit is used for determining the corresponding relation between the target key in the uncompressed user data and a preset identifier;
and the second determining unit is used for determining the corresponding relation between the target key and the preset identifier as the request identifier.
Optionally, the compression dictionary includes a corresponding relationship between a value and a preset serial number;
the acquisition unit 502 includes: a receiving subunit and a generating subunit;
a receiving subunit, configured to receive a correspondence between a target key in the uncompressed user data sent by the server and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and the generation subunit is used for generating a target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
As can be seen, in the apparatus for obtaining a compression dictionary provided in the embodiment of the present invention, a client first sends a data message to a server, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data; and then, the client acquires a target compression dictionary sent by the server, the target compression dictionary is obtained by judging whether the data message carries a request identifier for requesting the target compression dictionary corresponding to the uncompressed user data after the server receives the data message sent by the client, and if so, the target compression dictionary is established and sent to the client. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
The embodiment of the invention further provides a device for acquiring the compression dictionary, which is applied to a server side. Referring to fig. 6, fig. 6 is a block diagram of still another apparatus for obtaining a compression dictionary according to an embodiment of the present invention, the apparatus including:
a receiving unit 601, configured to receive a data packet sent by a client, where the data packet includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
a first establishing unit 602, configured to establish a target compression dictionary;
a sending unit 603, configured to send the target compression dictionary to the client, so that the client obtains the target compression dictionary and performs compression processing on the uncompressed user data by using the target compression dictionary.
Optionally, the receiving unit 601 is specifically configured to receive a data packet sent by a client, where the data packet includes uncompressed user data;
the device still includes:
the first judging unit is used for judging whether the data message carries a request identifier for requesting a target compression dictionary corresponding to uncompressed user data;
a first executing unit, configured to execute the first establishing unit 602 if the determination result of the determining unit is that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data.
Optionally, the uncompressed user data includes a keyword key;
the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
the first judging unit is specifically used for judging whether the data message comprises an identifier or not;
the first executing unit is specifically configured to, if the determination result of the first determining unit is that the data packet includes the identifier, determine that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and execute the first establishing unit 602.
Optionally, the apparatus further comprises:
the second judgment unit is used for judging whether the target compression dictionary is included in the compression dictionaries stored at the server side;
the determining unit is used for determining a target compression dictionary from the stored compression dictionaries if the judgment result of the second judging unit is that the target compression dictionary is included in the compression dictionaries stored at the server side;
a second executing unit, configured to execute the first establishing unit 602 if the determination result of the second determining unit is that the target compression dictionary is not included in the compression dictionaries stored at the server side.
Optionally, the storage format of the uncompressed user data is key value pair key: a value;
the compression dictionary comprises a corresponding relation between a value and a preset serial number;
the device still includes:
a second establishing unit, configured to establish a correspondence between a target key in the uncompressed user data and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
the sending unit 603 is specifically configured to send the corresponding relationship between the target key and the target serial number to the client, so that the client obtains the target compression dictionary according to the corresponding relationship between the target key and the target serial number.
As can be seen, in the apparatus for obtaining a compressed dictionary provided in the embodiment of the present invention, a server receives a data message from a client, where the data message includes uncompressed user data and a request identifier for requesting a target compressed dictionary corresponding to the uncompressed user data; and then, the server side judges whether the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and if so, establishes the target compression dictionary and sends the target compression dictionary to the client side. In this way, the client can acquire the compression dictionary by sending the request identifier of the target compression dictionary required by the uncompressed user data to the server. Even if the software version of the client is not updated, the required compression dictionary can be obtained from the server, so that the occupation of a large amount of flow resources and bandwidth resources due to the transmission of uncompressed user data to the server is avoided, and the use efficiency of the flow resources and the bandwidth resources is improved.
Referring to fig. 7, fig. 7 is a schematic diagram of an electronic device according to an embodiment of the present invention, as shown in fig. 7, the electronic device includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702 and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
sending a data message to a server, wherein the data message comprises uncompressed user data and a request identifier of a target compression dictionary corresponding to the uncompressed user data;
and acquiring a target compression dictionary sent by the server side to compress uncompressed user data by using the target compression dictionary, wherein the target compression dictionary is a data message sent by the server receiving client side, judging whether the data message carries a request identifier, and if so, establishing the target compression dictionary and sending the target compression dictionary to the client side.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
Referring to fig. 8, fig. 8 is a schematic view of an electronic device according to an embodiment of the present invention, as shown in fig. 8, the electronic device includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following steps when executing the program stored in the memory 803:
receiving a data message sent by a client, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
establishing a target compression dictionary;
and sending the target compression dictionary to the client so that the client acquires the target compression dictionary and uses the target compression dictionary to compress the uncompressed user data.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
An embodiment of the present invention further provides a computer-readable storage medium, which stores instructions that, when executed on a computer, cause the computer to execute any one of the above-mentioned methods for obtaining a compression dictionary.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute any of the above-mentioned methods for obtaining a compression dictionary.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
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 "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

Claims (24)

1. A method for obtaining a compression dictionary is applied to a client, and comprises the following steps:
sending a data message to a server, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
and acquiring the target compression dictionary sent by the server to compress uncompressed user data by using the target compression dictionary, wherein the target compression dictionary is a data message sent by a client and received by the server, judging whether the data message carries the request identifier, and if so, establishing the target compression dictionary and sending the target compression dictionary to the client.
2. The method of claim 1, wherein before the step of sending the data packet to the server, the method further comprises:
judging whether a target compression dictionary corresponding to the uncompressed user data exists in an existing compression dictionary of the client;
and if not, adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message.
3. The method of claim 2, wherein the uncompressed user data is stored in a format of key-value pair key: a value;
before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method further includes:
determining a corresponding relation between a target key in the uncompressed user data and a preset identifier;
and determining the corresponding relation between the target key and the identifier as the request identification.
4. The method according to claim 2, wherein before the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet, the method further comprises:
judging whether the times of the uncompressed user data appearing in a preset time period and the byte length of the uncompressed user data both accord with preset conditions or not;
and if so, executing the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message.
5. The method of claim 4,
the step of judging whether the number of times of occurrence of the uncompressed user data in a preset time period and the byte length of the uncompressed user data both meet preset conditions includes:
judging whether the product of the occurrence frequency of the uncompressed user data in a preset time period and the byte length of the uncompressed user data exceeds a preset threshold value or not;
if so, the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message is executed, including:
and if the product exceeds the preset threshold, the uncompressed user data meets the preset condition, and the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data message is executed.
6. The method of claim 1, wherein the uncompressed user data is stored in a key format: the compression dictionary comprises a value and a preset serial number corresponding relation;
the step of obtaining the target compression dictionary sent by the server side includes:
receiving a corresponding relation between a target key in the uncompressed user data sent by the server and a target sequence number in the target compression dictionary, wherein the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and generating the target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
7. A method for obtaining a compression dictionary is applied to a server side, and comprises the following steps:
receiving a data message sent by a client, wherein the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
establishing the target compression dictionary;
and sending the target compression dictionary to the client so that the client can acquire the target compression dictionary and compress the uncompressed user data by using the target compression dictionary.
8. The method of claim 7,
the step of receiving a data message sent by a client, where the data message includes uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, includes:
receiving a data message sent by the client, wherein the data message comprises uncompressed user data;
before the step of establishing the target compression dictionary, the method further comprises:
judging whether the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
if so, executing the step of establishing the target compression dictionary.
9. The method of claim 8, wherein the uncompressed user data includes a keyword key;
the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
the step of determining whether the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data includes:
judging whether the data message comprises the identifier or not;
if so, executing the step of establishing the target compression dictionary, comprising:
and if the data message comprises the identifier, determining that the data message carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and executing the step of establishing the target compression dictionary.
10. The method of claim 7, wherein prior to the step of establishing the target compression dictionary, the method further comprises:
judging whether the target compression dictionary is included in the compression dictionary stored at the server side;
if yes, determining the target compression dictionary from the stored compression dictionaries;
and if not, executing the step of establishing the target compression dictionary.
11. The method of claim 7, wherein the uncompressed user data is stored in a key format: a value; the compression dictionary comprises a corresponding relation between a value and a preset serial number;
prior to the step of sending the target compression dictionary to the client, the method further comprises:
establishing a corresponding relation between a target key in the uncompressed user data and a target sequence number in the target compression dictionary, wherein the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
the step of sending the target compression dictionary to the client includes:
and sending the corresponding relation between the target key and the target serial number to the client so that the client acquires the target compression dictionary according to the corresponding relation between the target key and the target serial number and the uncompressed user data.
12. An apparatus for obtaining a compression dictionary, applied to a client, the apparatus comprising:
the device comprises a sending unit, a receiving unit and a processing unit, wherein the sending unit is used for sending a data message to a server side, and the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
and the obtaining unit is used for obtaining the target compression dictionary sent by the server so as to compress uncompressed user data by using the target compression dictionary, the target compression dictionary is a data message sent by a client and received by the server, whether the request identifier is carried in the data message is judged, and if yes, the target compression dictionary is established and sent to the client.
13. The apparatus of claim 12, further comprising:
a first judging unit, configured to judge whether a target compression dictionary corresponding to the uncompressed user data exists in an existing compression dictionary of the client;
an adding unit, configured to add, in the data packet, the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data if the determination result of the determining unit is that the target compression dictionary corresponding to the uncompressed user data does not exist in the existing compression dictionary of the client.
14. The apparatus of claim 13, wherein the uncompressed user data is stored in a key format: a value;
the device further comprises:
the first determining unit is used for determining the corresponding relation between the target key in the uncompressed user data and a preset identifier;
and the second determining unit is used for determining the corresponding relation between the target key and a preset identifier as the request identifier.
15. The apparatus of claim 13, further comprising:
a second judging unit, configured to judge whether the number of times the uncompressed user data appears in a preset time period and a byte length of the uncompressed user data both meet preset conditions;
an executing unit, configured to, if the determination result of the second determining unit is that the uncompressed user data meets the preset condition, execute the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet.
16. The apparatus of claim 15,
the second determining unit is specifically configured to determine whether a product of a number of times the uncompressed user data appears within a preset time period and a byte length of the uncompressed user data exceeds a preset threshold;
the execution unit is specifically configured to, if the product exceeds the preset threshold, make the uncompressed user data meet the preset condition, and execute the step of adding the request identifier for requesting the target compression dictionary corresponding to the uncompressed user data in the data packet.
17. The apparatus of claim 12, wherein the uncompressed user data is stored in a key format: the compression dictionary comprises a value and a preset serial number corresponding relation;
the acquisition unit includes: a receiving subunit and a generating subunit;
the receiving subunit is configured to receive a correspondence between a target key in the uncompressed user data sent by the server and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
and the generating subunit is configured to generate the target compression dictionary according to the correspondence between the target key and the target serial number and the uncompressed user data.
18. An apparatus for obtaining a compression dictionary, applied to a server, the apparatus comprising:
the device comprises a receiving unit, a sending unit and a processing unit, wherein the receiving unit is used for receiving a data message sent by a client, and the data message comprises uncompressed user data and a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
a first establishing unit, configured to establish the target compression dictionary;
and the sending unit is used for sending the target compression dictionary to the client so that the client can acquire the target compression dictionary and use the target compression dictionary to compress the uncompressed user data.
19. The apparatus of claim 18,
the receiving unit is specifically configured to receive a data packet sent by the client, where the data packet includes uncompressed user data;
the device further comprises:
a first judging unit, configured to judge whether the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data;
and the first execution unit is configured to trigger the first establishing unit if the determination result of the determining unit indicates that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data.
20. The apparatus of claim 19,
the uncompressed user data comprises a keyword key;
the request identification comprises a corresponding relation between a preset identifier and a target key in the uncompressed user data;
the first determining unit is specifically configured to determine whether the data packet includes the identifier;
the first execution unit is specifically configured to determine, if the determination result of the first determination unit is that the data packet includes the identifier, that the data packet carries a request identifier for requesting a target compression dictionary corresponding to the uncompressed user data, and trigger the first establishment unit.
21. The apparatus of claim 18, further comprising:
a second judging unit, configured to judge whether the target compression dictionary is included in the compression dictionary already stored at the server;
a determining unit, configured to determine the target compression dictionary from the stored compression dictionary if the determination result of the second determining unit is that the target compression dictionary is included in the compression dictionary stored at the server side;
a second executing unit, configured to trigger the first establishing unit if the determination result of the second determining unit is that the target compression dictionary is not included in the compression dictionaries stored at the server side.
22. The apparatus of claim 18,
the storage format of the uncompressed user data is key: a value;
the compression dictionary comprises a corresponding relation between a value and a preset serial number;
the device further comprises:
a second establishing unit, configured to establish a correspondence between a target key in the uncompressed user data and a target sequence number in the target compression dictionary, where the target sequence number is a preset sequence number corresponding to a target value in the target compression dictionary, and the target value is a value corresponding to the target key in the uncompressed user data;
the sending unit is specifically configured to send the corresponding relationship between the target key and the target serial number to the client, so that the client obtains the target compression dictionary according to the corresponding relationship between the target key and the target serial number.
23. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
24. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 7 to 11 when executing a program stored in the memory.
CN201711249958.4A 2017-12-01 2017-12-01 Method and device for acquiring compression dictionary Active CN108092956B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711249958.4A CN108092956B (en) 2017-12-01 2017-12-01 Method and device for acquiring compression dictionary

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711249958.4A CN108092956B (en) 2017-12-01 2017-12-01 Method and device for acquiring compression dictionary

Publications (2)

Publication Number Publication Date
CN108092956A CN108092956A (en) 2018-05-29
CN108092956B true CN108092956B (en) 2020-12-04

Family

ID=62173569

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711249958.4A Active CN108092956B (en) 2017-12-01 2017-12-01 Method and device for acquiring compression dictionary

Country Status (1)

Country Link
CN (1) CN108092956B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109088867A (en) * 2018-08-08 2018-12-25 浙江天地人科技有限公司 A method of reducing data and uploads the connection frequency
CN111510419B (en) * 2019-01-31 2021-03-30 华为技术有限公司 Data compression method and base station
CN112333769B (en) * 2019-08-05 2022-10-11 华为技术有限公司 Communication method and device
CN112769730B (en) * 2019-10-21 2023-03-24 北京车和家信息技术有限公司 Page compression method, device, client and server
CN114666406B (en) * 2022-02-24 2023-11-21 国电南瑞科技股份有限公司 Electric power Internet of things data compression method and device based on object model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211352A (en) * 2006-12-28 2008-07-02 凌阳科技股份有限公司 Electronic dictionary data update system and its method
CN102194499A (en) * 2010-03-15 2011-09-21 华为技术有限公司 Method and device for synchronizing compressed dictionary
CN103716056A (en) * 2012-09-29 2014-04-09 华为技术有限公司 Data compression method, data decompression method and devices
CN104917786A (en) * 2014-03-11 2015-09-16 杭州雾隐美地传媒有限公司 Method and module for saving transmission flow during interaction of client and server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9576013B2 (en) * 2014-04-03 2017-02-21 Sap Se Optimizing update operations in in-memory database systems

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211352A (en) * 2006-12-28 2008-07-02 凌阳科技股份有限公司 Electronic dictionary data update system and its method
CN102194499A (en) * 2010-03-15 2011-09-21 华为技术有限公司 Method and device for synchronizing compressed dictionary
CN103716056A (en) * 2012-09-29 2014-04-09 华为技术有限公司 Data compression method, data decompression method and devices
CN104917786A (en) * 2014-03-11 2015-09-16 杭州雾隐美地传媒有限公司 Method and module for saving transmission flow during interaction of client and server

Also Published As

Publication number Publication date
CN108092956A (en) 2018-05-29

Similar Documents

Publication Publication Date Title
CN108092956B (en) Method and device for acquiring compression dictionary
CN108769111B (en) Server connection method, computer readable storage medium and terminal device
WO2017028779A1 (en) Configuration method and apparatus for internet of things protocol conversion function, nonvolatile computer storage medium and electronic device
CN108845816A (en) Application program update method, system, computer equipment and storage medium
CN109391673B (en) Method, system and terminal equipment for managing update file
CN106534268B (en) Data sharing method and device
CN112314003A (en) Cellular telecommunications network comprising a plurality of network slices
CN111563199B (en) Data processing method and device
CN112866062A (en) Distributed pressure test system, method, device, equipment and storage medium
CN112311720B (en) Data transmission method and device
CN110874314A (en) Pressure measurement method, apparatus, device and medium
CN114125071B (en) Data compression transmission method and device
CN112565337B (en) Request transmission method, server, client, system and electronic equipment
CN112468585B (en) Data transmission method and device, electronic equipment and storage medium
CN108011952B (en) Method and device for acquiring compression dictionary
CN110677683B (en) Video storage and video access method and distributed storage and video access system
CN111556154A (en) Data transmission method, device, equipment and computer readable storage medium
CN109471713B (en) Method and device for inquiring information
CN114172998B (en) File transmission method and device, electronic equipment and storage medium
CN112131263B (en) Software package acquisition method, system, device, electronic equipment and storage medium
CN113204683B (en) Information reconstruction method and device, storage medium and electronic equipment
CN112422525B (en) Fault data transmission method, device, equipment and storage medium
CN112566054B (en) Method and system for optimizing message interaction process
CN114244911A (en) Voice analysis method and device, receiving terminal equipment and storage medium
CN110266814B (en) Transmission method and transmission device

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