[go: up one dir, main page]

CN106383851A - Multimedia playing concurrent connection number optimization method, apparatus and system - Google Patents

Multimedia playing concurrent connection number optimization method, apparatus and system Download PDF

Info

Publication number
CN106383851A
CN106383851A CN201610786277.0A CN201610786277A CN106383851A CN 106383851 A CN106383851 A CN 106383851A CN 201610786277 A CN201610786277 A CN 201610786277A CN 106383851 A CN106383851 A CN 106383851A
Authority
CN
China
Prior art keywords
multimedia
hard disk
connection number
concurrent connection
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610786277.0A
Other languages
Chinese (zh)
Inventor
李靖禹
林仁文
林少坤
林鎏娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Star Net eVideo Information Systems Co Ltd
Original Assignee
Fujian Star Net eVideo Information Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Star Net eVideo Information Systems Co Ltd filed Critical Fujian Star Net eVideo Information Systems Co Ltd
Priority to CN201610786277.0A priority Critical patent/CN106383851A/en
Publication of CN106383851A publication Critical patent/CN106383851A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • G06F16/43Querying
    • G06F16/438Presentation of query results
    • G06F16/4387Presentation of query results by the use of playlists
    • G06F16/4393Multimedia presentations, e.g. slide shows, multimedia albums

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention proposes a multimedia playing concurrent connection number optimization method, apparatus and system. The method is applied to a multimedia playing server. The method comprises the steps of receiving a multimedia playing request; and in response to the multimedia playing request, reading a hard disk by a one-time data reading volume greater than 512 kilobytes. According to the method, the apparatus and the system provided by embodiments of the invention, a multimedia playing concurrent connection number can be increased.

Description

A kind of multimedia concurrent connection number optimization method, device and system
Technical field
The invention belongs to multimedia play technology field, particularly a kind of multimedia concurrent connection number optimization method, Device and system.
Background technology
Multimedia service device system, refer to set up in a local network, comprise multimedia server and height is checked Broadcast the multimedia system of machine, be usually used in Internet bar, shadow, the LAN field such as KTV (KTV), to meet LAN cohesion Collection crowd is for the demand of multimedia-on-demand aspect.Multimedia generally comprises the audio-visual resources such as film, song.Traditional LAN Multimedia resource, particularly film film source, video code rate is low and image quality poor (as 480p or 720p), is not suitable for giant-screen or projection Play.If it is desire to obtaining preferably viewing impression, needing higher video image quality (as 1080p), being so accomplished by higher Video code rate (such as, more than 10Mbps).However, higher video code rate is it is meant that the reading speed requirement to hard disk is higher, Thus multimedia service device is put forward higher requirement.
Because high-definition movie film source code check is high and file is big, not high using solid state hard disc (SSD) cost performance, generally use machine Tool hard disk is storing.However, mechanical hard disk has that continuous reading performance height, random read take performance are low.For example, machinery is hard The continuous reading performance of disk can reach 80~200MB/s, but carries out multimedia using prior art, its reading performance But only close to 30MB/s, for the multimedia of code check 10Mbps, the concurrent connection number of server only has 24.
In recent years, the sector alignment mode of hard disk is transitioned into 4096 bytes (4K) alignment from 512 byte-aligned.But Software systems due to historical reasons, the buffering area reading hard disk still by the way of 512 byte-aligned, for part hard disk, There is a problem of that reading efficiency is not high.
Therefore, in actual applications, need the hard disk reading performance of multimedia service device to be optimized, thus carrying The concurrency performance of high server.
Content of the invention
Embodiment of the present invention proposes a kind of multimedia concurrent connection number optimization method, device and system, thus carrying High concurrent performance.
The technical scheme of embodiment of the present invention is as follows:
A kind of multimedia concurrent connection number optimization method, the method is applied to multimedia service device, the method Including:
Receive multimedia request;
In response to the request of described multimedia, data volume is read with the single more than 512 kilobytes and reads hard disk.
In one embodiment, before in response to the request of described multimedia, the method also includes:
Calculate the concurrent connection number of described multimedia request, when the concurrent connection number of described multimedia request surpasses When crossing predetermined concurrent connection number threshold value, exit this flow process;And/or
Calculate described hard disk input/output take load, when described hard disk input/output take load exceed predetermined Load threshold when, exit this flow process.
In one embodiment, the described concurrent connection number calculating multimedia request includes:Calculate for all Total concurrent connection number of multimedia request of hard disk or calculating are concurrent for the multimedia request of each hard disk Connect number;
And/or
The described input/output calculating hard disk takies load and includes:Calculate the central processing unit non-NULL of input/output operations Time.
In one embodiment, described reading hard disk includes:Multiple processes are read in synchronous input/output mode firmly Disk.
In one embodiment, the plurality of process reads hard disk in synchronous input/output mode and includes:Multiple processes Hard disk is read in synchronous input/output mode by internal memory mapping function.
In one embodiment, described reading hard disk includes:One or more processes are read in asynchronous input/output mode Hard disk.
In one embodiment, one or more processes described read hard disk in asynchronous input/output mode and include:
One or more processes send hard disk read requests to operating system nucleus respectively, and align for 4K in appointed buffer;
Operating system nucleus from hard disk read data, copy data to described buffering area, and to described one or more enter Journey sends callback command.
A kind of multimedia concurrent connection number optimizes device, and this device is applied to multimedia service device, this device Including:
Playing request receiving unit, for receiving multimedia request;
Reading unit, in response to the request of described multimedia, reading data volume with the single more than 512 kilobytes Read hard disk.
In one embodiment, this device also includes:
Concurrent connection number computing unit, before asking in response to described multimedia in reading unit, calculates institute State the concurrent connection number of multimedia request, when the concurrent connection number of described multimedia request exceedes predetermined concurrently connecting When connecing several threshold value, go to enable described reading unit;And/or
Take load computing unit, before asking in response to described multimedia in reading unit, calculate described The input/output of hard disk takies load, when the input/output of described hard disk takies load and exceedes predetermined load threshold, goes Enable described reading unit.
In one embodiment, reading unit, for enable multiple processes pass through internal memory mapping function with synchronous input/ The way of output reads hard disk;Or enable one or more processes with asynchronous to operating system nucleus transmission hard disk read requests, and refer to Aliging for 4K in buffer set, enables operating system nucleus and read data from hard disk, copy data to described buffering area, and to institute State one or more processes and send callback command.
A kind of multimedia concurrent connection number optimizes system, including multimedia service device and planter, wherein institute State multimedia service device, with described planter, there is LAN and be connected;
Described planter, for sending multimedia request;
Described multimedia service device, in response to the request of described multimedia, with the list more than 512 kilobytes Secondary reading data volume reads hard disk.
In one embodiment, described multimedia service device, is used for:
Before in response to the request of described multimedia, calculate the concurrent connection number of described multimedia request, when The concurrent connection number of described multimedia request exceedes stopping during predetermined concurrent connection number threshold value;And/or,
Before in response to the request of described multimedia, the input/output calculating described hard disk takies load, when described The input/output of hard disk takies load and exceedes stopping during predetermined load threshold.
In one embodiment, described multimedia service device, maps letter for enabling multiple processes by internal memory Number reads hard disk in synchronous input/output mode;Or enable one or more processes with asynchronous to operating system nucleus transmission hard disk Read requests, and appointed buffer is 4K alignment, enables operating system nucleus and reads data from hard disk, copies data to described Buffering area, and send callback command to one or more processes described.
From technique scheme as can be seen that in embodiments of the present invention, receive multimedia request;In response to many Media play request, reads data volume with the single more than 512 kilobytes and reads hard disk.It is directed to commonly literary composition in compared to existing technology Part reads and reads data volume using the single of 32 to 512 kilobytes, and embodiment of the present invention considers multimedia-on-demand scene Particularity, reads the multimedia file in data volume reading hard disk with the single more than 512 kilobytes, can improve multimedia and broadcast Put concurrent connection number.
And, by the way of the multimedia file that prior art is read in hard disk using the single progress of work in synchronous i/o, There is the process when this process I/O takies higher and be in that ossified state cannot receive new connection in time and individual process cannot Make full use of the defect of hard disk reading performance.Embodiment of the present invention considers the particularity of multimedia-on-demand scene, with multiple The progress of work reads the multimedia file in hard disk, and the I/O reducing each process takies, it is to avoid process is ossified, Ke Yiti The I/O performance of high hard disk, thus improve concurrent connection number further.
In addition, in asynchronous I/O, the buffering area using 512 byte-aligned cannot give full play to hard disk in compared to existing technology The defect of sector 4K alignment performance, embodiment of the present invention considers the particularity of high-definition multimedia program request scene, with 4K byte The buffer mode of alignment reads the multimedia file in hard disk, can lift hard disk performance, thus improve further concurrently connecting Connect number.
Further, when hard disk transships, the peak performance that the reading performance of hard disk can reach less than it, so that Lead to interim card due to the reduction of reading rate in the user broadcasting, calculated by number of concurrent and hard disk I/O load calculates, the present invention Embodiment can avoid affecting, in the user broadcasting, to lift Consumer's Experience.
Brief description
Fig. 1 is the multimedia concurrent connection number optimization method flow chart according to the present invention.
Fig. 2 is the relation schematic diagram of hard disk reading rate and file size for ordinary file.
Fig. 3 is the relation schematic diagram of hard disk reading rate and multimedia file size for multimedia file.
Fig. 4 is that the multimedia concurrent connection number according to the present invention optimizes schematic diagram.
Fig. 5 is the exemplary process flow diagram of the multimedia-on-demand request according to the present invention.
Fig. 6 is that the multimedia concurrent connection number according to the present invention optimizes structure drawing of device.
Fig. 7 is the demonstrative structure figure of the multimedia concurrent connection number optimization system according to the present invention.
Specific embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with the accompanying drawings the present invention is made further Detailed description.
In order to succinct and directly perceived on describing, hereafter by describing some representational embodiments come the side to the present invention Case is illustrated.In embodiment, substantial amounts of details is only used for help and understands the solution of the present invention.However, it will be apparent that the present invention These details can be not limited to when technical scheme is realized.In order to avoid unnecessarily having obscured the solution of the present invention, some are real Mode of applying meticulously is not described, but only gives framework.Hereinafter, " include " referring to " including but not limited to ", " root According to ... " refer to " according at least to ..., but be not limited to according only to ... ".Due to the speech habits of Chinese, hereinafter there is no spy Do not point out a composition quantity when it is meant that it can also be multiple that this composition can be one, or can be regarded as at least one.
In the prior art, the single for the ordinary file of storage in disk reads data volume and is usually 32 to 512 thousand Byte (KB).For ordinary file, it is enough that 32 singles arriving 512KB read data volume.However, because multimedia is Play in real time, for multimedia-on-demand scene, it is far from enough that 32 singles arriving 512KB read data volume.
Citing, reads for ordinary file, if 1-5 second reading per second 1MB, 6-10 second reading per second 2MB, average out to 1.5MB/s.If however, for the multimedia reading speed of 1.5MB/s (i.e. 12Mbps), because of front 5 second datas not Lead to interim card enough.
In embodiments of the present invention, the hard disk reading performance of multimedia service device is optimized, thus improving The concurrency performance of multimedia service device.
Fig. 1 is the multimedia concurrent connection number optimization method flow chart according to the present invention, and the method is applied to many matchmakers Body Play Server.
As shown in figure 1, the method includes:
Step 101:Receive multimedia request.
Step 102:In response to multimedia request, data volume is read with the single more than 512 kilobytes and reads hard disk.
It can be seen that, for the special scenes of multimedia, embodiment of the present invention is passed through to improve the data volume that single reads To reduce hard disk random access number of times, thus improving the performance of hard disk, and improve multimedia concurrent connection number.
Preferably, embodiment of the present invention single read data volume be Mbytes (MB) rank, such as 1MB, 2MB, 4MB, etc..It is furthermore preferred that it is 2MB that the single of embodiment of the present invention reads data volume.
Below in conjunction with the accompanying drawings, illustrate in multimedia scene, data is read with the single more than 512 kilobytes Amount reads the notable beneficial effect that hard disk has.
Fig. 2 is the relation schematic diagram of hard disk reading rate and file size for ordinary file;Fig. 3 is for multimedia The relation schematic diagram of file, hard disk reading rate and multimedia file size.
In fig. 2, using HD Tune Pro software, execution read and write from the ordinary file of 128MB at random 0.5 kilobytes, 1 kilobytes, 2 kilobytes, the performance test of 48 Mbytes of block sizes of kilobytes ..., read data for simulating different singles The lower disk random read-write performance of amount.
From figure 2 it can be seen that in the scene reading ordinary file, read the raising of data volume, disk with single Random read take performance also increases, but after 32KB, lifting effect is not notable.Therefore, 32 are adopted in prior art Single to 512KB reads data volume to read the ordinary file in hard disk.
Fig. 3 is based on lot of experimental data for applicant, plays, for multimedia file, the hard disk reading rate that scene determines Relation schematic diagram with multimedia file size.
From figure 3, it can be seen that in the scene reading multimedia file, it is remote that 32 singles arriving 512KB read data volume Far it is not enough to obtain preferable disk random read take performance.In figure 3, the integrated curved of multimedia actual play test basic with Fig. 2 mates, and the position that simply gradient slows down has been moved to the position near 2MB from 32KB.That is, reading multimedia file Scene in, single read data volume for preferable disk random read take performance can be obtained during 2MB.
With reference to instantiation, illustrate to read what hard disk had to read data volume more than the single of 512 kilobytes Notable beneficial effect.
If multimedia service device needs to process 30 playing request (i.e. concurrent connection number is 30) simultaneously, each please The code check seeking video is 10Mbps, that is, need the data reading 300Mb (i.e. 37.5MB/s) from hard disk per second, and the company of hard disk Continuous reading rate is 80~200MB/s.
In the prior art, if reading the multi-medium data of 32KB every time, need to initiate 37.5*1024/32 to kernel =1200 read requests, due to needing frequently to switch between each file, close to random read take;If reading 512KB every time Multi-medium data, then need to kernel initiate 37.5*1024/512=75 read requests.The random request per second of hard disk (IOPS) computational methods are 1000/ (hard disk average rotation delay+hard disk seeks the time), and for example 7200RPM's (rev/min) is hard The hard disk average rotation of disk postpones as 4.2ms, and the hard disk tracking time is 5.9 to 9.1 milliseconds, corresponding 1000/ (4.2+9.1)< =IOPS<=1000/ (4.2+5.9), even if the random request that can execute for a second is 75 to 100 times it is seen that adopting 512KB Single read, be also very inadequate.
After embodiment of the present invention, it is not the multi-medium datas that 512KB is arrived in each reading 32, but to be more than The single of 512 kilobytes reads data volume and reads hard disk.Such as, if reading the multi-medium data of 2MB every time, then inwardly need Core initiates 37.5/2, that is, approximate 19 read requests, reads close to continuous.
It can be seen that, prior art needs more than 4 to 60 times more than the present invention of kernel requests, and due to each data reading Amount is less, leads to the situation of the cache miss of disk to be obviously improved so that the effective reading capability degradation of hard disk.? In prior art, when every time reading 512KB, the delay of hard disk after hard disk reading rate reaches 30MB/s basically reaches 100%.Adopt After (reading 2MB as each) after embodiment of the present invention, the delay of hard disk declines, and handling capacity significantly improves.
In a word, applicant creatively proposes in multimedia scene, with the single receive data more than 512 kilobytes Reading hard disk according to amount, the hard disk reading performance of multimedia service device being optimized, thus improving multimedia The concurrency performance of server.
In one embodiment, before in a step 102 in response to multimedia request, the method also includes:
Calculate multimedia request concurrent connection number, when multimedia request concurrent connection number exceed predetermined During concurrent connection number threshold value, exit this flow process.That is, when multimedia request concurrent connection number exceed predetermined simultaneously When sending out connection number threshold value, not execution step 102.It is furthermore preferred that concurrent connection number threshold value is 50.
Preferably, the concurrent connection number calculating multimedia request includes:Calculate the multimedia for all hard disks to broadcast Put total concurrent connection number of request or the concurrent connection number calculating the multimedia request for each hard disk.
It can be seen that, embodiment of the present invention can also calculate to the concurrent connection number of Multimedia on demand service, when concurrent When connection number exceeds predetermined threshold value, then refuse Multimedia on demand service, this is that most basic concurrent connection number controls.Further , embodiment of the present invention can also limit to the concurrent connection number of each disk further.When certain disk simultaneously Send out when connecting number and exceeding predetermined threshold value, then refusal is for the data access of this disk.
In one embodiment, before in a step 102 in response to multimedia request, the method also includes:
The input/output (I/O) calculating hard disk takies load, exceedes predetermined load threshold when the I/O of hard disk takies load During value, exit this flow process.That is, the I/O when hard disk) when taking load and exceeding predetermined load threshold, not execution step 102.Specifically, the I/O calculating hard disk takies load inclusion:Calculate the central processing unit non-empty time (% of input/output operations util).
Such as, it is possible to use iostat order monitors the I/O loading condition of hard disk.Show when iostat order runs first Start the every statistical information starting from system, running iostat afterwards will show that running the later statistics of this order from last time believes Breath.When executing iostat-d-k-x1, central processing unit non-empty time (%util) can be obtained, its value is higher, and I/O is described Load takies higher.When the central processing unit non-empty time of certain disk exceedes predetermined load threshold (such as, 8 percent Ten), when, refusal is for the data access of this disk.
Taking specific concurrent connection number threshold value and load threshold as a example elaborate embodiment of the present invention, this area skill above Art personnel, it is to be appreciated that this description is only exemplary, are not intended to limit the present invention the protection domain of embodiment.
Similarly, the above I/O load feelings taking calculate central processing unit non-empty time as a example elaborating how to determine hard disk Condition, it will be appreciated by those of skill in the art that this description is only exemplary, is not intended to limit the present invention embodiment Protection domain.
In one embodiment, read hard disk in step and 102 to include:Multiple processes are read in synchronous i/o mode firmly Disk.Preferably, multiple processes read hard disk in synchronous i/o mode and include:Multiple processes pass through internal memory mapping function (such as MMAP) hard disk is read in synchronous i/o mode.
It can be seen that, embodiment of the present invention also achieves a kind of synchronous i/o optimal way.
Synchronous i/o refers to obstructive type I/O and calls, such as read/fread/mmap etc., and these call and would generally hinder always Plug returns after the data of expectation reading reads completely.
Conventionally, as the list that event driven HTTP server (including NGINX, lighttpd) is usually used The model of thread, when I/O obstruction takies too high, process will be in ossified state, lead to hard disk I/O utilization rate not high.
In view of synchronous i/o has I/O obstruction leads to the ossified defect of process, embodiment of the present invention is entered using multiple work The mode of journey (worker) come to avoid the I/O of a hard disk using height lead to whole HTTP service process ossified (even if another Hard disk I/O take very low) defect.And, multiple progresses of work can lift the performance of I/O simultaneously.
Citing, is read with 4K QD 1 tunnel of the prior art and contrast is read on the 4K QD32 road of embodiment of the present invention, It is assumed that it is 4KB that every road single reads data volume, the present invention is called by the system of mmap () function, can improve hard further The I/O performance of disk, lifts about 20%.
In one embodiment, read hard disk in step 102 to include:One or more processes are read in asynchronous I/O mode Hard disk.Preferably, one or more processes read hard disk in asynchronous I/O mode and include:One or more processes are respectively to operating system Kernel sends hard disk read requests, and aligns for 4K in appointed buffer;Operating system nucleus reads data from hard disk, and data is multiple Make buffering area, and send callback command to one or more processes.
It can be seen that, embodiment of the present invention also achieves a kind of asynchronous I/O optimal way.
Linux supports asynchronous I/O after kernel version 2.6.22.Because the asynchronous I/O of Linux needs simultaneously using straight-through I/O(Direct I/O).In Direct I/O, when a demand for system file carries out I/O operation, bypass the literary composition of system Part Write post area and read buffer area are directly written and read.Due to needing Direct I/O, comparing that synchronous i/o has can for asynchronous I/O With avoid I/O block advantage, from without using the mode of multiple progresses of work avoid I/O block.However, asynchronous I/ The shortcoming of O is the video for same portion, and synchronous i/o is possible to enter row cache using system thus mitigating hard disk pressure, And asynchronous I/O is then read out from disk completely.
It is intended that buffering area is 512 alignment in the asynchronous I/O of prior art.In view of embodiment of the present invention towards Be Internet bar, shadow, the multimedia-on-demand scene in the place such as KTV, its total concurrency is not very high, and embodiment of the present invention is using slow Rush area 4K alignment optimization permissible to lift the hard disk performance of 4K physical sector, the disk utilization of asynchronous I/O to optimize asynchronous I/O Reach 100% and video playback will not block.
In fact, due to due to framework model, the HTTP server of such as lighttpd etc, it is typically only capable to selection same The optimization of step I/O, and the HTTP server for such as NGINX etc, then both can select the optimization of synchronous i/o it is also possible to Select the optimization of asynchronous I/O.That is, the optimization of synchronous i/o or asynchronous I/O is alternative.
In conjunction with foregoing description, Fig. 4 is that the multimedia concurrent connection number according to the present invention optimizes schematic diagram.
As shown in figure 4, the optimization that the present invention is directed to Multimedia on demand service at least includes two parts, Part I includes carrying High single reads data volume;Part II includes synchronous i/o optimization and asynchronous I/O optimization.And, synchronous i/o optimization includes adopting Call with multiple progresses of work and using the system of MMAP function;Asynchronous I/O optimization includes buffering area 4K alignment.
In addition to above-mentioned two parts, embodiment of the present invention can also connect number with optimized integration by limiting concurrent Con current control.In addition, embodiment of the present invention is also based on the I/O occupancy of hard disk, it is to avoid will program request multimedia institute Hard disk I/O occupancy too high, thus avoid hard disk overload impact program request client normal play.
Sum it up, compared to existing technology, embodiment of the present invention at least includes following significant progress:
(1), compared to existing technology in for ordinary file read using 32 arrive 512KB singles read data volumes, this Bright embodiment considers the particularity of multimedia-on-demand scene, reads data volume with the single more than 512 kilobytes and reads firmly Multimedia file in disk.Especially, it is found by the applicant that:When single reads data volume for 2MB, it is possible to obtain preferably compromise Effect.
(2), compared to existing technology in adopt the single progress of work to read the multimedia file in hard disk in synchronous i/o Defect, embodiment of the present invention considers the particularity of multimedia-on-demand scene, is read many in hard disk with multiple progresses of work Media file.And, each progress of work of embodiment of the present invention is preferably realized data by MMAP function call mode and is read Take, can further improve the I/O performance of hard disk.
(3), compared to existing technology in adopt the defect of buffering area 512 alignment in asynchronous I/O, embodiment of the present invention examines Considering the particularity of multimedia-on-demand scene, reading the multimedia file in hard disk in the way of buffering area 4K alignment, thus entering One step lifting hard disk performance.
(4), embodiment of the present invention connects number with the con current control of optimized integration by limiting concurrent.In addition, the present invention Embodiment is also based on the I/O occupancy of hard disk, it is to avoid will program request multimedia be located hard disk I/O occupancy mistake Height, thus avoid the normal play of the client of hard disk overload impact program request.
Based on above-mentioned analysis, Fig. 5 is the exemplary process flow diagram of the multimedia-on-demand request according to the present invention.
As shown in figure 5, the method includes:
Step 501:Obtain multimedia all order request.
Step 502:Calculate the number of concurrent of order request.
Step 503:Judge whether the number of concurrent of order request exceedes predetermined number of concurrent threshold value, if it is, exiting this Flow process, if it is not, then execution step 504 and its subsequent step.
Step 504:Calculate the I/O load of hard disk.
Step 505:Judge whether the I/O load of hard disk exceedes predetermined load threshold, if it is, exiting this flow process, If it is not, then execution step 506 and its subsequent step.
Step 506:Judge whether to read hard disk in synchronous i/o mode, if it is, execution step 507 exit this stream Journey, if not then, it can be assumed that reading hard disk in asynchronous I/O mode, execution step 508 simultaneously exits this flow process.
Step 507:Multiple progresses of work call, by MMAP system, the multimedia file reading in hard disk.
Step 508:One or more processes send hard disk read requests to operating system nucleus respectively with asynchronous, and specify slow Rush area to align for 4K;Operating system nucleus reads data from hard disk, copies data to the buffering area of 4K alignment, and to one or many Individual process sends callback command, thus realizing one or more processes to obtain the multimedia file in hard disk.
Based on foregoing description, embodiment of the present invention also proposed a kind of multimedia concurrent connection number and optimizes device, This device is applied to multimedia service device.
Fig. 6 is that the multimedia concurrent connection number according to the present invention optimizes structure drawing of device.
As shown in fig. 6, this device 600 includes:
Playing request receiving unit 601, for receiving multimedia request;
Reading unit 602, for asking in response to multimedia, reads data volume with the single more than 512 kilobytes Read hard disk.
In one embodiment, this device 600 also includes:
Concurrent connection number computing unit 603, before in reading unit 602 in response to multimedia request, calculates The concurrent connection number of multimedia request, when the concurrent connection number of multimedia request exceedes predetermined concurrent connection number threshold During value, go to enable reading unit 602.
In one embodiment, this device 600 also includes:
Take load computing unit 604, before in reading unit 602 in response to multimedia request, calculate hard The input/output of disk takies load, when the input/output of hard disk takies load and exceedes predetermined load threshold, goes to enable and reads Take unit 602.
In one embodiment, reading unit 602, pass through internal memory mapping function (such as enabling multiple processes MMAP) hard disk is read in synchronous input/output mode.
In one embodiment, reading unit 602, enable one or more processes with asynchronous to operating system nucleus transmission Hard disk read requests, and appointed buffer is 4K alignment, enables operating system nucleus and reads data from hard disk, copies data to Buffering area, and send callback command to one or more processes.
Device 600 can be applied in multiple hardwares entity.Such as, when operating system adopts (SuSE) Linux OS, Device 600 can be specifically embodied as various common HTTP server (as NGINX, lighttpd).
The concurrent connection number optimization that proposed based on embodiment of the present invention is it is achieved that hardware (Ying Te in domestic level That Celeron, Pentium, Duo+2G internal memory) on the basis of, single server supports 40-80 number of concurrent program request, meets Internet bar, shadow , KTV using need.
Based on foregoing description, embodiment of the present invention also proposed multimedia concurrent connection number and optimizes system.
Fig. 7 is the demonstrative structure figure of the multimedia concurrent connection number optimization system according to the present invention.
As shown in fig. 7, this system includes multimedia service device and planter (number of planter can be multiple), Wherein multimedia service device is respectively provided with LAN with planter and is connected;
Planter, for sending multimedia request;
Multimedia service device, for asking in response to multimedia, with the single receive data more than 512 kilobytes Read hard disk according to amount.
In one embodiment, multimedia service device, is used for:
Before asking, calculate the concurrent connection number of multimedia request in response to multimedia, when multimedia is broadcast When putting the concurrent connection number of request and exceeding predetermined concurrent connection number threshold value, multimedia service device stop for new connect many Media play request provides order program service.
In one embodiment, multimedia service device, is used for:
Before asking in response to multimedia, calculate hard disk input/output take load, when hard disk input/ When output occupancy load exceedes predetermined load threshold, multimedia service device stops as the new multimedia connecting request Order program service is provided.
In one embodiment, multimedia service device, passes through internal memory mapping function (ratio for enabling multiple processes As MMAP) hard disk is read in synchronous input/output mode.
In one embodiment, multimedia service device, enables one or more processes with asynchronous into operating system Core sends hard disk read requests, and aligns for 4K in appointed buffer, enables operating system nucleus and reads data from hard disk, by data Copy to described buffering area, and send callback command to one or more processes described.
In sum, in embodiments of the present invention, receive multimedia request;In response to multimedia request, Data volume is read with the single more than 512 kilobytes and reads hard disk.It is directed to ordinary file reading in compared to existing technology and adopt 32 Single to 512KB reads data volume, and embodiment of the present invention considers the particularity of multimedia-on-demand scene, with more than 512 The data volume that reads the single of kilobytes reads the multimedia file in hard disk, can improve multimedia concurrent connection number.
And, compared to existing technology in adopt the single progress of work to read the multimedia file in hard disk in synchronous i/o Defect, embodiment of the present invention consider multimedia-on-demand scene particularity, with multiple progresses of work read hard disk in Multimedia file, can improve the I/O performance of hard disk further.
In addition, adopting the defect of buffering area 512 alignment, embodiment of the present invention in compared to existing technology in asynchronous I/O In view of the particularity of multimedia-on-demand scene, read the multimedia file in hard disk in the way of buffering area 4K alignment, permissible Lift hard disk performance further.
Further, calculated by number of concurrent and hard disk I/O load calculates, embodiment of the present invention can avoid impact to exist The media user broadcast, lifts Consumer's Experience.
The above, only presently preferred embodiments of the present invention, it is not intended to limit protection scope of the present invention.All Within the spirit and principles in the present invention, any modification, equivalent substitution and improvement made etc., should be included in the protection of the present invention Within the scope of.

Claims (13)

1. a kind of multimedia concurrent connection number optimization method is it is characterised in that the method is applied to multimedia service Device, the method includes:
Receive multimedia request;
In response to the request of described multimedia, data volume is read with the single more than 512 kilobytes and reads hard disk.
2. multimedia concurrent connection number optimization method according to claim 1 is it is characterised in that in response to described Before multimedia request, the method also includes:
Calculate the concurrent connection number of described multimedia request, when the concurrent connection number of described multimedia request exceed pre- During fixed concurrent connection number threshold value, exit this flow process;And/or
The input/output calculating described hard disk takies load, exceedes predetermined bearing when the input/output of described hard disk takies load When carrying threshold value, exit this flow process.
3. multimedia concurrent connection number optimization method according to claim 1 it is characterised in that
The described concurrent connection number calculating multimedia request includes:Calculate what the multimedia for all hard disks was asked Total concurrent connection number or the concurrent connection number calculating the multimedia request for each hard disk;
And/or
The described input/output calculating hard disk takies load and includes:During the central processing unit non-NULL of calculating input/output operations Between.
4. multimedia concurrent connection number optimization method according to claim 1 is it is characterised in that described reading hard disk Including:Multiple processes read hard disk in synchronous input/output mode.
5. multimedia concurrent connection number optimization method according to claim 4 is it is characterised in that the plurality of process Read hard disk in synchronous input/output mode to include:Multiple processes are read in synchronous input/output mode by internal memory mapping function Take hard disk.
6. multimedia concurrent connection number optimization method according to claim 1 is it is characterised in that described reading hard disk Including:One or more processes read hard disk in asynchronous input/output mode.
7. multimedia concurrent connection number optimization method according to claim 6 it is characterised in that described one or more Process reads hard disk in asynchronous input/output mode and includes:
One or more processes send hard disk read requests to operating system nucleus respectively, and align for 4K in appointed buffer;
Operating system nucleus reads data from hard disk, copies data to described buffering area, and sends out to one or more processes described Send callback command.
8. a kind of multimedia concurrent connection number optimizes device it is characterised in that this device is applied to multimedia service Device, this device includes:
Playing request receiving unit, for receiving multimedia request;
Reading unit, in response to the request of described multimedia, reading data volume with the single more than 512 kilobytes and reading Hard disk.
9. multimedia concurrent connection number according to claim 8 optimizes device it is characterised in that this device also wraps Include:
Concurrent connection number computing unit, before asking in response to described multimedia in reading unit, calculates described many The concurrent connection number of media play request, when the concurrent connection number of described multimedia request exceedes predetermined concurrent connection number During threshold value, go to enable described reading unit;And/or
Take load computing unit, before asking in response to described multimedia in reading unit, calculate described hard disk Input/output take load, when described hard disk input/output take load exceed predetermined load threshold when, go enable Described reading unit.
10. multimedia concurrent connection number according to claim 8 optimize device it is characterised in that
Reading unit, reads hard disk by internal memory mapping function in synchronous input/output mode for enabling multiple processes;Or make One or more processes can send hard disk read requests with asynchronous to operating system nucleus, and aliging for 4K in appointed buffer, enables Operating system nucleus reads data from hard disk, copies data to described buffering area, and sends back to one or more processes described Adjust order.
A kind of 11. multimedia concurrent connection numbers optimize system it is characterised in that including multimedia service device and program request Machine, wherein said multimedia service device has LAN with described planter and is connected;
Described planter, for sending multimedia request;
Described multimedia service device, in response to the request of described multimedia, being read with the single more than 512 kilobytes The amount of fetching data reads hard disk.
12. multimedia concurrent connection numbers according to claim 11 optimize systems it is characterised in that
Described multimedia service device, is used for:
Before in response to the request of described multimedia, calculate the concurrent connection number of described multimedia request, when described The concurrent connection number of multimedia request exceedes stopping during predetermined concurrent connection number threshold value;And/or,
Before in response to the request of described multimedia, the input/output calculating described hard disk takies load, when described hard disk Input/output take load exceed during predetermined load threshold stop.
13. multimedia concurrent connection numbers according to claim 11 optimize systems it is characterised in that
Described multimedia service device, for enabling multiple processes by internal memory mapping function in synchronous input/output mode Read hard disk;Or enable one or more processes with asynchronous to operating system nucleus transmission hard disk read requests, and appointed buffer For 4K alignment, enable operating system nucleus and read data from hard disk, copy data to described buffering area, and to described one or many Individual process sends callback command.
CN201610786277.0A 2016-08-31 2016-08-31 Multimedia playing concurrent connection number optimization method, apparatus and system Pending CN106383851A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610786277.0A CN106383851A (en) 2016-08-31 2016-08-31 Multimedia playing concurrent connection number optimization method, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610786277.0A CN106383851A (en) 2016-08-31 2016-08-31 Multimedia playing concurrent connection number optimization method, apparatus and system

Publications (1)

Publication Number Publication Date
CN106383851A true CN106383851A (en) 2017-02-08

Family

ID=57938768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610786277.0A Pending CN106383851A (en) 2016-08-31 2016-08-31 Multimedia playing concurrent connection number optimization method, apparatus and system

Country Status (1)

Country Link
CN (1) CN106383851A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241650A (en) * 2017-08-09 2017-10-10 四川长虹电器股份有限公司 A kind of method of quick positioning playing Caton phenomenon reason
CN110545484A (en) * 2018-05-29 2019-12-06 北京字节跳动网络技术有限公司 Buffer queue management method and device for media playing and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1556523A (en) * 2004-01-06 2004-12-22 中国科学院计算技术研究所 A control method for increasing the speed of reading hard disk by reducing the number of hard disk head seeks
CN1624669A (en) * 2003-12-02 2005-06-08 陈凯 Method of raising magnetic disc read speed of docament service device
CN104837029A (en) * 2015-05-08 2015-08-12 厦门大学 Method for storing and accessing resource hard disk of high-definition video-on-demand system
CN105205126A (en) * 2015-09-11 2015-12-30 武汉云空间地理信息技术有限公司 Storage method and storage system for map tiles
CN105488108A (en) * 2015-11-19 2016-04-13 广州日滨科技发展有限公司 High-speed parallel storage method and apparatus for multiple video files

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1624669A (en) * 2003-12-02 2005-06-08 陈凯 Method of raising magnetic disc read speed of docament service device
CN1556523A (en) * 2004-01-06 2004-12-22 中国科学院计算技术研究所 A control method for increasing the speed of reading hard disk by reducing the number of hard disk head seeks
CN104837029A (en) * 2015-05-08 2015-08-12 厦门大学 Method for storing and accessing resource hard disk of high-definition video-on-demand system
CN105205126A (en) * 2015-09-11 2015-12-30 武汉云空间地理信息技术有限公司 Storage method and storage system for map tiles
CN105488108A (en) * 2015-11-19 2016-04-13 广州日滨科技发展有限公司 High-speed parallel storage method and apparatus for multiple video files

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
曾家智 等: "《80486/80386系统设计和应用》", 31 August 1992, 电子科技大学出版社 *
杨明 等: "《Visual C++程序设计教程》", 28 February 2001, 安徽大学出版社 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241650A (en) * 2017-08-09 2017-10-10 四川长虹电器股份有限公司 A kind of method of quick positioning playing Caton phenomenon reason
CN107241650B (en) * 2017-08-09 2020-06-30 四川长虹电器股份有限公司 Method for quickly positioning playback pause phenomenon reason
CN110545484A (en) * 2018-05-29 2019-12-06 北京字节跳动网络技术有限公司 Buffer queue management method and device for media playing and storage medium
CN110545484B (en) * 2018-05-29 2021-12-14 北京字节跳动网络技术有限公司 Buffer queue management method and device for media playing and storage medium

Similar Documents

Publication Publication Date Title
JP4342435B2 (en) Method for processing data of at least one data stream, data storage system and method of using the system
US5603063A (en) Disk drive command queuing method using two memory devices for storing two types of commands separately first before queuing commands in the second memory device
US7236992B2 (en) Storage system
EP2353079B1 (en) File input/output scheduler using immediate data chunking
US6366980B1 (en) Disc drive for achieving improved audio and visual data transfer
US6189080B1 (en) Minimum read rate throughput in a disk cache system
US20030212865A1 (en) Method and apparatus for flushing write cache data
CN104424106B (en) The method and system of the resource of distribution storage device is operated for storage optimization
CN100426261C (en) High-speed memory pre-read method and device
CN105376218B (en) Streaming media system and method for quickly responding to user request
CN106133707A (en) Cache management
CN102546716B (en) A kind of buffer queue management method, device and demand stream media system
CN102253900A (en) Memory optimization method under Windows CE operating system
US8312214B1 (en) System and method for pausing disk drives in an aggregate
CN106383851A (en) Multimedia playing concurrent connection number optimization method, apparatus and system
CN1227592C (en) Method for managing stream media data
WO2024146330A1 (en) Video storage method and video playback method
US11385928B2 (en) System and method for priority orchestration and scheduling of different background operations
CN103108029B (en) The data access method of vod system
US10078642B1 (en) Dynamic memory shrinker for metadata optimization
US11733917B2 (en) High bandwidth controller memory buffer (CMB) for peer to peer data transfer
US10942875B2 (en) System and method for regulating host IOs and internal background operations in a storage system
CN102402397B (en) Method and device for storing data
CN118860282B (en) RAID 5/6 disk I/O request arrangement aggregation method and device
CN111464860A (en) Cache allocation method for video data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170208