Summary of the invention
In view of the above technical problems, this specification embodiment provides a kind of object storage, read method, device and business
Server, technical solution are as follows:
According to this specification embodiment in a first aspect, providing a kind of object storage method, which comprises
Serializing processing is carried out to target object, obtains the serialized data of the target object;
Deconsolidation process is carried out to the serialized data;
Based on deconsolidation process as a result, multiple data fragmentations of the serialized data are determined, by the multiple data fragmentation
Store into database, and store for indicate the multiple data fragmentation in the database storage location index letter
Breath.
According to the second aspect of this specification embodiment, a kind of object read method is provided, which comprises
Target storage position is determined in the database according to the index information pre-saved, and the index information is for indicating
The storage location of multiple data fragmentations in the database;
Based on the target storage position, data fragmentation is read from the database;
Processing is merged to the data fragmentation read;
Unserializing processing is carried out to the obtained data of merging treatment, obtains target object.
According to the third aspect of this specification embodiment, a kind of object storage device is provided, described device includes:
Serialization module obtains the serialized data of the target object for carrying out serializing processing to target object;
Module is split, for carrying out deconsolidation process to the serialized data;
Memory module, for based on deconsolidation process as a result, determine multiple data fragmentations of the serialized data, will be described
Multiple data fragmentations are stored into database, and are stored for indicating that the multiple data fragmentation stores position in the database
The index information set.
According to the fourth aspect of this specification embodiment, a kind of object reading device is provided, described device includes:
Determining module, for determining target storage position, the rope in the database according to the index information pre-saved
Fuse is ceased for indicating the storage location of multiple data fragmentations in the database;
Read module reads data fragmentation for being based on the target storage position from the database;
Merging module, for merging processing to the data fragmentation read;
Unserializing module obtains target object for carrying out unserializing processing to the obtained data of merging treatment.
According to the 5th of this specification embodiment aspect, a kind of service server is provided, including memory, processor and deposit
Store up the computer program that can be run on a memory and on a processor, wherein the processor is realized when executing described program
The object storage method that this specification embodiment provides.
According to the 6th of this specification embodiment aspect, a kind of service server is provided, including memory, processor and deposit
Store up the computer program that can be run on a memory and on a processor, wherein the processor is realized when executing described program
The object read method that this specification embodiment provides.
Technical solution provided by this specification embodiment obtains target by carrying out serializing processing to target object
The serialized data of object carries out deconsolidation process to the serialized data, based on deconsolidation process as a result, determining serialized data
Multiple data fragmentations store multiple data fragmentations into database, and store for indicating multiple data fragmentation in data
The index information of storage location in library can break through the limitation of bottom storage, improve the storage performance of super large object.
Technical solution provided by this specification embodiment, by true in the database according to the index information pre-saved
Set the goal storage location, is based on the target storage position, data fragmentation is read from database, to the data fragmentation read
Merge processing;Unserializing processing is carried out to the obtained data of merging treatment, target object is obtained, super large can be improved
The reading performance of object.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
This specification embodiment can be limited.
In addition, any embodiment in this specification embodiment does not need to reach above-mentioned whole effects.
Specific embodiment
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
Since in the prior art, the access performance using document form storage super large object is excessively poor, therefore, this specification
Embodiment proposes a kind of object storage method and object read method, to improve the access performance of object.
Illustrate first, the realization of the object storage method and object read method is based on Hbase database, also i.e. by object
It stores into Hbase data, subsequent, the reading object from Hbase database.It is as follows, it is right to this respectively that following embodiments are shown
As storage method and the object read method are illustrated:
Firstly, being illustrated to object storage method:
Referring to Figure 1, a kind of embodiment process of the object storage method provided for one exemplary embodiment of this specification
Figure, this method may comprise steps of:
Step 102: serializing processing being carried out to target object, obtains the serialized data of target object.
Illustrate first, in this specification embodiment, for convenience, object to be processed is known as target object.
In order to enable target object can persist preservation, serializing processing can be carried out to target object, obtain one group
Byte, this group of byte are the serialized data of target object.
Wherein, when carrying out serializing processing to target object, json, kryo or jdk Serialize can be used
Etc. modes, this specification embodiment it is without limitation.
In addition, compression processing further can be done to the serialized data after obtaining the serialized data of target object,
It is subsequent, it is stored for the serialized data after compression processing.It is handled by this kind, number to be stored can be further decreased
According to data volume, improve the access performance of data.
Step 104: deconsolidation process is carried out to serialized data.
In one embodiment, physics deconsolidation process directly can be carried out to the serialized data that step 102 obtains, here institute
" the physics deconsolidation process " said refers in system memory, serialized data is split into multiple data fragmentations, for example, it is assumed that sequence
Columnization data include 100 bytes, then are 10 groupings by 100 byte splits, each grouping includes 10 bytes, each
Grouping is a data fragmentation, obtains 10 data fragmentations.
In one embodiment, logic deconsolidation process can be carried out to the serialized data that step 102 obtains, it is mentioned here
" logic deconsolidation process " refers in system memory, based on preset fractionation rule, obtains multiple fractionations in serialized data
Position, for example, it is assumed that serialized data includes 100 bytes, preset fractionation rule is that serialized data is split as 10
Data fragmentation, each data fragmentation include 10 bytes, then, accessed fractionation position includes: 10,20,30,40,50,
60,70,80,90, it will be appreciated by persons skilled in the art that being based on this 9 fractionation positions, serialized data can be split
At 10 data fragmentations, wherein the data on 1~10 byte location are a data fragmentation, the number on 11~20 byte locations
According to for a data fragmentation, and so on, totally 10 data fragmentations.
By foregoing description as it can be seen that carrying out physics deconsolidation process to serialized data in memory, can generate in memory more
A data fragmentation, thus committed memory, and logic deconsolidation process is carried out to serialized data in memory, relate only to multiple tear open
Quartile sets the occupancy to memory, thus, physics deconsolidation process is carried out compared to serialized data, serialized data is patrolled
Collecting deconsolidation process can be reduced in object storing process, to the occupancy of memory, lifting system performance.
Step 106: based on deconsolidation process as a result, determining multiple data fragmentations of serialized data, by multiple data point
Piece is stored into database, and stores the index information for indicating multiple data fragmentations storage location in the database.
In this specification embodiment, if using " physics deconsolidation process mode " at step 104, then, at fractionation
After reason, multiple data fragmentations can be directly obtained, multiple data fragmentation is temporarily stored in memory, is stored subsequent
Cheng Zhong can then store multiple data fragmentations in memory into database;If at step 104 using " at logic fractionation
Reason mode ", then, it, can be based on the fractionation position got after deconsolidation process, determination is more in the serialized data of script
A data fragmentation directly stores the data fragmentation determined into database in subsequent storing process.
In one embodiment, it is based on Hase database, different data fragmentations can be stored respectively to Hbase database
Record of not going together in, it will be appreciated by persons skilled in the art that in Hbase database, a row record has unique
Rowkey value.
, can also be in Hbase database in this specification embodiment based on this, such as one of Hbase database
Storage is for indicating multiple data fragmentations index information of storage location namely multiple numbers in Hbase database in row record
According to the rowkey value of fragment be expert at record in Hbase database.
In one embodiment, multiple data fragmentations be expert at record in Hbase database can directly be stored
Rowkey value, for example, storage rowkey value include: rowkey#01, rowkey#02, rowkey#03 ..., rowkey#
10。
In another embodiment, can be expert in Hbase database record with " indirect " the multiple data fragmentations of storage
Rowkey value, " indirect " storage mentioned here refers to that the quantity of storing data fragment, such as 10 stores rowkey value
Prefix, such as " # " stores the start sequence number of rowkey value, such as " 01 ".It can be seen that passing through " indirect " the multiple numbers of storage
According to the rowkey value of fragment be expert at record in Hbase database, data storage capacity can be further decreased.
It will be appreciated by persons skilled in the art that can be used for the reading of subsequent object by storing above-mentioned index information,
As for the reading process of object, it may refer to the description in following embodiment illustrated in fig. 2, be first not detailed herein.
Technical solution provided by this specification embodiment obtains target by carrying out serializing processing to target object
The serialized data of object carries out deconsolidation process to the serialized data, based on deconsolidation process as a result, determining serialized data
Multiple data fragmentations store multiple data fragmentations into database, and store for indicating multiple data fragmentation in data
The index information of storage location in library can break through the limitation of bottom storage, improve the storage performance of super large object.
Secondly, being illustrated to object read method:
Fig. 2 is referred to, for a kind of embodiment process for object read method that one exemplary embodiment of this specification provides
Figure, the object read method on the basis of object storage method, may comprise steps of exemplified by above-mentioned Fig. 1:
Step 202: target storage position being determined according to the index information pre-saved in the database, which uses
In the storage location of the multiple data fragmentations of expression respectively in the database.
By the description in above-mentioned embodiment illustrated in fig. 1 it is found that during storage object, it can store the more of the object
The index information of a data fragmentation storage location in the database, then, it, then can basis first during reading object
The index information pre-saved determines target storage position in the database, such as determines target rowkey value.
Step 204: being based on target storage position, data fragmentation is read from database.
In this step, then data can be read from database based on the target storage position got in step 202
Fragment.
It will be appreciated by persons skilled in the art that the data fragmentation read is temporarily stored in memory.
Step 206: processing is merged to the data fragmentation read.
In one embodiment, physics merging treatment can be carried out to the data fragmentation read in step 204, it is referred to herein
" physics merging treatment " i.e. refer in system memory, multiple data fragmentations are spliced, complete serialized data is obtained,
It will be appreciated by persons skilled in the art that the complete serialized data is also temporarily stored in memory.
In one embodiment, logic merging treatment can be carried out to the data fragmentation read in step 204, it is referred to herein
" logic merging treatment " can refer to, the data fragmentation read is packaged into inlet flow.Those skilled in the art can manage
Solution, inlet flow refer to read the object of a byte sequence, and when needing to read data, program then can be from inlet flow
Read data source, it can be seen that, it is handled by this kind, then can logically realize the merging of data fragmentation.
By foregoing description as it can be seen that carrying out physics merging treatment to multiple data fragmentations in memory, can generate in memory
One complete serialized data, thus committed memory, and logic merging treatment is carried out to serialized data in memory, it does not relate to
And the occupancy of memory, thus, physics merging treatment is carried out compared to multiple data fragmentations, logic is carried out to multiple data fragmentations
Merging treatment can be reduced in object reading process, to the occupancy of memory, lifting system performance.
Step 208: unserializing processing being carried out to the obtained data of merging treatment, obtains target object.
Due in object storing process, storage be object serialized data, thus, in this step, can be right
The obtained serialized data of merging treatment carries out unserializing processing, obtains target object.
In addition, if having carried out compression processing to serialized data in object storing process, then, in this step, then
Processing first can be unziped it to the obtained data of merging treatment, inverted sequence then is carried out to the data after decompression again
Columnization processing, to obtain target object.
In addition, when unziping it processing to the obtained data of merging treatment, preferably using stream nested mode into
Row decompression.
Technical solution provided by this specification embodiment, by true in the database according to the index information pre-saved
Set the goal storage location, is based on the target storage position, data fragmentation is read from database, to the data fragmentation read
Merge processing;Unserializing processing is carried out to the obtained data of merging treatment, target object is obtained, super large can be improved
The reading performance of object.
Corresponding to embodiment of the method exemplified by above-mentioned Fig. 1, this specification embodiment also provides a kind of object storage device,
It is shown in Figure 3, for a kind of embodiment block diagram for object storage device that one exemplary embodiment of this specification provides, the device
It may include: serialization module 31, split module 32 and memory module 33.
Wherein, serialization module 31 obtain the sequence of the target object for carrying out serializing processing to target object
Change data;
Module 32 is split, for carrying out deconsolidation process to the serialized data;
Memory module 33, for based on deconsolidation process as a result, multiple data fragmentations of the serialized data are determined, by institute
It states multiple data fragmentations to store into database, and stores for indicating that the multiple data fragmentation stores in the database
The index information of position.
In one embodiment, the fractionation module 32 can be specifically used for:
Based on preset fractionation rule, multiple fractionation positions in the serialized data are obtained.
In one embodiment, different data fragmentations is stored respectively into the record of not going together of the database;
The index information includes: the rowkey value of the be expert at record of data fragmentation.
It is understood that serialization module 31, splitting module 32 and memory module 33 as three kinds of functional independences
Module can both be configured in a device simultaneously as shown in Figure 3, can also individually be configured in a device, therefore shown in Fig. 3
Structure should not be construed as the restriction to this specification example scheme.
Corresponding to embodiment of the method exemplified by above-mentioned Fig. 2, this specification embodiment also provides a kind of object reading device,
It is shown in Figure 4, for a kind of embodiment block diagram for object reading device that one exemplary embodiment of this specification provides, the device
It may include: determining module 41, read module 42, merging module 43 and unserializing module 44.
Wherein it is determined that module 41, for determining target storage position in the database according to the index information pre-saved,
The index information is for indicating the storage location of multiple data fragmentations in the database;
Read module 42 reads data fragmentation for being based on the target storage position from the database;
Merging module 43, for merging processing to the data fragmentation read;
Unserializing module 44 obtains target pair for carrying out unserializing processing to the obtained data of merging treatment
As.
In one embodiment, the merging module 43 is specifically used for:
The data fragmentation read is packaged into inlet flow.
It is understood that determining module 41,44 conduct of read module 42, merging module 43 and unserializing module
The module of four kinds of functional independences can both be configured in a device simultaneously as shown in Figure 4, can also individually be configured in device
In, therefore structure shown in Fig. 4 should not be construed as the restriction to this specification example scheme.
In addition, the function of modules and the realization process of effect are specifically detailed in the above method corresponding step in above-mentioned apparatus
Rapid realization process, details are not described herein.
This specification embodiment also provides a kind of service server, includes at least memory, processor and is stored in
On reservoir and the computer program that can run on a processor, wherein processor realizes object above-mentioned when executing described program
Storage method.This method includes at least: carrying out serializing processing to target object, obtains the serializing number of the target object
According to;Deconsolidation process is carried out to the serialized data;Based on deconsolidation process as a result, determining multiple data of the serialized data
Fragment stores the multiple data fragmentation into database, and stores for indicating the multiple data fragmentation in the number
According to the index information of storage location in library.
This specification embodiment also provides another service server, includes at least memory, processor and is stored in
On memory and the computer program that can run on a processor, wherein it is above-mentioned right that processor is realized when executing described program
As read method.This method includes at least: determining target storage position, institute in the database according to the index information pre-saved
Index information is stated for indicating the storage location of multiple data fragmentations in the database;Based on the target storage position,
Data fragmentation is read from the database;Processing is merged to the data fragmentation read;To obtained by merging treatment
Data carry out unserializing processing, obtain target object.
Fig. 5 shows one kind provided by this specification embodiment, and more specifically service server hardware configuration is illustrated
Figure, which may include: processor 510, memory 520, input/output interface 530, communication interface 540 and bus 550.
Wherein processor 55, memory 520, input/output interface 530 and communication interface 540 by bus 550 realize between
Communication connection inside equipment.
Processor 510 can use general CPU (Central Processing Unit, central processing unit), micro process
Device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one or
The modes such as multiple integrated circuits are realized, for executing relative program, to realize technical solution provided by this specification embodiment.
Memory 520 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 520 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 520, and execution is called by processor 55.
Input/output interface 530 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 540 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 550 includes an access, and in the various components of equipment, (such as processor 55, memory 520, input/output are connect
Mouthfuls 530 and communication interface 540) between transmit information.
It should be noted that although above equipment illustrates only processor 510, memory 520, input/output interface
530, communication interface 540 and bus 550, but in the specific implementation process, which can also include realizing to operate normally
Necessary other assemblies.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising realizing in above equipment
Component necessary to this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
Object storage method above-mentioned is realized when sequence is executed by processor.This method includes at least: carrying out at serializing to target object
Reason, obtains the serialized data of the target object;Deconsolidation process is carried out to the serialized data;Based on deconsolidation process knot
Fruit determines multiple data fragmentations of the serialized data, the multiple data fragmentation is stored into database, and store use
In the index information for indicating the multiple data fragmentation storage location in the database.
This specification embodiment also provides another computer readable storage medium, is stored thereon with computer program, should
Object read method above-mentioned is realized when program is executed by processor.This method includes at least: being believed according to the index pre-saved
Breath determines target storage position in the database, and the index information is used to indicate multiple data fragmentations in the database
Storage location;Based on the target storage position, data fragmentation is read from the database;To the data fragmentation read
Merge processing;Unserializing processing is carried out to the obtained data of merging treatment, obtains target object.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It is each to obtain computer equipment (can be personal computer, server or the network equipment etc.) execution this specification embodiment
Method described in certain parts of a embodiment or embodiment.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method
Part explanation.The apparatus embodiments described above are merely exemplary, wherein described be used as separate part description
Module may or may not be physically separated, can be each module when implementing this specification example scheme
Function realize in the same or multiple software and or hardware.Can also select according to the actual needs part therein or
Person's whole module achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not the case where making the creative labor
Under, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.