A kind of image file method for down loading, device, electronic equipment and storage medium
Technical field
The present invention relates to field of cloud computer technology, more particularly to a kind of image file method for down loading, device, electronic equipment
And storage medium.
Background technique
Image file is similar with compressed package, and a series of specific files are fabricated to single text according to certain format by it
Part, to facilitate user to download and use, such as operating system, a game etc..The most important feature of image file is can be by
Specific software is identified and can be directly burnt on CD.Image file on ordinary meaning can extend, in image file
It may include more information.For example, system file, guidance file, partition table information etc..
In the prior art, service server sends image download to mirror image server and asks when needing to obtain image file
It asks, mirror image server gets image file after receiving image download request from mirror database, and takes to business
Business device returns to the image file of request downloading.
Currently, a mirror image server needs to handle the image download request from multiple service servers, and not of the same trade or business
Business server may request identical image file, and therefore, in order to improve treatment effeciency, mirror image server can be by mirror image number
Cached according to the image file got in library, so as to receive image download request after, can be quickly from caching
The image file of service server request downloading is found, and is returned.The image file of caching, can be a certain to have returned to
The image file of service server, is also possible to the partial image file cached in advance, which can be mirror image server
Mirror database whole image files, or common partial image file, for example, a fairly large number of mirror image of request downloading
File.Specifically, can be by installing caching middleware on mirror image server, for realizing the place of above-mentioned image downloading request
The caching of reason and image file.
In practical applications, what mirror image server can be parallel requests while handling to multiple image downloads, may
The read operation of image file is carried out between being related in the buffer in part, parallel multiple image files can also be cached,
The write operation of image file is carried out between may relate in the buffer in part.But if the image download of parallel processing is requested
More or parallel buffer image file is more, i.e., for caching middleware, the operation of the concurrent reading and concurrent writing of image file compared with
More, the read-write pressure that may cause caching middleware increases, and the overall performance decline of mirror image server makes mirroring service instead
The overall treatment efficiency of device is lower.
Summary of the invention
Be designed to provide a kind of image file method for down loading, device, electronic equipment and the storage of the embodiment of the present invention are situated between
Matter, to realize the overall treatment efficiency for improving mirror image server.Specific technical solution is as follows:
In a first aspect, it is applied to mirror image server the embodiment of the invention discloses a kind of image file method for down loading, it is described
Method includes:
Receive image file downloading request;
It is corresponding to determine whether the mirror cache region of the mirror image server is cached with the image file downloading request
Image file;
If the mirror cache region of the mirror image server is cached with the image file downloading and requests corresponding mirror image
File obtains the processing quantity of the first image file task of mirror cache region present parallel processing;
Determine whether the processing quantity of the first image file task reaches preset quantity threshold value;
It is slow from the mirror image when the processing quantity of the first image file task is not up to the preset quantity threshold value
It deposits region and reads the corresponding image file of the image file downloading request.
Optionally, the method also includes:
When the processing quantity of the first image file task reaches the preset quantity threshold value, from preset mirror
Corresponding image file is requested as database reads the image file downloading.
Optionally, in the case where whether the mirror cache region of the determination mirror image server is cached with the image file
It carries after requesting corresponding image file, the method also includes:
There is the image file downloading to request corresponding mirror if the mirror cache region of the mirror image server is uncached
As file, the image file downloading is read from preset mirror database and requests corresponding image file;
Obtain the processing quantity of the second image file task of mirror cache region present parallel processing;
Determine whether the processing quantity of the second image file task reaches preset quantity threshold value;
It, will be described from preparatory when the processing quantity of the second image file task is not up to the preset quantity threshold value
The image file downloading that the mirror database of setting is read requests corresponding image file that the mirror cache region is written.
Optionally, the first image file task includes:
Image file for reading image file from the mirror cache region reads task, or, for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The processing quantity of the first image file task mutually should be the mirror of mirror cache region present parallel processing
As the processing quantity of file reading task, or, the image file of mirror cache region present parallel processing reads task
Handle quantity.
Optionally, the second image file task includes:
Image file for reading image file from the mirror cache region reads task, or, for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The processing quantity of the second image file task mutually should be the mirror of mirror cache region present parallel processing
As the processing quantity of file reading task, or, the image file of mirror cache region present parallel processing reads task
Handle quantity.
Optionally, the first image file task includes:
Image file for reading image file from the mirror cache region reads task, and for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The processing quantity of the first image file task for obtaining the processing of mirror cache region present parallel includes:
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity and mirror image text of task
Part be written task processing quantity and be worth, the processing quantity as the first image file task.Optionally, described second
Image file task includes:
Image file for reading image file from the mirror cache region reads task, and for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The processing quantity of the second image file task for obtaining the processing of mirror cache region present parallel includes:
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity and mirror image text of task
Part be written task processing quantity and be worth, the processing quantity as the second image file task.
Second aspect, the embodiment of the invention also discloses a kind of image file download apparatus, are applied to mirror image server, institute
Stating device includes:
Receiving module, for receiving image file downloading request;
Determining module, for determining whether the mirror cache region of the mirror image server is cached under the image file
It carries and requests corresponding image file;
Task quantity obtains module, if the mirror cache region for the mirror image server is cached with the mirror image text
Corresponding image file is requested in part downloading, obtains the first image file task of mirror cache region present parallel processing
Handle quantity;
Threshold value judgment module, for determining whether the processing quantity of the first image file task reaches preset quantity threshold
Value;
First processing module is not up to the preset quantity threshold for the processing quantity when the first image file task
When value, the image file downloading is read from the mirror cache region and requests corresponding image file.
Optionally, described device further include:
Second processing module reaches the preset quantity threshold value for the processing quantity when the first image file task
When, the image file downloading, which is read, from preset mirror database requests corresponding image file.
Optionally, described device further include:
Third processing module, if mirror cache region for the mirror image server is uncached the image file
Corresponding image file is requested in downloading, is read the image file downloading from preset mirror database and is requested corresponding mirror
As file;
Second task quantity obtains module, for obtaining the second mirror image text of mirror cache region present parallel processing
The processing quantity of part task;
Second threshold judgment module, for determining whether the processing quantity of the second image file task reaches present count
Measure threshold value;
Fourth processing module is not up to the preset quantity threshold for the processing quantity when the second image file task
When value, corresponding image file is requested to be written the image file downloading read from preset mirror database
The mirror cache region.
Optionally, the first image file task includes: for reading image file from the mirror cache region
Image file reads task, or, task is written in the image file for image file to be cached to the mirror cache region;
The processing quantity of the first image file task mutually should be the mirror of mirror cache region present parallel processing
As the processing quantity of file reading task, or, the image file of mirror cache region present parallel processing reads task
Handle quantity.
Optionally, the second image file task includes: for reading image file from the mirror cache region
Image file reads task, or, task is written in the image file for image file to be cached to the mirror cache region;
The processing quantity of the second image file task mutually should be the mirror of mirror cache region present parallel processing
As the processing quantity of file reading task, or, the image file of mirror cache region present parallel processing reads task
Handle quantity.
Optionally, the first image file task includes:
Image file for reading image file from the mirror cache region reads task, and for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The task quantity obtains module
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity and mirror image text of task
Part be written task processing quantity and be worth, the processing quantity as the first image file task.
Optionally, the second image file task includes:
Image file for reading image file from the mirror cache region reads task, and for mirror image is literary
Part is cached to the image file write-in task in the mirror cache region;
The second task quantity obtains module
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity and mirror image text of task
Part be written task processing quantity and be worth, the processing quantity as the second image file task.
The third aspect, the embodiment of the invention also discloses a kind of electronic equipment, including processor, communication interface, memory
And communication bus, wherein the processor, the communication interface, the memory are completed mutual by the communication bus
Communication;
The memory, for storing computer program;
The processor when for executing the program stored on the memory, realizes above-mentioned image document down loading method
In any method and step.
Fourth aspect, it is described computer-readable to deposit the embodiment of the invention also discloses a kind of computer readable storage medium
It is stored with computer program in storage media, when the computer program is executed by processor, realizes above-mentioned image file download side
Any method and step in method.
In a kind of image file method for down loading provided in an embodiment of the present invention, device, electronic equipment and storage medium, pass through
After mirror image server receives image file downloading request, search whether to delay in the mirror cache region of mirror image server first
There is image file downloading to request corresponding image file, downloading request is corresponding if mirror cache region is cached with image file
When image file, the processing quantity of the first image file task of mirror cache region present parallel processing is obtained, by mirror
As buffer zone setting preset quantity threshold value, determination judges whether the processing quantity of current first image file task reaches default
Amount threshold is read when the processing quantity of the first image file task is not up to preset quantity threshold value from mirror cache region
Corresponding image file is requested in image file downloading.Appointed in the embodiment of the present invention by the way that image file is arranged for mirror cache region
It is engaged in threshold value, ensure that in the task amount of the image file task in mirror cache region in threshold value situation below to image file
The read-write for carrying out mirror cache region effectively avoids the occurrence of the big situation of buffer zone read-write pressure, and then improves mirroring service
The overall treatment efficiency of device.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of image file processing system architecture diagram of the embodiment of the present invention;
Fig. 2 is a kind of image file method for down loading flow chart of the embodiment of the present invention;
Fig. 3 is a kind of image file method for down loading flow chart of the embodiment of the present invention;
Fig. 4 is a kind of image file method for down loading flow chart of the embodiment of the present invention;
Fig. 5 is a kind of image file method for down loading flow chart of the embodiment of the present invention;
Fig. 6 is a kind of image file download apparatus structural schematic diagram of the embodiment of the present invention;
Fig. 7 is a kind of electronic equipment structural schematic diagram of the embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In the prior art, service server or ustomer premises access equipment are sent out when needing to obtain image file to mirror image server
Image download is sent to request, mirror image server returns to request downloading after receiving image download request, to service server
Image file.In practical applications, mirror image server can read image file and be sent from pre-set mirror database
To service server or ustomer premises access equipment, and caching middleware, i.e. buffer zone, mirror image server can be set in mirror image server
It can will be buffered in buffer zone from the image file read in mirror database, in the case where receiving same image file
When carrying request, the image file directly is read from buffer zone.But mirror image server can be parallel to multiple image downloads
Request is handled simultaneously, multiple image files of caching that can also be parallel, and therefore, the same period is parallel to buffer zone reading
Write operation is very more, and the read-write pressure that may cause caching middleware increases, and the overall performance decline of mirror image server makes instead
The overall treatment efficiency for obtaining mirror image server is lower.
In order to solve the above technical problems, default mirror image is arranged by the buffer zone to mirror image server in the embodiment of the present invention
The amount threshold of file task is somebody's turn to do so that the image file task quantity of the buffer zone concurrent processing of mirror image server is no more than
Preset quantity threshold value ensure that in the task amount of the image file task in mirror cache region in threshold value situation below to mirror
As the read-write in file progress mirror cache region, the big situation of buffer zone read-write pressure is effectively avoided the occurrence of, and then realizes and mentions
The overall treatment efficiency of high mirror image server.
The framework of the image file method for down loading of the embodiment of the present invention can be found in Fig. 1.Fig. 1 is one kind of the embodiment of the present invention
Image file processing system architecture diagram, the system architecture of the image file include multiple service servers 101, mirror image server
102, the mirror cache region 1021 (for example, caching middleware, cache database) in the mirror image server 102 is set, with
And mirror database 103.Mirror image server 102, can after receiving the image file downloading request of the transmission of service server 101
Image file corresponding with image file downloading request directly is obtained in mirror cache region 1021, when the mirror cache region
1021 with the image file download request corresponding image file when, the mirror image server 102 is in preset mirror image
Database 103 obtains image file corresponding with image file downloading request.The mirror cache region 1021 can cache mirror image
The image file that the more image file of access times or service server 101 itself generate in database 103.The present invention is implemented
Preset quantity threshold value is arranged according to buffer zone 1021 of the system architecture to mirror image server in example, and then generates the present invention and implement
A kind of image file method for down loading of example, specific as follows:
In a first aspect, the embodiment of the invention discloses a kind of image file method for down loading, as shown in Figure 2.Fig. 2 is the present invention
A kind of image file method for down loading flow chart of embodiment is applied to mirror image server, which comprises
S201 receives image file downloading request.
The mirror image server of the embodiment of the present invention can be " the plainly-packed case " or NAS of special memory image file specially
(network attached storage, network attached storage) equipment.In this step, mirror image server is received to be taken from business
The image file of business device or ustomer premises access equipment downloads request.
S202, determines whether the mirror cache region of mirror image server is cached with image file downloading and requests corresponding mirror image
File;
In this step, after mirror image server receives image file downloading request, looked into mirror cache region first
Whether look for has image file corresponding with image file downloading request.For example, passing through the number of parsing image file downloading request
According to packet, the image file title for including in the data packet or image file mark are obtained, searching in mirror cache region is
It is no to have and the image file title or the consistent image file of image file mark.
S203, if the mirror cache region of mirror image server is cached with image file downloading and requests corresponding mirror image text
Part obtains the processing quantity of the first image file task of mirror cache region present parallel processing.
In step, it can be obtained parallel in the current time mirror image server buffer zone by way of mathematical statistics
The processing quantity of first image file task of processing.Alternatively, being detected in the mirror image server buffer zone by detection program
The processing quantity of first image file task of parallel processing.
Specifically, it can count in the current time mirror image server buffer zone by way of mathematical statistics and read mirror
As the image file of file reads the processing quantity of task;Statistics current time is cached to the image file write-in of the buffer zone
The processing quantity of task.Alternatively, detection current time reads mirror image from the mirror image server buffer zone by detection program
The image file of file reads the processing quantity of task;The image file write-in that detection current time is cached to the buffer zone is appointed
The processing quantity of business.Wherein, image file reads task are as follows: according to the request that service server or ustomer premises access equipment are sent,
Image file corresponding with the request is read from the buffer zone, and the image file is downloaded to the mistake of corresponding service server
Journey.Task is written in image file;Image file task is written are as follows: by mirror image common in the mirror database of the mirror image server
The buffer zone of the mirror image server is written in file, either deposits the newly-built image file of service server or ustomer premises access equipment
Storage is in the cache server.
Optionally, the first image file task includes: in above-mentioned S203
Image file for reading image file from mirror cache region reads task, and for delaying image file
It is stored to the image file write-in task in mirror cache region;
The processing quantity of the first image file task of mirror cache region present parallel processing is obtained in S203, comprising:
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity of task and image file is write
Enter the processing quantity of task and value, the processing quantity as the first image file task.
S204, determines whether the processing quantity of the first image file task reaches preset quantity threshold value.
In the present invention is implemented, preset quantity threshold value can be set to the buffer zone of mirror image server.As, pass through analysis
Historical data obtains corresponding task processing data when the buffer zone parallel processing task best performance of the mirror image server,
The quantity is determined as to the preset quantity threshold value of the buffer zone of the mirror image server of the embodiment of the present invention.
In this step, the buffer zone parallel processing image file task quantity threshold decision of settable mirror image server
Program, as by the quantity of the determining program real-time judge current time buffer zone parallel processing image file task and in advance
If the size relation of amount threshold, determine whether current time processing quantity reaches preset quantity threshold value.
Optionally, the first image file task includes: in above-mentioned S203
Image file for reading image file from mirror cache region reads task, or, for delaying image file
It is stored to the image file write-in task in mirror cache region;
The processing quantity of the first image file task mutually should be the mirror image of mirror cache region present parallel processing in S204
File reads the processing quantity of task, or, the image file of mirror cache region present parallel processing reads the processing number of task
Amount.
S205, when the processing quantity of the first image file task is not up to preset quantity threshold value, from mirror cache region
It reads image file downloading and requests corresponding image file.
In this step, when the processing quantity of the first image file task is not up to preset quantity threshold value, from mirror cache
Region reads image file downloading and requests corresponding image file, and the image file of reading is sent to corresponding service server
Or ustomer premises access equipment.
Optionally, method further include:
When the processing quantity of the first image file task reaches preset quantity threshold value, from preset mirror database
It reads image file downloading and requests corresponding image file.
In a kind of image file method for down loading of the invention, image file downloading request is received by mirror image server
Afterwards, searching whether to delay in the mirror cache region of mirror image server first has image file downloading to request corresponding mirror image text
Part obtains mirror cache region and works as if mirror cache region is cached with image file downloading request corresponding image file
The processing quantity of first image file task of preceding parallel processing, by the way that preset quantity threshold value is arranged to mirror cache region, really
Surely judge whether the processing quantity of current first image file task reaches preset quantity threshold value, when the first image file task
When processing quantity is not up to preset quantity threshold value, image file downloading is read from mirror cache region and requests corresponding mirror image text
Part.By the way that image file task threshold is arranged for mirror cache region in the embodiment of the present invention, ensure that in mirror cache region
The image file task threshold of threshold value effectively avoids the occurrence of caching hereinafter, carry out the read-write in mirror cache region to image file
The big situation of pressure is read and write in region, and then improves the overall treatment efficiency of the mirror image server of mirror image server.
Optionally, in a kind of embodiment of image file method for down loading of the invention, mirroring service is determined in S202
It, can be just like side shown in Fig. 3 after whether the mirror cache region of device is cached with the corresponding image file of image file downloading request
Method flow chart, method further include:
S301 has image file downloading to request corresponding mirror image text if the mirror cache region of mirror image server is uncached
Part reads image file downloading from preset mirror database and requests corresponding image file.
The mirror database of the embodiment of the present invention is the permanent data base of mirror image server, is saved in the database all
Image file.There is image file downloading to request corresponding image file when the mirror cache region in mirror image server is uncached
When, image file downloading, which is read, from the mirror database requests corresponding image file.
S302 obtains the processing quantity of the second image file task of mirror cache region present parallel processing.
Optionally, the second image file task includes: in S302
Image file for reading image file from mirror cache region reads task, and for delaying image file
It is stored to the image file write-in task in mirror cache region;
The processing quantity of the second image file task of mirror cache region present parallel processing, packet are obtained in above-mentioned S302
It includes:
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity of task and image file is write
Enter the processing quantity of task and value, the processing quantity as the second image file task.
S303, determines whether the processing quantity of the second image file task reaches preset quantity threshold value.
S304 will be from preset when the processing quantity of the second image file task is not up to preset quantity threshold value
The image file downloading that mirror database is read requests corresponding image file that mirror cache region is written.
In the embodiment of the present invention, if there is no image files corresponding with image file downloading request in mirror image server
When, image file is obtained from the mirror database of the setting of mirror image server itself, and judge current time mirror cache area
The image file can be written to mirror image if not being not up to preset quantity threshold value by the file task amount of the parallel processing in domain
Buffer zone, realization the image file in mirror database is cached in mirror cache region, just with subsequent use.
In a kind of embodiment of image file method for down loading of the invention, can also there be the image file method for down loading of Fig. 4
Flow chart, comprising:
S401 obtains the buffer zone for being directed to mirror image server, the processing number of the image file task of present parallel processing
Amount, image file task is handling about image file for task.
S402, determines whether processing quantity reaches preset quantity threshold value.
In the present invention is implemented, the amount threshold that task handles quantity can be set to the buffer zone of mirror image server.?
In this step, the buffer zone parallel processing image file task quantity threshold decision program of settable mirror image server, judgement
The quantity of current time buffer zone parallel processing image file task and the size relation of preset quantity threshold value, when determining current
Between processing quantity whether reach preset quantity threshold value.
S403, when processing quantity is not up to preset quantity threshold value, for image file task to be processed, starting is treated
The parallel processing of the image file task of processing.
When above-mentioned judgement current time processing quantity is not up to the preset quantity threshold value, parallel processing task quantity can be started
Each image file task to be processed corresponding no more than the volume residual of the preset quantity threshold value, so that each to be processed
Image file task is respectively processed.For example, the volume residual for starting the preset quantity threshold value is corresponding from the buffer zone
Read image file each image file read task, or start the preset quantity threshold value volume residual it is corresponding by mirror image
Task is written in each image file of file cache to buffer zone;Or start the preset quantity threshold value volume residual it is corresponding
Each image file for reading image file from the buffer zone reads task, and image file is cached to the buffer zone
Task is written in image file.
S404, for image file task to be processed, stops starting pair when processing quantity reaches preset quantity threshold value
The parallel processing of image file task to be processed.
When above-mentioned judgement current time processing quantity reaches the preset quantity threshold value, stop starting to mirror image text to be processed
The parallel processing of part task.After the buffer zone of the mirror image server has handled part image file task to be processed,
Starting is no more than the corresponding each image file task to be processed of volume residual of the preset quantity threshold value.
Preset quantity threshold value is arranged by the processing quantity to mirror image server in the embodiment of the present invention, and then ensure that caching
The quantity of region parallel processing image file task, so that being optimal of overall performance of mirror image server, is finally reached and mentions
The purpose of the overall treatment efficiency of high mirror image server.
In a kind of embodiment of image file method for down loading of the invention, reference can be made to a kind of image file shown in fig. 5
Method for down loading flow chart.Image file task includes: that image file task includes:
Image file for reading image file from buffer zone reads task, and for image file to be cached to
Task is written in the image file of buffer zone;
Obtain the buffer zone for being directed to mirror image server, the processing quantity of the image file task of present parallel processing, packet
It includes:
S501, obtains the buffer zone for being directed to mirror image server, and the image file of present parallel processing reads the reading of task
Take processing quantity and image file that the write-in processing quantity of task is written.
In the present invention is implemented, current time can be counted from the mirror image server buffer area by way of mathematical statistics
The image file that image file is read in domain reads the processing quantity of task;Statistics current time is cached to the mirror of the buffer zone
As file write-in task processing quantity, obtain processing quantity and value.Alternatively, by detection program, detection current time from
The image file that image file is read in the mirror image server buffer zone reads the processing quantity of task;It is slow to detect current time
Be stored to the buffer zone image file write-in task processing quantity, obtain processing quantity and value.Alternatively, directly statistics is worked as
Total processing quantity of the image file task of parallel processing in the mirror image server buffer zone of preceding time.
Determine whether processing quantity reaches preset quantity threshold value, comprising:
S502, determines whether reading process quantity reaches default and read amount threshold, and whether write-in processing quantity reaches
To default write-in amount threshold.
For example, the default amount threshold that reads of setting is 50, judge that current time is read from the mirror image server buffer zone
Whether the processing quantity for taking the image file of image file to read task reaches 50;The default write-in amount threshold of setting is 30, is sentenced
The processing quantity that disconnected current time reads the image file reading task of image file from the mirror image server buffer zone is
It is no to reach 30.
When processing quantity is not up to preset quantity threshold value, for image file task to be processed, start to be processed
Image file task parallel processing, comprising:
S503, when reading process quantity not up to default reading amount threshold, for reading image file to be processed
Task starts the parallel processing to reading image file task to be processed.
It is above-mentioned judge reading process quantity do not reach it is default read amount threshold when, start this and default read quantity threshold
It is worth remaining reading image file task to be processed, and parallel processing is carried out to each reading image file task to be processed.
For example, the default amount threshold that reads of setting is 50, current time reads mirror from the mirror image server buffer zone
It is 30 as the image file of file reads the processing quantity of task, then it currently at most can be to 20 reading image files to be processed
Task carries out parallel processing.
S504, when not up to preset quantity threshold value is written in write-in processing quantity, for write-in image file to be processed
Task starts the parallel processing to write-in image file task to be processed.
For example, setting write-in preset quantity threshold value is 30, mirror is written from the mirror image server buffer zone in current time
It is 25 as the processing quantity of task is written in the image file of file, then it currently at most can be to 5 write-in image files to be processed
Task carries out parallel processing.
When processing quantity reaches preset quantity threshold value, for image file task to be processed, stops starting and treats place
The parallel processing of the image file task of reason, comprising:
S505 appoints when reading process quantity reaches default reading amount threshold for reading image file to be processed
Business stops parallel processing of the starting to reading image file task to be processed.
It is above-mentioned judge reading process quantity reach it is default read amount threshold when, illustrate currently read reading mirror again
As file, and then stop starting all reading image file tasks to be processed.Until the reading image file handled
After the completion of the partial task processing of task, the reading image file task of respective numbers is reprocessed.
S506 appoints when write-in processing quantity reaches default write-in amount threshold for write-in image file to be processed
Business stops parallel processing of the starting to write-in image file task to be processed.
It is above-mentioned when judgement is written processing quantity and reaches default write-in amount threshold, illustrate mirror image can not currently be written again literary
Part task, and then stop the pending write-in image file task of starting institute.Until the write-in image file handled is appointed
After the completion of the partial task processing of business, the write-in image file task of respective numbers is reprocessed.
In the embodiment of the present invention, by the way that default reading amount threshold is arranged to reading process quantity and handles number to write-in
The default write-in amount threshold of amount setting, and then judge to read image file task respectively and the concurrent of image file task is written
Disposition realizes control respectively and reads image file task amount and write-in image file task amount, mentions to realize
The whole efficiency of high mirror image server read-write.
Optionally, in a kind of embodiment of image file method for down loading of the invention, mirror image server is directed to obtaining
Buffer zone, present parallel processing image file task processing quantity before, further includes:
Step 1, monitoring quantity obtain whether the period reaches, and when monitoring the arrival of quantity acquisition period, triggering is executed and obtained
The buffer zone for mirror image server is taken, the step of the processing quantity of the image file task of present parallel processing;And/or
Step 2 monitors whether to generate image file task to be processed, generates image file to be processed when monitoring
When task, triggering executes the buffer zone for obtaining and being directed to mirror image server, the processing of the image file task of present parallel processing
The step of quantity.
In the embodiment of the present invention, monitor whether current time reaches in real time by the monitoring programme that setting quantity obtains the period
Preset quantity obtains the period, and then ensure that and periodically obtain the place that starting obtains the image file task of buffer zone parallel processing
Manage quantity.In addition, whether generate the program of image file task to be processed by setting, ensure that when monitoring current in real time
Between whether pending image file task needs to be implemented.
Optionally, in a kind of embodiment of image file method for down loading of the invention, image file reads task are as follows:
After the image file downloading request for receiving service server transmission, read from buffer zone for image file downloading request
The task of image file;
Image file be written task are as follows: for the first time from the mirror database of mirror image server obtain image file after, will be first
The task of the image file write-in buffer zone of secondary acquisition;Alternatively, after the image file for receiving service server transmission,
By the task of received image file write-in buffer zone.
In the present invention is implemented, after the image file downloading request for receiving service server transmission, the buffer area
There is no image file downloadings to request corresponding image file in domain, and then the buffer zone can be to the mirror image number of the mirror image server
It sends and requests according to library.Mirror image text corresponding with the request is searched in the mirror database of the mirror image server by the request
Part, so that the image file is sent to corresponding service server by the mirror database by the mirror image server.
Judge whether the processing quantity of the image file task of current cache region parallel processing reaches threshold value, if not reaching
To threshold value, then the image file is stored in the buffer zone of the mirror image server.
In addition, in the absence of the image file of service server request is in the mirror database of the mirror image server,
The service server can voluntarily create image file, and then send and request to the buffer zone of the mirror image server, the buffer area
After domain is requested, judge whether the processing quantity of the image file task of current cache region parallel processing reaches threshold value, if
Do not reach threshold value, then the image file is stored in the buffer zone of the mirror image server.
Through the embodiment of the present invention, it can be achieved that the image file obtained in mirror database is written to appointing for buffer zone
Business, or the image file of received service server is written to buffer zone.
Second aspect, the embodiment of the invention also discloses a kind of image file download apparatus, as shown in Figure 6.Fig. 6 is this hair
A kind of image file download apparatus structural schematic diagram of bright embodiment, is applied to mirror image server, and device includes:
Receiving module 601, for receiving image file downloading request;
Determining module 602 is asked for determining whether the mirror cache region of mirror image server is cached with image file downloading
Seek corresponding image file;
Task quantity obtains module 603, if the mirror cache region for mirror image server is cached under image file
It carries and requests corresponding image file, obtain the processing number of the first image file task of mirror cache region present parallel processing
Amount;
Threshold value judgment module 604, for determining whether the processing quantity of the first image file task reaches preset quantity threshold
Value;
First processing module 605, for when the processing quantity of the first image file task is not up to preset quantity threshold value,
Image file downloading, which is read, from mirror cache region requests corresponding image file.
In a kind of image file download apparatus provided in an embodiment of the present invention, mirror image text is received by mirror image server
After part downloading request, searching whether to delay first in the mirror cache region of mirror image server has image file downloading request to correspond to
Image file it is slow to obtain mirror image if mirror cache region is cached with image file downloading when requesting corresponding image file
The processing quantity for depositing the first image file task of region present parallel processing, by the way that preset quantity is arranged to mirror cache region
Threshold value, determination judge whether the processing quantity of current first image file task reaches preset quantity threshold value, when the first mirror image text
When the processing quantity of part task is not up to preset quantity threshold value, it is corresponding that image file downloading request is read from mirror cache region
Image file.By the way that image file task threshold is arranged for mirror cache region in the embodiment of the present invention, ensure that slow in mirror image
The image file task threshold of region threshold is deposited hereinafter, carrying out the read-write in mirror cache region to image file, is effectively avoided out
The big situation of existing buffer zone read-write pressure, and then improve the overall treatment efficiency of the mirror image server of mirror image server.
Optionally, in a kind of embodiment of image file download apparatus of the invention, device further include: second processing mould
Block, for when the processing quantity of the first image file task reaches preset quantity threshold value, from preset mirror database
It reads image file downloading and requests corresponding image file.
Optionally, device further include:
Third processing module, if mirror cache region for mirror image server is uncached image file downloading request
Corresponding image file reads image file downloading from preset mirror database and requests corresponding image file;
Second task quantity obtains module, and the second image file for obtaining the processing of mirror cache region present parallel is appointed
The processing quantity of business;
Second threshold judgment module, for determining whether the processing quantity of the second image file task reaches preset quantity threshold
Value;
Fourth processing module, for inciting somebody to action when the processing quantity of the second image file task is not up to preset quantity threshold value
The image file downloading read from preset mirror database requests corresponding image file that mirror cache region is written.
Optionally, the first image file task includes: the image file for reading image file from mirror cache region
Reading task, or, task is written in the image file for image file to be cached to mirror cache region;
The image file that the processing quantity of first image file task mutually should be the processing of mirror cache region present parallel is read
The processing quantity of task is taken, or, the image file of mirror cache region present parallel processing reads the processing quantity of task.
Optionally, the second image file task includes: the image file for reading image file from mirror cache region
Reading task, or, task is written in the image file for image file to be cached to mirror cache region;
The image file that the processing quantity of second image file task mutually should be the processing of mirror cache region present parallel is read
The processing quantity of task is taken, or, the image file of mirror cache region present parallel processing reads the processing quantity of task.
Optionally, the first image file task includes:
Image file for reading image file from mirror cache region reads task, and for delaying image file
It is stored to the image file write-in task in mirror cache region;
Task quantity obtains module
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity of task and image file is write
Enter the processing quantity of task and value, the processing quantity as the first image file task.
Optionally, the second image file task includes:
Image file for reading image file from mirror cache region reads task, and for delaying image file
It is stored to the image file write-in task in mirror cache region;
Second task quantity obtains module
The image file for obtaining the processing of mirror cache region present parallel reads the processing quantity of task and image file is write
Enter the processing quantity of task and value, the processing quantity as the second image file task.The third aspect, the embodiment of the present invention is also
A kind of electronic equipment is disclosed, as shown in Figure 7.Fig. 7 is a kind of electronic equipment structural schematic diagram of the embodiment of the present invention, including place
Manage device 701, communication interface 702, memory 703 and communication bus 704, wherein processor 701, communication interface 702, memory
703 complete mutual communication by communication bus 704;
Memory 703, for storing computer program;
Processor 701 when for executing the program stored on memory 703, realizes following methods step:
Receive image file downloading request;
Determine whether the mirror cache region of mirror image server is cached with image file downloading and requests corresponding image file;
If the mirror cache region of mirror image server is cached with image file, corresponding image file is requested in downloading, is obtained
The processing quantity of first image file task of mirror cache region present parallel processing;
Determine whether the processing quantity of the first image file task reaches preset quantity threshold value;
When the processing quantity of the first image file task is not up to preset quantity threshold value, mirror is read from mirror cache region
As the corresponding image file of file download request.
The communication bus 704 that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral
Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus 704 can be divided into address bus, data/address bus, control bus etc..For
Convenient for indicating, only indicated with a thick line in figure, it is not intended that an only bus or a type of bus.
Communication interface 702 is for the communication between above-mentioned electronic equipment and other equipment.
Memory 703 may include random access memory (Random Access Memory, RAM), also may include
Nonvolatile memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory
703 can also be that at least one is located remotely from the storage device of aforementioned processor 601.
Above-mentioned processor 701 can be general processor, including central processing unit (Central Processing
Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital
Signal Processing, DSP), specific integrated circuit (Application Specific Integrated Circuit,
ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic
Device, discrete gate or transistor logic, discrete hardware components.
In a kind of electronic equipment provided in an embodiment of the present invention, image file downloading is received by mirror image server and is asked
After asking, searching whether to delay first in the mirror cache region of mirror image server has image file downloading to request corresponding mirror image text
Part obtains mirror cache region and works as if mirror cache region is cached with image file downloading request corresponding image file
The processing quantity of first image file task of preceding parallel processing, by the way that preset quantity threshold value is arranged to mirror cache region, really
Surely judge whether the processing quantity of current first image file task reaches preset quantity threshold value, when the first image file task
When processing quantity is not up to preset quantity threshold value, image file downloading is read from mirror cache region and requests corresponding mirror image text
Part.By the way that image file task threshold is arranged for mirror cache region in the embodiment of the present invention, ensure that in mirror cache region
The image file task threshold of threshold value effectively avoids the occurrence of caching hereinafter, carry out the read-write in mirror cache region to image file
The big situation of pressure is read and write in region, and then improves the overall treatment efficiency of the mirror image server of mirror image server.
Fourth aspect, the embodiment of the invention also discloses a kind of computer readable storage medium, computer-readable storage mediums
It is stored with computer program in matter, when computer program is executed by processor, realizes following methods step:
In a kind of storage medium provided in an embodiment of the present invention, image file downloading request is received by mirror image server
Afterwards, searching whether to delay in the mirror cache region of mirror image server first has image file downloading to request corresponding mirror image text
Part obtains mirror cache region and works as if mirror cache region is cached with image file downloading request corresponding image file
The processing quantity of first image file task of preceding parallel processing, by the way that preset quantity threshold value is arranged to mirror cache region, really
Surely judge whether the processing quantity of current first image file task reaches preset quantity threshold value, when the first image file task
When processing quantity is not up to preset quantity threshold value, image file downloading is read from mirror cache region and requests corresponding mirror image text
Part.By the way that image file task threshold is arranged for mirror cache region in the embodiment of the present invention, ensure that in mirror cache region
The image file task threshold of threshold value effectively avoids the occurrence of caching hereinafter, carry out the read-write in mirror cache region to image file
The big situation of pressure is read and write in region, and then improves the overall treatment efficiency of the mirror image server of mirror image server.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including element.
Each embodiment in this specification is all made of relevant mode and describes, 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 system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The above is merely preferred embodiments of the present invention, it is not intended to limit the scope of the present invention.It is all in this hair
Any modification, equivalent replacement, improvement and so within bright spirit and principle, are included within the scope of protection of the present invention.