Data writing method, device and equipment, medium and vehicle
By receiving data write requests in the database and performing data compression writes when the real-time storage rate is above a threshold, the problems of excessive database latency and decreased CPU utilization are solved, achieving efficient use and extended lifespan of storage devices.
Patent Information
- Application Number
- CN202410586789.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-11-11
AI Technical Summary
During database use, the increased data volume leads to excessive latency, and file system compression affects CPU utilization, thus impacting processing performance.
By receiving data write requests, the system compares the real-time storage rate of the storage device with a set threshold. When the real-time storage rate is higher than the threshold, the system compresses the data and writes it to the storage device. The threshold is dynamically adjusted to reduce the impact on system performance.
While ensuring data write performance, it extends the lifespan of storage devices and reduces the impact on system performance.
Smart Images

Figure CN120929004A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a data writing method, apparatus, device, medium, and vehicle. Background Technology
[0002] When storing data in a database, the database will grow larger as usage increases, and the time to access the data in the database will also increase, resulting in excessive latency.
[0003] In related technologies, the lifespan can be extended by enabling file system data compression. This involves compressing the data stored on the device through file system compression, thereby reducing the amount of data that must be written to the storage medium and extending the device's lifespan. However, since data compression and decompression require additional resources, it can easily affect the utilization rate of the central processing unit (CPU) and impact processing performance when the device is relatively idle and has ample space. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a data writing method, apparatus, device, medium, and vehicle.
[0005] Firstly, this disclosure provides a data writing method, including:
[0006] Receive data write request;
[0007] Obtain the real-time storage rate of the storage device and compare it with the storage rate threshold;
[0008] When the real-time storage rate is greater than the storage rate threshold, the data in the data write request is compressed to obtain the corresponding compressed data, and the compressed data is written to the storage device.
[0009] Secondly, this disclosure provides a data writing device, comprising:
[0010] The request receiving module is used to receive data write requests;
[0011] The data comparison module is used to obtain the real-time storage rate of the storage device and compare the real-time storage rate with the storage rate threshold.
[0012] The data writing module is used to compress the data in the data writing request when the real-time storage rate is greater than the storage rate threshold, obtain the corresponding compressed data, and write the compressed data to the storage device.
[0013] Thirdly, this disclosure provides a data writing device, comprising:
[0014] processor;
[0015] Memory, used to store executable instructions;
[0016] The processor is used to read executable instructions from memory and execute the executable instructions to implement the data writing method of the first aspect.
[0017] Fourthly, this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the data writing method of the first aspect.
[0018] Fifthly, this disclosure provides a vehicle including the data writing device described above.
[0019] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0020] The data writing method, apparatus, device, medium, and vehicle of this disclosure are capable of receiving a data writing request, then obtaining the real-time storage rate of the storage device, comparing the real-time storage rate with a storage rate threshold, and then, if the real-time storage rate is greater than the storage rate threshold, compressing the data in the data writing request to obtain the corresponding compressed data, and writing the compressed data to the storage device. Thus, by comparing the real-time storage rate with the storage rate threshold, data compression writing can be performed when the real-time storage rate is high, thereby extending the lifespan of the storage device while ensuring data writing performance. Attached Figure Description
[0021] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0022] Figure 1 A flowchart illustrating a data writing method provided in an embodiment of this disclosure;
[0023] Figure 2 A flowchart illustrating another data writing method provided in this embodiment of the disclosure;
[0024] Figure 3 This is a schematic diagram of the structure of a data writing device provided in an embodiment of the present disclosure;
[0025] Figure 4 This is a schematic diagram of the structure of a data writing device provided in an embodiment of the present disclosure. Detailed Implementation
[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0028] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0029] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0030] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0031] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0032] To address the aforementioned problems, this disclosure provides a data writing method, apparatus, device, medium, and vehicle. The following will first consider... Figures 1 to 2 The data writing method provided in the embodiments of this disclosure will be described in detail.
[0033] Figure 1 A flowchart illustrating a data writing method provided in an embodiment of this disclosure is shown.
[0034] In this embodiment of the disclosure, the data writing method can be performed by an electronic device. Specifically, the electronic device may include, but is not limited to, mobile terminals such as computer devices, mobile phones, in-vehicle devices, vehicle controllers, tablet computers, and wearable devices.
[0035] like Figure 1 As shown, the data writing method may include the following steps.
[0036] S110, Receive data write request.
[0037] In this embodiment of the disclosure, the electronic device can receive a data write request.
[0038] Alternatively, a data write request can be a request to write data to a storage device.
[0039] Specifically, electronic devices can receive data write requests.
[0040] S120. Obtain the real-time storage rate of the storage device and compare the real-time storage rate with the storage rate threshold.
[0041] In this embodiment of the disclosure, the electronic device can obtain the real-time storage rate of the storage device and compare the real-time storage rate with a storage rate threshold.
[0042] Alternatively, the storage device can be a device used to store data.
[0043] Optionally, the real-time storage rate can be a representation of the proportion of storage in real time of the storage device.
[0044] Optionally, the storage rate threshold can be a pre-set storage ratio. For example, the storage rate threshold can be 70%, 80%, etc., and there is no limitation here.
[0045] Specifically, electronic devices can obtain the real-time storage rate of storage devices and compare the real-time storage rate r with the storage rate threshold R.
[0046] S130. When the real-time storage rate is greater than the storage rate threshold, compress the data in the data write request to obtain the corresponding compressed data, and write the compressed data to the storage device.
[0047] In this embodiment of the disclosure, when the real-time storage rate is greater than the storage rate threshold, the electronic device can compress the data in the data write request to obtain the corresponding compressed data and write the compressed data to the storage device.
[0048] Alternatively, data compression can be the process of encoding the original data with less space, which means reducing the amount of data to reduce storage space without losing useful information.
[0049] Optionally, the compressed data can be the data obtained by compressing the original data.
[0050] Specifically, after comparing the real-time storage rate r with the storage rate threshold R, if the real-time storage rate r is greater than the storage rate threshold R, the electronic device compresses the data in the data write request to obtain the corresponding compressed data and writes the compressed data to the storage device.
[0051] Therefore, in this embodiment of the present disclosure, a data write request can be received, then the real-time storage rate of the storage device can be obtained, and the real-time storage rate can be compared with a storage rate threshold. Then, if the real-time storage rate is greater than the storage rate threshold, the data in the data write request can be compressed to obtain the corresponding compressed data, and the compressed data can be written to the storage device. Thus, by comparing the real-time storage rate with the storage rate threshold, data compression and writing can be performed when the real-time storage rate is high, thereby extending the lifespan of the storage device while ensuring data write performance.
[0052] Optionally, S110 may specifically include: receiving a data write request sent by the upper-layer interface and adding the data write request to the write request queue of the storage device buffer.
[0053] In this embodiment of the disclosure, the electronic device can receive a data write request sent by the upper-layer interface and add the data write request to the write request queue of the storage device buffer.
[0054] Optionally, the buffer can be a region for caching data.
[0055] Optionally, the write request queue can be a queue used to hold multiple data write requests.
[0056] Specifically, the electronic device can receive data write requests sent by the upper-layer interface and add the data write request to the write request queue of the storage device buffer.
[0057] Therefore, the received data write requests are added to the write request queue of the storage device's buffer, thereby buffering the data write requests, eliminating high-concurrency access peaks, and speeding up data processing.
[0058] Optionally, the data writing method may further include: statistically analyzing the data writing requests sent by the upper-layer interface within a preset time period to obtain statistical data; reducing the storage rate threshold when the statistical data decreases to the same level as the storage rate threshold; and increasing the storage rate threshold when the statistical data increases to the same level as the storage rate threshold.
[0059] In this embodiment of the disclosure, the electronic device can statistically analyze the data write requests sent by the upper-layer interface within a preset time period to obtain statistical data.
[0060] Optionally, the preset time can be a pre-set time. For example, the preset time can be 60s, 70s, etc., and there is no limitation here.
[0061] Optionally, the statistics can be used to characterize the number of data write requests within a preset time period.
[0062] Specifically, electronic devices can collect statistics on data write requests sent by upper-layer interfaces within a preset time period to obtain statistical data.
[0063] In some embodiments, the storage rate threshold is reduced when the statistical data decreases to the same level as the storage rate threshold.
[0064] Specifically, after obtaining statistical data, if the statistical data decreases and approaches the storage rate threshold R within a preset time, the electronic device can dynamically reduce the storage rate threshold. For example, the storage rate threshold R can be 50%, and it can be dynamically reduced by 10% or 20%, making the storage rate threshold R 40%, 30%, etc., without limitation here.
[0065] In other embodiments, the storage rate threshold is increased when the statistical data increases to the same level as the storage rate threshold.
[0066] Specifically, after receiving statistical data, if the statistical data increases and approaches the storage rate threshold R within a preset time, the electronic device can dynamically increase the storage rate threshold. For example, the storage rate threshold R can be 50%, and it can be dynamically increased by 10% or 20% to make the storage rate threshold R become 60% or 70%, etc., without limitation here.
[0067] Therefore, by dynamically adjusting the storage rate threshold, the impact on system performance when data compression is enabled can be effectively reduced, thus balancing performance and extending the lifespan of the storage medium.
[0068] Optionally, after adding the data write request to the write request queue of the storage device buffer, the data write method may further include: determining whether the data compression function is enabled; if the data compression function is enabled, compressing the data of the data write request in the write request queue to obtain the corresponding compressed data, and writing the compressed data to the storage device; if the data compression function is not enabled, obtaining the real-time storage rate of the storage device.
[0069] In this embodiment of the disclosure, the electronic device can determine whether to enable the data compression function.
[0070] Optionally, the data compression function can be performed via F2FS (Flash-Friendly File System).
[0071] Specifically, electronic devices can first determine whether data compression is enabled.
[0072] In some embodiments, when data compression is enabled, the data of the write request in the write request queue is compressed to obtain the corresponding compressed data, and the compressed data is written to the storage device.
[0073] Specifically, after determining whether the data compression function is enabled, if the electronic device determines that the data compression function is enabled, the electronic device can compress the data in the write request queue to obtain the corresponding compressed data and write the compressed data to the storage device.
[0074] In other embodiments, the real-time storage rate of the storage device is obtained without enabling data compression.
[0075] Specifically, after determining whether data compression is enabled, if the electronic device determines that data compression is not enabled, the electronic device can obtain the real-time storage rate of the storage device.
[0076] Optionally, S130 may specifically include: enabling data compression when the real-time storage rate is greater than the storage rate threshold; and when the data compression function is enabled, compressing the data of the write request in the write request queue to obtain the corresponding compressed data, and writing the compressed data to the storage device.
[0077] In this embodiment of the disclosure, when the real-time storage rate is greater than the storage rate threshold, the electronic device can enable the data compression function.
[0078] Specifically, after comparing the real-time storage rate with the storage rate threshold, if the electronic device determines that the real-time storage rate is greater than the storage rate threshold, it can enable the data compression function, that is, enable F2FS data compression.
[0079] Furthermore, with the data compression function enabled, the electronic device can compress the data in the write request queue to obtain the corresponding compressed data, and then write the compressed data to the storage device.
[0080] Optionally, after S120, the data writing method may further include: writing the data in the data writing request to the storage device when the real-time storage rate is less than or equal to the storage rate threshold.
[0081] In this embodiment of the disclosure, when the real-time storage rate is less than or equal to the storage rate threshold, the electronic device can write the data in the data write request to the storage device.
[0082] Specifically, the electronic device compares the real-time storage rate with the storage rate threshold. When it is determined that the real-time storage rate is less than or equal to the storage rate threshold, the electronic device can write the data in the data write request to the storage device.
[0083] Therefore, by setting a threshold to enable data compression, the lifespan of storage devices can be effectively extended while ensuring initial storage performance.
[0084] Figure 2 A flowchart illustrating another data writing method provided in an embodiment of this disclosure is shown.
[0085] like Figure 2 As shown, the data writing method may include the following steps.
[0086] S210. Add the data write request to the write request queue of the storage device buffer.
[0087] In this embodiment of the disclosure, the electronic device can receive a data write request sent by the upper-layer interface and add the data write request to the write request queue of the storage device buffer.
[0088] S220, Is data compression enabled?
[0089] In this embodiment of the disclosure, the electronic device can determine whether the data compression function has been enabled.
[0090] Specifically, the electronic device can first determine whether the data compression function is enabled. If the data compression function is enabled, then execute S230; if the data compression function is not enabled, then execute S240.
[0091] S230. Compress the data in the data write request.
[0092] In this embodiment of the disclosure, when the data compression function is enabled, the electronic device can compress the data in the data write request.
[0093] S240, Obtain the real-time storage rate of the storage device.
[0094] In this embodiment of the disclosure, the electronic device can obtain the real-time storage rate of the storage device when the data compression function is not enabled.
[0095] S250, Is the real-time storage rate greater than the storage rate threshold?
[0096] In this embodiment of the disclosure, the electronic device can determine whether the real-time storage rate is greater than a storage rate threshold. If the real-time storage rate is greater than the storage rate threshold, then S260 is executed; if the real-time storage rate is less than or equal to the storage rate threshold, then S270 is executed.
[0097] S260, Enable data compression function.
[0098] In this embodiment of the disclosure, when the real-time storage rate is greater than the storage rate threshold, the electronic device can enable the data compression function, that is, it can enable F2FS data compression.
[0099] Furthermore, with the data compression function enabled, the electronic device can compress the data in the write request queue to obtain the corresponding compressed data, and then write the compressed data to the storage device.
[0100] S270, Write to storage device.
[0101] In this embodiment of the disclosure, when the real-time storage rate is less than or equal to the storage rate threshold, the electronic device can write the data in the data write request to the storage device.
[0102] Figure 3 A schematic diagram of a data writing device provided in an embodiment of this disclosure is shown.
[0103] In some embodiments of this disclosure, Figure 3 The data writing device shown can be located in an electronic device. Specifically, the electronic device may include, but is not limited to, mobile terminals such as computer equipment, mobile phones, in-vehicle equipment, vehicle controllers, tablet computers, and wearable devices.
[0104] like Figure 3 As shown, the data writing device 300 may include a request receiving module 310, a data comparison module 320, and a data writing module 330.
[0105] The request receiving module 310 can be used to receive data write requests.
[0106] The data comparison module 320 can be used to obtain the real-time storage rate of the storage device and compare the real-time storage rate with the storage rate threshold.
[0107] The data writing module 330 can be used to compress the data in the data writing request when the real-time storage rate is greater than the storage rate threshold, obtain the corresponding compressed data, and write the compressed data to the storage device.
[0108] Therefore, in this embodiment of the present disclosure, a data write request can be received, then the real-time storage rate of the storage device can be obtained, and the real-time storage rate can be compared with a storage rate threshold. Then, if the real-time storage rate is greater than the storage rate threshold, the data in the data write request can be compressed to obtain the corresponding compressed data, and the compressed data can be written to the storage device. Thus, by comparing the real-time storage rate with the storage rate threshold, data compression and writing can be performed when the real-time storage rate is high, thereby extending the lifespan of the storage device while ensuring data write performance.
[0109] In some embodiments of this disclosure, the request receiving module 310 may be specifically used to receive data write requests sent by the upper-layer interface.
[0110] In some embodiments of this disclosure, the request receiving module 310 may also be specifically used to add the data write request to the write request queue of the storage device's buffer after receiving the data write request.
[0111] In some embodiments of this disclosure, the data writing device 300 may further include a data statistics module, a first modification module, and a second modification module.
[0112] This data statistics module can be used to collect statistics on data write requests sent by the upper-layer interface within a preset time before obtaining the real-time storage rate of the storage device and comparing the real-time storage rate with the storage rate threshold.
[0113] The first modification module can be used to reduce the storage rate threshold when the statistical data decreases to the same level as the storage rate threshold.
[0114] The second modification module can be used to increase the storage rate threshold when the statistical data increases to the same level as the storage rate threshold.
[0115] In some embodiments of this disclosure, the data writing device 300 may further include a function determination module, a first processing module, and a second processing module.
[0116] This function judgment module can be used to determine whether the data compression function has been enabled after the data write request is added to the write request queue of the storage device's buffer.
[0117] The first processing module can be used to compress the data of the write request in the write request queue when the data compression function is enabled, to obtain the corresponding compressed data, and write the compressed data to the storage device.
[0118] This second processing module can be used to obtain the real-time storage rate of the storage device when the data compression function is not enabled.
[0119] In some embodiments of this disclosure, the data writing module 330 may specifically include a function activation unit and a first writing unit.
[0120] This function enable unit can be used to enable data compression when the real-time storage rate is greater than the storage rate threshold.
[0121] The first write unit can be used to compress the data of the write request in the write request queue when the data compression function is enabled, to obtain the corresponding compressed data, and write the compressed data to the storage device.
[0122] In some embodiments of this disclosure, the data writing module 330 may further include a second writing unit.
[0123] The second write unit can be used to write the data in the data write request to the storage device after obtaining the real-time storage rate of the storage device and comparing the real-time storage rate with the storage rate threshold. If the real-time storage rate is less than or equal to the storage rate threshold, the write unit can write the data in the data write request to the storage device.
[0124] It should be noted that, Figure 3 The data writing device 300 shown can perform... Figures 1 to 2 The various steps in the method embodiment shown are implemented. Figures 1 to 2 The processes and effects in the method embodiments shown are not described in detail here.
[0125] Figure 4 A schematic diagram of the structure of a data writing device provided in an embodiment of this disclosure is shown.
[0126] In some embodiments of this disclosure, Figure 4 The data writing device shown can be any electronic device that the user wants to write data to. Specifically, the electronic device can include, but is not limited to, mobile terminals such as mobile phones, in-vehicle devices, vehicle controllers, tablets, wearable devices, and smart home devices.
[0127] like Figure 4 As shown, the data writing device may include a processor 401 and a memory 402 storing computer program instructions.
[0128] Specifically, the processor 401 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0129] Memory 402 may include a large-capacity storage for information or instructions. For example, and not limitingly, memory 402 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 402 may include removable or non-removable (or fixed) media. Where appropriate, memory 402 may be internal or external to the integrated gateway device. In a particular embodiment, memory 402 is a non-volatile solid-state memory. In a particular embodiment, memory 402 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0130] The processor 401 reads and executes computer program instructions stored in the memory 402 to perform the steps of the data writing method provided in the embodiments of this disclosure.
[0131] In one example, the data writing device may also include a transceiver 403 and a bus 404. Wherein, as... Figure 4 As shown, the processor 401, memory 402 and transceiver 403 are connected via bus 404 and communicate with each other.
[0132] Bus 404 includes hardware, software, or both. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 404 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0133] This disclosure also provides a computer-readable storage medium that can store a computer program, which, when executed by a processor, enables the processor to implement the data writing method provided in this disclosure.
[0134] The aforementioned storage medium may include, for example, a memory 402 containing computer program instructions, which can be executed by the processor 401 of the data writing device to complete the data writing method provided in this embodiment. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0135] This disclosure also provides a vehicle including the data writing device described above. It is understood that the vehicle may also include a processor, a memory, and a computer program. The computer program is stored in the memory and configured to be executed by the processor to implement the data writing method provided in this disclosure. The processor and memory are already... Figure 4 The parts of the illustrated embodiments will not be repeated here.
[0136] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0137] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data writing method, characterized in that, include: Receive data write request; Obtain the real-time storage rate of the storage device and compare the real-time storage rate with a storage rate threshold; If the real-time storage rate is greater than the storage rate threshold, the data in the data write request is compressed to obtain the corresponding compressed data, and the compressed data is written to the storage device.
2. The method according to claim 1, characterized in that, The received data write request includes: Receive the data write request sent by the upper-layer interface; After receiving the data write request, the method further includes adding the data write request to the write request queue of the buffer of the storage device.
3. The method according to claim 2, characterized in that, The method further includes: Within a preset time period, the data write requests sent by the upper-layer interface are statistically analyzed to obtain statistical data. If the statistical data decreases to the same level as the storage rate threshold, then reduce the storage rate threshold. If the statistical data increases to the same level as the storage rate threshold, then the storage rate threshold is increased.
4. The method according to claim 2, characterized in that, After adding the data write request to the write request queue of the storage device's buffer, the method further includes: Determine if data compression is enabled; With the data compression function enabled, the data of the data write request in the write request queue is compressed to obtain the corresponding compressed data, and the compressed data is written to the storage device. Without enabling the data compression function, obtain the real-time storage rate of the storage device.
5. The method according to claim 4, characterized in that, When the real-time storage rate is greater than the storage rate threshold, the data in the data write request is compressed to obtain corresponding compressed data, and the compressed data is written to the storage device, including: If the real-time storage rate is greater than the storage rate threshold, the data compression function is enabled. When the data compression function is enabled, the data of the data write request in the write request queue is compressed to obtain the corresponding compressed data, and the compressed data is written to the storage device.
6. The method according to claim 1, characterized in that, After obtaining the real-time storage rate of the storage device and comparing the real-time storage rate with a storage rate threshold, the method further includes: If the real-time storage rate is less than or equal to the storage rate threshold, the data in the data write request is written to the storage device.
7. A data writing device, characterized in that, include: The request receiving module is used to receive data write requests; The data comparison module is used to obtain the real-time storage rate of the storage device and compare the real-time storage rate with a storage rate threshold. The data writing module is used to compress the data in the data writing request to obtain corresponding compressed data when the real-time storage rate is greater than the storage rate threshold, and then write the compressed data to the storage device.
8. A data writing device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the data writing method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the data writing method according to any one of claims 1-6.
10. A vehicle, characterized in that, Includes the data writing device as described in claim 7, the data writing apparatus as described in claim 8, or the computer-readable storage medium as described in claim 9.