[go: up one dir, main page]

CN110113374A - Streaming media server executes multitask method, device and storage medium, terminal device - Google Patents

Streaming media server executes multitask method, device and storage medium, terminal device Download PDF

Info

Publication number
CN110113374A
CN110113374A CN201910198407.2A CN201910198407A CN110113374A CN 110113374 A CN110113374 A CN 110113374A CN 201910198407 A CN201910198407 A CN 201910198407A CN 110113374 A CN110113374 A CN 110113374A
Authority
CN
China
Prior art keywords
task
link
execution
streaming media
media server
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.)
Granted
Application number
CN201910198407.2A
Other languages
Chinese (zh)
Other versions
CN110113374B (en
Inventor
马潜
高勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910198407.2A priority Critical patent/CN110113374B/en
Publication of CN110113374A publication Critical patent/CN110113374A/en
Priority to PCT/CN2019/118545 priority patent/WO2020186792A1/en
Application granted granted Critical
Publication of CN110113374B publication Critical patent/CN110113374B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/148Migration or transfer of sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present invention relates to exploitation auxiliary, service management technology field, a kind of streaming media server execution multitask method provided by the embodiments of the present application, comprising: obtain the task requests that client is sent, parse the task requests and obtain task execution link;Task execution link is replaced with into redirected link based on default link transformational relation;Internal task is determined according to the redirected link, executes the internal task, is obtained and is linked corresponding data with the task execution, by the data feedback to client.The problems such as changing original server by single thread and asynchronous input and output is that each user accesses link and establishes the situation of thread, avoids deadlock of the server in multithreading, state synchronized.By establishing single thread, the event of same task is enabled to be lined up progress under corresponding single thread, by establishing the thread of different type task events, in order to which streaming media server can be supported to link user volume while maximum.

Description

Streaming media server executes multitask method, device and storage medium, terminal device
Technical field
The present invention relates to exploitation auxiliary, service management technology field, and in particular to a kind of streaming media server execution task Method, apparatus and storage medium, terminal device.
Background technique
Traditional streaming media server needs to create a thread for each user link, that is, passes through when user accesses The mode of multithreading realizes the increase of user's amount of access, but per thread will be about expending the memory of 2M, if a 16G memory Server, most multipotency carries 8000 or so users, so link user volume is just while how server supports maximum At a problem;Meanwhile multithreading will appear the event that server is performed simultaneously multiple users access, user's amount of access compared with The problems such as when big, the thread of creation is more, and multithreading deadlock, state synchronized would tend to occur.In addition, traditional streaming media server does not have There are backstage and rights management function well, lacks the control to user's Authority and Domain Based Management and acquisition equipment, be unable to satisfy user day The product demand that benefit increases;The system function module degree of coupling is close, big for Function Extension and maintenance difficulties, not easy to get started.
Summary of the invention
The problem of to overcome the above technical problem, especially multithreading to be easy to appear deadlock, state synchronized, spy propose following Technical solution:
A kind of streaming media server provided in an embodiment of the present invention executes multitask method, comprising:
The task requests that client is sent are obtained, the task requests is parsed and obtains task execution link;
Task execution link is replaced with into redirected link based on default link transformational relation;
Internal task is determined according to the redirected link, executes the internal task, and acquisition is linked with the task execution Corresponding data, by the data feedback to client.
Optionally, the method is realized based on the streaming media server frame that NodeJS is constructed.
It is optionally, described that task execution link is replaced with by redirected link based on default link transformational relation, comprising:
Extract task execution agreement entrained in the task execution link;
The corresponding jump of the task execution agreement is obtained based on the agreement mapping relations in the default link transformational relation Turn agreement;
Agreement and task execution link are jumped according to described in, and task execution link is replaced with into the skip chain It connects.
Optionally, after the task requests for obtaining client transmission, comprising:
It establishes and detects the time detector that the task requests execute the time;
The execution dead band of presently described task requests is determined based on the time that the time detector detects.
Optionally, what the time detected based on the time detector determined presently described task requests executes sky After section, comprising:
When presently described task requests reach the execution dead band, obtains in other threads triggered and be not carried out thing Part;
Within the period for executing dead band, execute in other threads described is not carried out event.
Optionally, it is described execute in other threads described be not carried out after event, comprising:
The data for receiving presently described task requests, that suspends in other threads being carrying out described is not carried out event.
Optionally, after the data for receiving presently described task requests, further includes:
It is corresponding with positive execution event that streaming media server frame based on NodeJS building obtains presently described task requests User and permission incidence relation, compare presently described task requests user right corresponding with the positive execution event;
When the corresponding user right of presently described task requests is higher than the corresponding user right of the positive execution event, temporarily That stops in other threads being carrying out described is not carried out event;
In the corresponding user right of presently described task requests user right corresponding lower than the positive execution event, after The continuous positive execution event executed in other threads being carrying out.
Optionally, the streaming media server frame based on NodeJS building obtains presently described task requests and just holds After the incidence relation for acting the corresponding user of part and permission, further includes:
The permission for obtaining user uses data and permission confidence threshold, determines that the permission of user is set using data according to described Letter value;
The permission of user is adjusted according to the permission the value of the confidence and the permission confidence threshold.
The embodiment of the invention also provides a kind of streaming media servers to execute task apparatus, comprising:
Parsing module parses the task requests and obtains task execution chain for obtaining the task requests of client transmission It connects;
Replacement module, for task execution link to be replaced with redirected link based on default link transformational relation;
Feedback module executes the internal task for determining internal task according to the redirected link, obtain with it is described Task execution links corresponding data, by the data feedback to client.
The embodiment of the invention also provides a kind of computer readable storage medium, deposited on the computer readable storage medium Computer program is contained, which realizes that streaming media server described in any technical solution executes task when being executed by processor Method.
The embodiment of the invention also provides a kind of terminal devices, comprising:
One or more processors;
Memory;
One or more application program, wherein one or more of application programs are stored in the memory and quilt It is configured to be executed by one or more of processors, one or more of application programs are configured to carry out according to any skill Streaming media server described in art scheme executes the step of multitask method.
Compared with the prior art, the present invention has the following beneficial effects:
1, a kind of streaming media server provided by the embodiments of the present application executes multitask method, comprising: obtains client and sends Task requests, parse the task requests and obtain task execution link;The task is held based on default link transformational relation Row link replaces with redirected link;Determine internal task according to the redirected link, execute the internal task, obtain with it is described Task execution links corresponding data, by the data feedback to client.The stream constructed in this application by NodeJS Media server frame realizes streaming media server, by the link method of modification client to server end, by the link pair The Task Switching answered improves server concurrent capability at server internal task, while the stream constructed by NodeJS Media server frame belongs to front and back end discrete state, using single thread, the problems such as far from multithreading deadlock, state synchronized.
2, a kind of streaming media server provided by the embodiments of the present application executes multitask method, executes in server internal current When the progress of work of task cannot obtain timely result, it can be used for executing the business of other threads, i.e., by asynchronous non- Blocking mechanism improves streaming media server concurrent capability, while reducing the degree of coupling of server, therefore, in streaming media server Each progress of work use asynchronous non-blocking fashion, can handle multiple client request.
The additional aspect of the present invention and advantage will be set forth in part in the description, these will become from the following description Obviously, or practice through the invention is recognized.
Detailed description of the invention
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments Obviously and it is readily appreciated that, in which:
Fig. 1 is that a kind of process of embodiment is shown in the exemplary embodiments of streaming media server of the present invention execution multitask method It is intended to;
Fig. 2 is the structural schematic diagram for the exemplary embodiments that streaming media server of the present invention executes task apparatus;
Fig. 3 is an example structure schematic diagram of server of the present invention.
Specific embodiment
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached The embodiment of figure description is exemplary, and for explaining only the invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in specification of the invention Diction " comprising " refers to that there are the feature, integer, step, operations, but it is not excluded that in the presence of or addition it is one or more other Feature, integer, step, operation.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in fields of the present invention.Should also Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art The consistent meaning of meaning, and unless idealization or meaning too formal otherwise will not be used by specific definitions as here To explain.
It will be appreciated by those skilled in the art that so-called " application ", " application program ", " application software " and class of the invention It is same concept well known to those skilled in the art like the concept of statement, refers to and instructed by series of computation machine and related data The computer software for being suitable for electronics operation of the organic construction of resource.Unless specified, this name itself is not by programming language Type, rank, the operating system of operation of also not rely by it or platform are limited.In the nature of things, this genus also not by appoint The terminal of what form is limited.
A kind of streaming media server provided by the embodiments of the present application executes multitask method, in a kind of wherein embodiment, As shown in Figure 1, comprising: S100, S200, S300.
S100: obtaining the task requests that client is sent, and parses the task requests and obtains task execution link;
S200: task execution link is replaced with by redirected link based on default link transformational relation;
S300: determining internal task according to the redirected link, executes the internal task, obtains and the task execution Corresponding data are linked, by the data feedback to client.
The application is that the streaming media server frame based on NodeJS building realizes that streaming media server executes multitask method, The application is mainly used in during streaming media server execution task, changes original clothes by single thread and asynchronous input and output Business device is that each user accesses link and establishes the situation of thread, avoids deadlock of the server in multithreading, state same The problems such as step.By establishing single thread, the event of same task is enabled to be lined up progress under corresponding single thread, by building The thread of vertical different type task events, in order to which streaming media server can be supported to link user volume while maximum.In order to Reach beneficial effect above-mentioned, in this application, the task requests that client is sent is converted to the inside of streaming media server Event, and then avoid accessing link one individual thread of creation for each user.Streaming media server is specifically worked Cheng Zhong obtains the task requests that client is sent and is getting since task requests are to be sent to server in the form of package It after task requests, needs to parse it, to obtain task execution link therein, the opposite end for needing to access such as client Address, therefore, it is necessary to be parsed to the task requests, to obtain the task execution for including in task requests link.Server After getting task execution link, then modifies to task execution link, the process for executing the task is become to flow Event is executed inside media server, therefore task execution link is revised as redirected link.
It is optionally, described to be based on default link transformational relation for the task execution chain in a kind of wherein embodiment It takes over and is changed to redirected link, comprising: extract task execution agreement entrained in the task execution link;Based on described default Agreement mapping relations in link transformational relation obtain that the task execution agreement is corresponding to jump agreement;Association is jumped according to described in The task execution link of negotiating peace, which links the task execution, replaces with the redirected link.In embodiment provided by the present application In, server can be pre-stored with the mapping relations formula of agreement between task execution link and redirected link, conventional protocol package Include: TFTP, HTTP, SNMP, FTP, SMTP, DNS, Telnet, the agreement linked such as task execution are http, server internal association Mapping relations between view are http correspondence and DNS, then http are revised as DNS based on the mapping relations of agreement, and then will appoint The agreement that business executes link is modified conversion, is obtained and is jumped agreement, DNS Protocol as the aforementioned, further, task execution chain Opposite end address in connecing is constant, only modifies to agreement.After being DNS by http protocol modification, then obtaining includes that DNS is assisted The request of former task execution is converted to streaming media server internal processing time by agreement by the connection of view, i.e. DNS is Streaming Media Service internal dialogue/authentication protocol.
After foregoing task execution request is converted into redirected link by streaming media server, then aforementioned client is sent and appointed Business executes request and is determined as internal task, and streaming media server can then be determined according to redirected link carries out inner event processing mistake Journey, and agreement is jumped according to this and gets the corresponding resource of former task execution link.Specifically, being translated into inter-process thing After part, then it can be asked by the resume module of the server internal event, server whenever the receiving a client of the task When asking, server creates a process and establishes connection with client out and interact, and until connection disconnects, which is just disconnected Connection terminates this subtask.Wherein interactive process is then to execute internal task, obtains the mistake of former task execution connection corresponding resource Journey can also include reading the request for including in the process implementation procedure in redirected link, parse asking of including in redirected link Determining internal task is sought, handles the internal task of the request to generate corresponding data, then the data are returned into client, most After disconnect.Benefit using process be it is mutually indepedent between each process, do not need to lock, reduce using lock to performance It impacts, while reducing the complexity of programming, reduce development cost.Secondly, process can be allowed mutual using independent process Between will not influence, if a process is abnormal when exiting, other processes are worked normally, and server can also start quickly New process, it is ensured that service will not be interrupted, so that risk is preferably minimized.
Optionally, after the task requests for obtaining client transmission, comprising:
It establishes and detects the time detector that the task requests execute the time;
The execution dead band of presently described task requests is determined based on the time that the time detector detects.
Since the application can improve the working efficiency of Streaming Media by asynchronous non-blockage mechanism, in order to execute dead band Process above-mentioned can be used to execute other tasks by time, server.For example following setTimeout of time detector, no The server framework of same method built can have different time detector texts.In the process, in server The progress of work is in implementation procedure, when can not obtain result in time, then triggers setTimeout time detector detection time, touching After sending out time detector, wherein the setTimeout is located at the end of one end caller as described later, in order to take Foregoing work process is adjusted to his used time by business device, can execute link correspondence based on setTimeout sentence triggering foregoing task Task.In the process, feedback information can be sent to client, so that client can do other things, led to It crosses aforementioned process and realizes asynchronous non-blockage mechanism, the working efficiency of server is provided, i.e., carry out a client under single thread Access process in, in the waiting process of task implementation procedure, the progress of work for executing current task can be used to execute Other business improve the saturation of server by asynchronous non-blocking fashion, improve the concurrent capability of server, avoid multi-thread Under journey the problems such as deadlock, state synchronized.
Optionally, what the time detected based on the time detector determined presently described task requests executes sky After section, comprising:
When presently described task requests reach the execution dead band, obtains in other threads triggered and be not carried out thing Part;
Within the period for executing dead band, execute in other threads described is not carried out event.
Optionally, it is described execute in other threads described be not carried out after event, comprising:
The data for receiving presently described task requests, suspend in other threads being carrying out it is described be not carried out event, By the data feedback to client.
In conjunction with aforementioned it is found that improve streaming media server concurrent capability by asynchronous non-blockage mechanism, while service is reduced The degree of coupling of device, therefore, each progress of work in streaming media server use asynchronous non-blocking fashion, can handle more A client request.It is converted when some progress of work in streaming media server is received mentioned by client request After internal task, in the process of implementation, calling interface I/O is handled, if be not immediately available as a result, if can determine For the execution dead band of current task request, then the progress of work is used to handle other requests (state for realizing non-obstruction), He requests the time being not carried out in other threads triggered, can such as execute request response, disk read-write, input and output Deng;And client can go to handle other things (realizing asynchronous) during this period without wait-for-response as previously described.Work as I/O When return, it is informed about this progress of work;The process is notified, and the currently processed affairs of temporary suspension go to customer in response end to ask It asks, i.e., the data feedback returned to I/O is to client, after the task of client is completed, server assignment process The connection with client is disconnected, and the client is used to continue to execute in other aforementioned threads and is not carried out event.
By aforementioned process, the streaming media server end based on NodeJS is realized to have while handling up to tens of thousands of use The client access ability at family;It in the specific implementation process, can also be that streaming media server carries out multiplicity by NodeJS The mating operation of the component of change, such as interface, managementization, the relevant operation of database, so that streaming media server bottom is only The function of needing to pay close attention to core Streaming Media reduces the degree of coupling of streaming media server, in this application, is also write using C++ Node plug-in unit carries out function of the Streaming Media about complicated calculations type, convenient for extending and safeguarding in the future, meets product well and changes Generation exploitation demand.
When current task cannot obtain result in time, then the progress of work for executing current task is not held for executing other It acts in part on the basis of setTimeout, it is also necessary to which call back function realizes that the program of operational process is as follows:
Such as:
Illustrate that Nodejs is single thread operation, based on event driven by aforementioned process, it is first synchronous (i.e. by to Under sequence) execute code (event loop at this time is pause) in entire js file, when encountering asynchronous function When (setTimeout timing function), useful thread can be sought from thread pool to execute the asynchronous function, work as asynchronous function It has been executed that, just call back function has been put into inside message queue.After entire js file has executed, event loop starts to execute, from Message is taken inside message queue, starts the call back function for executing the inside, i.e., executes what current task did not completed by call back function Event.
Optionally, after the data for receiving presently described task requests, further includes:
It is corresponding with positive execution event that streaming media server frame based on NodeJS building obtains presently described task requests User and permission incidence relation, compare presently described task requests user right corresponding with the positive execution event;
When the corresponding user right of presently described task requests is higher than the corresponding user right of the positive execution event, temporarily That stops in other threads being carrying out described is not carried out event;
In the corresponding user right of presently described task requests user right corresponding lower than the positive execution event, after The continuous positive execution event executed in other threads being carrying out.As previously mentioned, being based on NodeJS language in the application Therefore constructing the server association platform based on web in corresponding streaming media server, can also pass through the server Platform realizes to user, role, permission any one or multinomial adjustment, about user right Role Management, using RBAC (Role-based access control) the most basic realization of access control model come manage (user's table, Jiao Sebiao, Authority list, user-role association table, role-permission contingency table).It is avoided by this method for being fixed on an ID or ground Point facilitates user that can carry out anywhere or anytime user right Role Management user right Role Management above-mentioned, mentions The efficiency of management of high user.Further, since different user may have different rights, for different rights, to the neutral gear phase Executive mode it is different, for example, it is corresponding to be higher than the positive execution event in the corresponding user right of presently described task requests When user right, that suspends in other threads being carrying out described is not carried out event;It is corresponding in presently described task requests When corresponding lower than the positive execution event user right of user right, continue to execute described in other threads being carrying out It is positive to execute event, wherein the positive execution event is the event being not carried out in other aforementioned threads.Specifically, current task is asked It is preferential to execute current task request when corresponding user right being asked to be higher than the corresponding user right of other thread events, then execute it His thread is not carried out the event of completion, and current task requests corresponding user right to be lower than the corresponding user right of other thread events When, the event in the thread being carrying out is executed, then execute current task request.
Optionally, the streaming media server frame based on NodeJS building obtains presently described task requests and just holds After the incidence relation for acting the corresponding user of part and permission, further includes:
The permission for obtaining user uses data and permission confidence threshold, determines that the permission of user is set using data according to described Letter value;
The permission of user is adjusted according to the permission the value of the confidence and the permission confidence threshold.
The permission refers to the history usage record for the user right option being recorded in server database using data, Every history usage record includes: User ID, authority name, permission selects, user accesses historical record, every historical record also It may include the modification record of priority assignation.User's history record it is better when, and user right modification record be all by User right can then modify to the permission of user toward when high adjustment.For example, being repaired based on aforementioned user record and user Changing record etc. can determine that the permission the value of the confidence of user is 8 points, corresponding to 7-8 points of permission confidence threshold, then by the power of user Limit is adjusted to the corresponding permission of 7-8 fraction limit confidence threshold, and then carries out user access request according to the user right subsequent The priority processing of event.
The embodiments of the present invention also provide a kind of streaming media servers to execute multitask method device, wherein a kind of implementation In mode, as shown in Figure 2, comprising: parsing module 100, replacement module 200, feedback module 300.
Parsing module 100 parses the task requests and obtains task execution for obtaining the task requests of client transmission Link;
Replacement module 200, for task execution link to be replaced with redirected link based on default link transformational relation;
Feedback module 300 executes the internal task for determining internal task according to the redirected link, obtain with The task execution links corresponding data, by the data feedback to client.
Further, as shown in Fig. 2, a kind of streaming media server provided in the embodiment of the present invention executes multitask method dress It sets further include: extraction unit 210, for extracting task execution agreement entrained in the task execution link;Jump agreement Acquiring unit 220, for obtaining the task execution agreement based on the agreement mapping relations in the default link transformational relation It is corresponding to jump agreement;Replacement unit 230 holds the task for jumping agreement and task execution link according to described in Row link replaces with the redirected link.Time detector establishes module 101, when detecting task requests execution for establishing Between time detector;Dead band determining module 102 is executed, the time for detecting based on the time detector determines current The execution dead band of the task requests.Be not carried out event obtain module 103, for presently described task requests reach described in hold When row dead band, obtains in other threads triggered and be not carried out event;It is not carried out event execution module 104, for described In the period for executing dead band, execute in other threads described is not carried out event.Receiving module 105, for receiving current institute The data for stating task requests, that suspends in other threads being carrying out described is not carried out event.Contrast module 106 is used for base Presently described task requests user corresponding with positive execution event and power are obtained in the streaming media server frame of NodeJS building The incidence relation of limit compares presently described task requests user right corresponding with the positive execution event;Suspend module 107, For when the corresponding user right of presently described task requests is higher than the corresponding user right of the positive execution event, pause to be just Event is not carried out described in other threads of execution;Module 108 is continued to execute, for corresponding in presently described task requests User right corresponding lower than the positive execution event user right when, continue to execute the institute in other threads being carrying out State positive execution event;Permission the value of the confidence determining module 1091, the permission for obtaining user use data and permission confidence threshold, According to the permission the value of the confidence for determining user using data;Permission adjusts module 1092, for according to the permission the value of the confidence The permission of user is adjusted with the permission confidence threshold.
A kind of streaming media server provided in an embodiment of the present invention, which executes multitask method device, may be implemented above-mentioned Streaming Media Server executes the embodiment of multitask method, and concrete function realizes the explanation referred in embodiment of the method, and details are not described herein.
A kind of computer readable storage medium provided in an embodiment of the present invention stores on the computer readable storage medium There is computer program, realizes that streaming media server described in any one technical solution executes task when which is executed by processor Method.Wherein, the computer readable storage medium include but is not limited to any kind of disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS Memory, with That is memory), EPROM (EraSable Programmable Read-Only Memory, the read-only storage of erasable programmable Device), EEPROM (Electrically EraSable Programmable Read-Only Memory, electric erazable programmable only Read memory), flash memory, magnetic card or light card.It is, storage equipment includes by equipment (for example, computer, mobile phone) With any medium for the form storage or transmission information that can be read, read-only memory, disk or CD etc. can be.
A kind of computer readable storage medium provided in an embodiment of the present invention is, it can be achieved that the execution of above-mentioned streaming media server is appointed The embodiment of business method is realized streaming media server by the streaming media server frame of NodeJS building in this application, is led to The link method for modifying client to server end is crossed, by the corresponding Task Switching of the link at server internal task, in turn Server concurrent capability is improved, while front and back end discrete state is belonged to by the streaming media server frame that NodeJS is constructed, Using single thread, the problems such as far from multithreading deadlock, state synchronized;A kind of streaming media server provided by the embodiments of the present application is held Row multitask method, comprising: obtain the task requests that client is sent, parse the task requests and obtain task execution link;Base Task execution link is replaced with into redirected link in default link transformational relation;Internal appoint is determined according to the redirected link Business executes the internal task, obtains and links corresponding data with the task execution, by the data feedback to client End.In this application, the task requests that client is sent are converted into the internal event of streaming media server, and then avoid being every One user accesses link one individual thread of creation.In the specific course of work of streaming media server, client hair is obtained The task requests sent after getting task requests, are needed since task requests are to be sent to server in the form of package It is parsed, to obtain task execution link therein, such as the opposite end address that client needs to access, therefore, it is necessary to right The task requests are parsed, to obtain the task execution for including in task requests link.Server gets task execution chain After connecing, then modifies to task execution link, the process for executing the task is become to hold inside streaming media server Part is acted, therefore task execution link is revised as redirected link.In embodiment provided by the present application, server can be prestored The mapping relations formula of agreement between task execution link and redirected link is contained, conventional agreement includes: TFTP, HTTP, SNMP, FTP, SMTP, DNS, Telnet, the agreement linked such as task execution are http, and the mapping relations between server internal agreement are Http is corresponding and DNS, then http is revised as DNS based on the mapping relations of agreement, so by the agreement of task execution link into Row modification conversion, acquisition jump agreement, and DNS Protocol as the aforementioned, further, the opposite end address in task execution link is not Become, only modifies to agreement.After being DNS by http protocol modification, then the connection including DNS Protocol is obtained, association is passed through The request of former task execution is converted to streaming media server internal processing time by view, i.e. DNS is to talk with/recognize inside streaming media service Demonstrate,prove agreement.After foregoing task execution request is converted into redirected link by streaming media server, then aforementioned client is sent and appointed Business executes request and is determined as internal task, and streaming media server can then be determined according to redirected link carries out inner event processing mistake Journey, and agreement is jumped according to this and gets the corresponding resource of former task execution link.Specifically, being translated into inter-process thing After part, then it can be asked by the resume module of the server internal event, server whenever the receiving a client of the task When asking, server creates a process and establishes connection with client out and interact, and until connection disconnects, which is just disconnected Connection terminates this subtask.Wherein interactive process is then to execute internal task, obtains the mistake of former task execution connection corresponding resource Journey can also include reading the request for including in the process implementation procedure in redirected link, parse asking of including in redirected link Determining internal task is sought, handles the internal task of the request to generate corresponding data, then the data are returned into client, most After disconnect.Benefit using process be it is mutually indepedent between each process, do not need to lock, reduce using lock to performance It impacts, while reducing the complexity of programming, reduce development cost.Secondly, process can be allowed mutual using independent process Between will not influence, if a process is abnormal when exiting, other processes are worked normally, and server can also start quickly New process, it is ensured that service will not be interrupted, so that risk is preferably minimized.
In addition, the present invention also provides a kind of terminal devices, as shown in figure 3, the terminal device in another embodiment The devices such as processor 503, memory 505, input unit 507 and display unit 509.It will be understood by those skilled in the art that Structure devices shown in Fig. 3 do not constitute the restriction to all terminal devices, may include components more more or fewer than diagram, Or the certain components of combination.Memory 505 can be used for storing application program 501 and each functional module, and the operation of processor 503 is deposited The application program 501 in memory 505 is stored up, thereby executing the various function application and data processing of equipment.Memory 505 can To be built-in storage or external memory, or including both built-in storage and external memory.Built-in storage may include read-only deposits Reservoir (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory Reservoir or random access memory.External memory may include hard disk, floppy disk, ZIP disk, USB flash disk, tape etc..It is disclosed in this invention Memory includes but is not limited to the memory of these types.Memory 505 disclosed in this invention is only used as example rather than conduct It limits.
Input unit 507 is used to receive the personal information and relevant physical condition of input and the user's input of signal Information.Input unit 507 may include touch panel and other input equipments.Touch panel collect client on it or near Touch operation (such as client using any suitable object or attachment such as finger, stylus on touch panel or in touch surface Operation near plate), and corresponding attachment device is driven according to a pre-set procedure;Other input equipments may include but not It is limited to one of physical keyboard, function key (such as broadcasting control button, switch key etc.), trace ball, mouse, operating stick etc. Or it is a variety of.Display unit 509 can be used for showing the information of client's input or be supplied to the information and computer equipment of client Various menus.The forms such as liquid crystal display, Organic Light Emitting Diode can be used in display unit 509.Processor 503 is that computer is set Standby control centre is stored in using the various pieces of various interfaces and the entire computer of connection by running or executing Software program and/or module in reservoir 503, and the data being stored in memory are called, it performs various functions and handles Data.One or more processors 503 shown in Fig. 3 are able to carry out, realize parsing module 100 shown in Fig. 2 function, The function of replacement module 200, the function of feedback module 300, the function of extraction unit 210, the function for jumping agreement acquiring unit 220 Energy, the function of replacement unit 230, time detector establish the function of module 101, execute the function, not of dead band determining module 102 Execution event obtains the function of module 103, the function of being not carried out event execution module 104, the function of receiving module 105, comparison Function, the pause function of module 107, the function of continuing to execute module 108, permission the value of the confidence determining module 1091 of module 106 Function, permission adjustment module 1092 function.
In one embodiment, the terminal device includes that one or more processors 503 and one or more are deposited Reservoir 505, one or more application program 501, wherein one or more of application programs 501 are stored in memory 505 In and be configured as being executed by one or more of processors 503, one or more of application programs 301 are configured to hold Streaming media server described in row above embodiments executes multitask method.
A kind of terminal device provided in an embodiment of the present invention is, it can be achieved that above-mentioned streaming media server executes the reality of multitask method Example is applied, streaming media server is realized by the streaming media server frame of NodeJS building in this application, is led to The link method for modifying client to server end is crossed, by the corresponding Task Switching of the link at server internal task, in turn Server concurrent capability is improved, while front and back end discrete state is belonged to by the streaming media server frame that NodeJS is constructed, Using single thread, the problems such as far from multithreading deadlock, state synchronized;A kind of streaming media server provided by the embodiments of the present application is held Row multitask method, comprising: obtain the task requests that client is sent, parse the task requests and obtain task execution link;Base Task execution link is replaced with into redirected link in default link transformational relation;Internal appoint is determined according to the redirected link Business executes the internal task, obtains and links corresponding data with the task execution, by the data feedback to client End.In this application, the task requests that client is sent are converted into the internal event of streaming media server, and then avoid being every One user accesses link one individual thread of creation.In the specific course of work of streaming media server, client hair is obtained The task requests sent after getting task requests, are needed since task requests are to be sent to server in the form of package It is parsed, to obtain task execution link therein, such as the opposite end address that client needs to access, therefore, it is necessary to right The task requests are parsed, to obtain the task execution for including in task requests link.Server gets task execution chain After connecing, then modifies to task execution link, the process for executing the task is become to hold inside streaming media server Part is acted, therefore task execution link is revised as redirected link.In embodiment provided by the present application, server can be prestored The mapping relations formula of agreement between task execution link and redirected link is contained, conventional agreement includes: TFTP, HTTP, SNMP, FTP, SMTP, DNS, Telnet, the agreement linked such as task execution are http, and the mapping relations between server internal agreement are Http is corresponding and DNS, then http is revised as DNS based on the mapping relations of agreement, so by the agreement of task execution link into Row modification conversion, acquisition jump agreement, and DNS Protocol as the aforementioned, further, the opposite end address in task execution link is not Become, only modifies to agreement.After being DNS by http protocol modification, then the connection including DNS Protocol is obtained, association is passed through The request of former task execution is converted to streaming media server internal processing time by view, i.e. DNS is to talk with/recognize inside streaming media service Demonstrate,prove agreement.After foregoing task execution request is converted into redirected link by streaming media server, then aforementioned client is sent and appointed Business executes request and is determined as internal task, and streaming media server can then be determined according to redirected link carries out inner event processing mistake Journey, and agreement is jumped according to this and gets the corresponding resource of former task execution link.Specifically, being translated into inter-process thing After part, then it can be asked by the resume module of the server internal event, server whenever the receiving a client of the task When asking, server creates a process and establishes connection with client out and interact, and until connection disconnects, which is just disconnected Connection terminates this subtask.Wherein interactive process is then to execute internal task, obtains the mistake of former task execution connection corresponding resource Journey can also include reading the request for including in the process implementation procedure in redirected link, parse asking of including in redirected link Determining internal task is sought, handles the internal task of the request to generate corresponding data, then the data are returned into client, most After disconnect.Benefit using process be it is mutually indepedent between each process, do not need to lock, reduce using lock to performance It impacts, while reducing the complexity of programming, reduce development cost.Secondly, process can be allowed mutual using independent process Between will not influence, if a process is abnormal when exiting, other processes are worked normally, and server can also start quickly New process, it is ensured that service will not be interrupted, so that risk is preferably minimized.
The streaming media server that above-mentioned offer may be implemented in terminal device provided in an embodiment of the present invention executes multitask method Embodiment, concrete function, which is realized, refers to explanation in embodiment of the method, and details are not described herein.
The above is only some embodiments of the invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (10)

1. a kind of streaming media server executes multitask method characterized by comprising
The task requests that client is sent are obtained, the task requests is parsed and obtains task execution link;
Task execution link is replaced with into redirected link based on default link transformational relation;
Internal task is determined according to the redirected link, executes the internal task, and acquisition links relatively with the task execution The data answered, by the data feedback to client.
2. streaming media server according to claim 1 executes multitask method, which is characterized in that described based on default link Task execution link is replaced with redirected link by transformational relation, comprising:
Extract task execution agreement entrained in the task execution link;
Obtain that the task execution agreement is corresponding to jump agreement based on preset protocol mapping relations;
Agreement and task execution link are jumped according to described in, and task execution link is replaced with into the redirected link.
3. streaming media server according to claim 1 executes multitask method, which is characterized in that the acquisition client hair After the task requests sent, comprising:
It establishes and detects the time detector that the task requests execute the time;
The execution dead band of presently described task requests is determined based on the time that the time detector detects.
4. streaming media server according to claim 3 executes multitask method, which is characterized in that described to be based on the time The time that detector detects determines after the execution dead band of presently described task requests, comprising:
When presently described task requests reach the execution dead band, obtains in other threads triggered and be not carried out event;
Within the period for executing dead band, execute in other threads described is not carried out event.
5. streaming media server according to claim 4 executes multitask method, which is characterized in that described other threads of execution In described be not carried out after event, comprising:
The data for receiving presently described task requests, that suspends in other threads being carrying out described is not carried out event.
6. streaming media server according to claim 5 executes multitask method, which is characterized in that the reception is presently described After the data of task requests, further includes:
Streaming media server frame based on NodeJS building obtains presently described task requests use corresponding with positive execution event The incidence relation at family and permission compares presently described task requests user right corresponding with the positive execution event;
When the corresponding user right of presently described task requests is higher than the corresponding user right of the positive execution event, pause is just Event is not carried out described in other threads of execution;
In the corresponding user right of presently described task requests user right corresponding lower than the positive execution event, continue to hold The positive execution event in other threads that row is carrying out.
7. streaming media server according to claim 6 executes multitask method, which is characterized in that described to be based on NodeJS structure The streaming media server frame built obtains being associated with for presently described task requests user corresponding with positive execution event and permission After system, further includes:
The permission for obtaining user uses data and permission confidence threshold, according to the permission confidence for determining user using data Value;
The permission of user is adjusted according to the permission the value of the confidence and the permission confidence threshold.
8. a kind of streaming media server executes task apparatus characterized by comprising
Parsing module parses the task requests and obtains task execution link for obtaining the task requests of client transmission;
Replacement module, for task execution link to be replaced with redirected link based on default link transformational relation;
Feedback module executes the internal task, obtains and the task for determining internal task according to the redirected link It executes and links corresponding data, by the data feedback to client.
9. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program realizes that the described in any item streaming media servers of claim 1 to 7 execute task side when the program is executed by processor Method.
10. a kind of terminal device characterized by comprising
One or more processors;
Memory;
One or more application program, wherein one or more of application programs are stored in the memory and are configured To be executed by one or more of processors, one or more of application programs are configured to carry out according to claim 1 The step of executing multitask method to 7 described in any item streaming media servers.
CN201910198407.2A 2019-03-15 2019-03-15 Method and device for executing tasks by streaming media server, storage medium and terminal equipment Active CN110113374B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910198407.2A CN110113374B (en) 2019-03-15 2019-03-15 Method and device for executing tasks by streaming media server, storage medium and terminal equipment
PCT/CN2019/118545 WO2020186792A1 (en) 2019-03-15 2019-11-14 Streaming media server task execution method and apparatus, and storage medium and terminal device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910198407.2A CN110113374B (en) 2019-03-15 2019-03-15 Method and device for executing tasks by streaming media server, storage medium and terminal equipment

Publications (2)

Publication Number Publication Date
CN110113374A true CN110113374A (en) 2019-08-09
CN110113374B CN110113374B (en) 2022-03-25

Family

ID=67484343

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910198407.2A Active CN110113374B (en) 2019-03-15 2019-03-15 Method and device for executing tasks by streaming media server, storage medium and terminal equipment

Country Status (2)

Country Link
CN (1) CN110113374B (en)
WO (1) WO2020186792A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343239A (en) * 2020-02-10 2020-06-26 中国银联股份有限公司 Communication request processing method, communication request processing device and transaction system
WO2020186792A1 (en) * 2019-03-15 2020-09-24 平安科技(深圳)有限公司 Streaming media server task execution method and apparatus, and storage medium and terminal device
CN112910794A (en) * 2021-01-07 2021-06-04 广州广哈通信股份有限公司 Load balancing system for multi-path E1 networking
CN113709420A (en) * 2021-08-30 2021-11-26 远光软件股份有限公司 Streaming media data transmission method and device, storage medium and electronic equipment
CN118158205A (en) * 2024-05-11 2024-06-07 深圳天海宸光科技有限公司 Short-term streaming media cache processing method and device, medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130339475A1 (en) * 2012-06-15 2013-12-19 Narendra Kataria Systems and methods for cluster lag
CN104142942A (en) * 2013-05-08 2014-11-12 北京航天长峰科技工业集团有限公司 Mass heterogeneous data accessing and standardization method
CN104202620A (en) * 2014-07-04 2014-12-10 南京超聚通信科技有限公司 System and method of implementing video on demand and review of unidirectional set-top box through mobile intelligent terminal
CN105579968A (en) * 2013-09-26 2016-05-11 大陆汽车有限责任公司 User message queue method for inter-process communication
CN108429645A (en) * 2018-03-05 2018-08-21 深圳乐信软件技术有限公司 A configuration method, device, storage medium and API gateway of an API gateway
CN108762898A (en) * 2018-04-09 2018-11-06 平安科技(深圳)有限公司 A kind of management method, terminal device and the computer readable storage medium of thread interface

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8612618B2 (en) * 2011-10-31 2013-12-17 King Fahd University Of Petroleum And Minerals Peer-to-peer DNS networking method
CN107784065B (en) * 2017-08-17 2021-04-27 平安壹钱包电子商务有限公司 Service data tracking method and device, computer equipment and storage medium
CN108429783A (en) * 2018-01-16 2018-08-21 重庆金融资产交易所有限责任公司 Electronic device, configuration file method for pushing and storage medium
CN110113374B (en) * 2019-03-15 2022-03-25 平安科技(深圳)有限公司 Method and device for executing tasks by streaming media server, storage medium and terminal equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130339475A1 (en) * 2012-06-15 2013-12-19 Narendra Kataria Systems and methods for cluster lag
CN104142942A (en) * 2013-05-08 2014-11-12 北京航天长峰科技工业集团有限公司 Mass heterogeneous data accessing and standardization method
CN105579968A (en) * 2013-09-26 2016-05-11 大陆汽车有限责任公司 User message queue method for inter-process communication
CN104202620A (en) * 2014-07-04 2014-12-10 南京超聚通信科技有限公司 System and method of implementing video on demand and review of unidirectional set-top box through mobile intelligent terminal
CN108429645A (en) * 2018-03-05 2018-08-21 深圳乐信软件技术有限公司 A configuration method, device, storage medium and API gateway of an API gateway
CN108762898A (en) * 2018-04-09 2018-11-06 平安科技(深圳)有限公司 A kind of management method, terminal device and the computer readable storage medium of thread interface

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
天津滨海迅腾科技集团有限公司: "《Node.js项目实战》", 31 August 2018 *
白色程序猿: "Node-Media-Server", 《博客园》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020186792A1 (en) * 2019-03-15 2020-09-24 平安科技(深圳)有限公司 Streaming media server task execution method and apparatus, and storage medium and terminal device
CN111343239A (en) * 2020-02-10 2020-06-26 中国银联股份有限公司 Communication request processing method, communication request processing device and transaction system
CN112910794A (en) * 2021-01-07 2021-06-04 广州广哈通信股份有限公司 Load balancing system for multi-path E1 networking
CN112910794B (en) * 2021-01-07 2023-04-07 国网河北省电力有限公司信息通信分公司 Load balancing system for multi-path E1 networking
CN113709420A (en) * 2021-08-30 2021-11-26 远光软件股份有限公司 Streaming media data transmission method and device, storage medium and electronic equipment
CN113709420B (en) * 2021-08-30 2024-07-23 远光软件股份有限公司 Streaming media data transmission method and device, storage medium and electronic equipment
CN118158205A (en) * 2024-05-11 2024-06-07 深圳天海宸光科技有限公司 Short-term streaming media cache processing method and device, medium and electronic equipment
CN118158205B (en) * 2024-05-11 2024-08-27 深圳天海宸光科技有限公司 Short-term streaming media cache processing method and device, medium and electronic equipment

Also Published As

Publication number Publication date
CN110113374B (en) 2022-03-25
WO2020186792A1 (en) 2020-09-24

Similar Documents

Publication Publication Date Title
CN110113374A (en) Streaming media server executes multitask method, device and storage medium, terminal device
CN111078315B (en) Microservice arranging and executing method and system, architecture, equipment and storage medium
CN105205766B (en) Mobile internet hospital system of seeing a doctor based on cloud platform
Cirne et al. Labs of the world, unite!!!
CN102194158B (en) The simplification user of workflow controls
CN109597605A (en) Using micro services dispositions method, device, storage medium and terminal device
AU2017415315B2 (en) Integrating virtual and human agents in a multi-channel support system for complex software applications
Baumgartner et al. Scalable web data extraction for online market intelligence
CN109739505B (en) A kind for the treatment of method and apparatus of user interface
CN109471626A (en) Page logic structure, page generation method, page data processing method and device
CN103678135A (en) System and method for achieving cross-process and cross-thread debugging in large-data environment
Song et al. Customizing multi-tenant SaaS by microservices: a reference architecture
CN110442819A (en) Data processing method, device, storage medium and terminal
US20030048296A1 (en) Method & apparatus for enhancing the graphical user interface presented by an application
CN107508787B (en) A kind of task executing method, apparatus and system
CN113271610A (en) Network distribution method and device for door lock equipment, door lock equipment and storage medium
CN113687926A (en) Control method, device and equipment for server asset scanning
CN108595156A (en) A kind of batch processing method and system based on Impala components
US11245794B2 (en) System and method of embedding and launching a form from third-party knowledge content
CN108647087A (en) Realize the reentrant method, apparatus of PHP kernels, server and storage medium
Riteau et al. Bringing elastic mapreduce to scientific clouds
CN100541429C (en) System and method for automatic application development using user guidance
CN117032940B (en) System, method and device for scheduling resources, electronic equipment and storage medium
CN111324814A (en) Control method, device and system of intelligent equipment
CN112988029B (en) Implementation method for starting soft keyboard on login interface

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant