CN108259418A - A kind of system and method for function trusteeship service - Google Patents

A kind of system and method for function trusteeship service Download PDF

Info

Publication number
CN108259418A
CN108259418A CN201611239761.8A CN201611239761A CN108259418A CN 108259418 A CN108259418 A CN 108259418A CN 201611239761 A CN201611239761 A CN 201611239761A CN 108259418 A CN108259418 A CN 108259418A
Authority
CN
China
Prior art keywords
function
depositing
trustship
subelement
treating
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
CN201611239761.8A
Other languages
Chinese (zh)
Other versions
CN108259418B (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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201611239761.8A priority Critical patent/CN108259418B/en
Publication of CN108259418A publication Critical patent/CN108259418A/en
Application granted granted Critical
Publication of CN108259418B publication Critical patent/CN108259418B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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/40Support for services or applications
    • 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/80Responding to QoS

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Stored Programmes (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a kind of method of function trusteeship service, including:Function trustship unit is received comprising after the establishment task requests of depositing function, treats that depositing function creates hosting environment to be described;After the function trustship unit is received comprising described in calling after the service request of depositing function, function calling cell is based upon the hosting environment treated depositing function and created, and treats that depositing function performs the service request, and generates implementing result described in calling.Meanwhile the invention also discloses a kind of systems of function trusteeship service.

Description

A kind of system and method for function trusteeship service
Technical field
The present invention relates to field of cloud calculation more particularly to a kind of system and method for function trusteeship service.
Background technology
The essence of cloud computing be in order to by business and Data Hosting on believable cloud, with by scale effect reduce into This.However, existing most of cloud computing platforms are all by encapsulating service logic as unit of virtual machine or container.But it needs It should be noted that the calculating granularity that trustship is carried out as unit of virtual machine can be excessive, overhead is larger so that calculated performance drops It is low, because in virtual machine other than comprising service logic, also run some unnecessary processes and Client OS Deng;Trustship is carried out as unit of container, and interfering with each other between container can be introduced, influences tenant on host on the same stage or user Application performance is unable to reach the QoS (Quality of Service, service quality) that user specifies.Meanwhile existing cloud computing Platform is also all that charging is carried out as unit of virtual machine and container, and the Section Overhead in addition to actual traffic load is flat by using Platform side after undertaking, can aggravate the cost using platform side.After depositing function platform, can according to practical call number or Practical cpu usage carries out charging, and expense is greatly reduced.However, in the prior art, the solution of the problem is all used Source mechanism is closed, can not realize efficient and economic trusteeship service.
Invention content
In view of this, an embodiment of the present invention is intended to provide a kind of system and method for function trusteeship service, it is capable of providing height Effect, economic function trusteeship service.
In order to achieve the above objectives, the technical proposal of the invention is realized in this way:
An embodiment of the present invention provides a kind of system of function trusteeship service, the system comprises:Function trustship unit, letter Number call unit;Wherein,
The function trustship unit is included for receiving after the establishment task requests of depositing function, waits to hold in the palm to be described Pipe function creation hosting environment;
The function calling cell, for work as the function trustship unit receive comprising call described in treat depositing function After service request, it is based upon the hosting environment treated depositing function and created, treats that depositing function performs the service described in calling Request, and generate implementing result.
In said program, the function trustship unit, including:First function trustship subelement, second function trustship are single Member, third function trustship subelement, the 4th function trustship subelement, the 5th function trustship subelement;Wherein,
The first function trustship subelement, for receiving being asked comprising the establishment task for treating depositing function for user's submission It asks, for the information treated depositing function allocation identification, and depositing function is treated described in storage;
The second function trustship subelement, for waiting to hold in the palm according to storing in the first function trustship subelement The information of pipe function treats that depositing function makes mirror image, and treat that the mark of depositing function treats trustship with described described in record to be described Correspondence between the mirror image of function;
The third function trustship subelement, for treating that depositing function distributes calling interface parameter, and by described in for described in Treat that the calling interface parameter of depositing function and mark are sent to the 5th function trustship subelement;
The 4th function trustship subelement for treating depositing function assignment messages channel for described in, and is treated described in record Correspondence between the message channel of depositing function and the calling interface parameter for treating depositing function;
The 5th function trustship subelement, for receiving and storing described in the third function trustship subelement transmission Treat the calling interface parameter and mark of depositing function.
In said program, the function calling cell, including:First function calls subelement, second function to call son single Member;Wherein,
The 5th function trustship subelement is additionally operable to receive the service request comprising depositing function is treated described in calling, will The service request is packaged into message, and sends the message to corresponding with the calling interface parameter for treating depositing function In message channel;Include the calling interface parameter for treating depositing function in the service request;
The first function calls subelement, for from message corresponding with the calling interface parameter for treating depositing function The message is obtained in channel and is obtained from the 5th function trustship subelement and is connect with the calling for treating depositing function The corresponding mark of mouth parameter, and the message and the mark for treating depositing function are sent to second function and call subelement;
The second function calls subelement, for according to the message and the mark for treating depositing function received Know, treat that depositing function performs the service request, and generates implementing result described in calling.
In said program, the information that depositing function is treated described in the first function trustship subelement storage is:Described in storage It treats the mark of depositing function and described creates the address of the code snippet for treating depositing function included in task requests;
The second function trustship subelement, is specifically used for:It is treated described in being obtained from the first function trustship subelement The mark of depositing function and the address of code snippet treat the address of the code snippet of depositing function described in parsing, are tied according to parsing Fruit treats the mirror image of depositing function described in making, and treat described in recording depositing function mark and the mirror image for treating depositing function it Between correspondence.
In said program, the second function calls subelement, is specifically used for:Depositing function is treated according to receiving Mark, obtained from the second function trustship subelement described in treat the mirror image of depositing function;Depositing function is treated according to described Mirror image create container, performed in the container described in treat the code snippet of depositing function, generate implementing result.
The embodiment of the present invention additionally provides a kind of method of function trusteeship service, the method includes:
Function trustship unit is received comprising after the establishment task requests of depositing function, treats that depositing function creates to be described Hosting environment;
After the function trustship unit is received comprising described in calling after the service request of depositing function, function call list Member is based upon the hosting environment treated depositing function and created, and treats that depositing function performs the service request, and raw described in calling Into implementing result.
In said program, the function trustship unit, including:First function trustship subelement, second function trustship are single Member, third function trustship subelement, the 4th function trustship subelement, the 5th function trustship subelement;
The function trustship unit is received comprising after the establishment task requests of depositing function, and depositing function is treated to be described Hosting environment is created, including:
What first function trustship subelement reception user submitted includes the establishment task requests for treating depositing function, is treated to be described Depositing function allocation identification, and the information of depositing function is treated described in storage;
Second function trustship subelement treats the letter of depositing function according to storing the first function trustship subelement Breath treats that depositing function makes mirror image, and the mark of depositing function and the mirror image for treating depositing function are treated described in record to be described Between correspondence;
Third function trustship subelement treats that depositing function distributes calling interface parameter, and treats depositing function by described to be described Calling interface parameter and mark be sent to the 5th function trustship subelement;
4th function trustship subelement treats depositing function assignment messages channel, and treat depositing function described in record to be described Correspondence between message channel and the calling interface parameter for treating depositing function;
5th function trustship subelement receives and stores the described of third function trustship subelement transmission and treats trustship letter Several calling interface parameters and mark.
In said program, the function calling cell, including:First function calls subelement, second function to call son single Member;
It is described when the function trustship unit receive comprising call described in after the service request of depositing function after, function tune It is based upon the hosting environment treated depositing function and created with unit, treats that depositing function performs the service request described in calling, And implementing result is generated, including:
5th function trustship subelement is received comprising the service request that depositing function is treated described in calling, by the service request Message is packaged into, and is sent the message in message channel corresponding with the calling interface parameter for treating depositing function; Include the calling interface parameter for treating depositing function in the service request;
First function calls subelement to be obtained from message channel corresponding with the calling interface parameter for treating depositing function It takes the message and is obtained and the calling interface parameter pair for treating depositing function from the 5th function trustship subelement The mark answered, and the message and the mark for treating depositing function are sent to second function and call subelement;
Second function calls subelement according to the message and the mark for treating depositing function received, described in calling Treat that depositing function performs the service request, and generates implementing result.
In said program, the information that depositing function is treated described in the storage is:Treated described in storage the mark of depositing function with And the address of the code snippet for treating depositing function included in the establishment task requests;
The second function trustship subelement treats trustship letter according to being stored in the first function trustship subelement Several information treats that depositing function makes mirror image, and treat that the mark of depositing function treats depositing function with described described in record to be described Mirror image between correspondence, including:
Second function trustship subelement treats the mark of depositing function described in being obtained from the first function trustship subelement With the address of code snippet, the address of the code snippet of depositing function is treated described in parsing, waits to hold in the palm according to making analysis result The mirror image of pipe function, and the correspondence between the mark of depositing function and the mirror image for treating depositing function is treated described in record.
In said program, the second function calls subelement according to the message that receives and described treats depositing function Mark, treat that depositing function performs the service request, and generates implementing result described in calling, including:
Second function calling subelement treats the mark of depositing function according to receiving, from the second function trustship The mirror image of depositing function is treated described in being obtained in subelement;Container is created according to the mirror image for treating depositing function, in the container The code snippet of depositing function is treated described in interior execution, generates implementing result.
The system and method for function trusteeship service provided in an embodiment of the present invention, function trustship unit receive to include and wait to hold in the palm After the establishment task requests of pipe function, treat that depositing function creates hosting environment to be described;When the function trustship unit receives Comprising after the service request of depositing function, function calling cell is based upon the trustship treated depositing function and created described in calling Environment treats that depositing function performs the service request, and generates implementing result described in calling.As it can be seen that the embodiment of the present invention is to open It based on source software, is realized by container technique and provides efficient, economic function trusteeship service to the user, i.e., by for smaller The function and code snippet of granularity provide at runtime, call on demand, by call number or actual run time charging Mode so that function trusteeship service is more economically and efficient.
In addition, by the code of depositing function, can provide to the user based on the realization pair of the various ways such as http, event The calling of the function.
Description of the drawings
Fig. 1 is the composition structure diagram of the system of one function trusteeship service of the embodiment of the present invention;
Fig. 2 is the realization flow diagram of the method for one function trusteeship service of the embodiment of the present invention;
Fig. 3 is the concrete composition structure diagram of the system of two function trusteeship service of the embodiment of the present invention;
Fig. 4 is the schematic diagram that function manages sequential in the embodiment of the present invention two;
Fig. 5 is the schematic diagram of user's access function sequential in the embodiment of the present invention two.
Specific embodiment
Below in conjunction with the accompanying drawings and specific embodiment the present invention is further described in more detail.
Embodiment one
Fig. 1 is the composition structure diagram of the system of one function trusteeship service of the embodiment of the present invention, which includes:Function Trustship unit 11, function calling cell 12;Wherein,
The function trustship unit 11 is included for receiving after the establishment task requests of depositing function, is treated to be described Depositing function creates hosting environment;
The function calling cell 12, for work as the function trustship unit receive comprising call described in treat depositing function Service request after, be based upon the hosting environment treated depositing function and created, treat that depositing function performs the clothes described in calling Business request, and generate implementing result.
Here, the function trustship unit 11 is after depositing function creates hosting environment, so that the function call list Member 12 can be to treat the support that depositing function creates based on the function trustship unit 11 when needing described in calling when depositing function It realizes quickly to the calling for treating depositing function in pipe ring border.
The function trustship unit 11, including:First function trustship subelement 110, second function trustship subelement 111, Third function trustship subelement 112, the 4th function trustship subelement 113, the 5th function trustship subelement 114;Wherein,
The first function trustship subelement 110, receive user's submission includes the establishment task requests for treating depositing function, For the information treated depositing function allocation identification, and depositing function is treated described in storage;
The second function trustship subelement 111, for according to the institute stored in the first function trustship subelement 110 State the information for treating depositing function, treat that depositing function makes mirror image to be described, and treat described in recording the mark of depositing function with it is described Treat the correspondence between the mirror image of depositing function;
The third function trustship subelement 112, for treating that depositing function distributes calling interface parameter, and by institute for described in It states and treats that the calling interface parameter of depositing function and mark are sent to the 5th function trustship subelement 114;
The 4th function trustship subelement 113, for treating depositing function assignment messages channel for described in, and described in record Treat the correspondence between the message channel of depositing function and the calling interface parameter for treating depositing function;
The 5th function trustship subelement 114 sends for receiving and storing the third function trustship subelement 112 The calling interface parameter and mark for treating depositing function.
Wherein, the first function trustship subelement 110 stores the information for treating depositing function and is:It waits to hold in the palm described in storage The address of the code snippet for treating depositing function included in the mark of pipe function and the establishment task requests.
Here, the mark for treating depositing function is for representing the coding for treating depositing function, i.e. any one function All there are one distinguished codings;The coding can be used for determining the identity of function;According to the code for treating depositing function The address of segment is, it can be achieved that the calling for treating depositing function.
Here, the first function trustship subelement 110 can be additionally used in for it is described treat depositing function partition function name and The function name for treating depositing function is treated that the sub-information in the information of depositing function is stored as described in;Certainly, if institute It states to create and includes the function name for treating depositing function in task requests, then the first function trustship subelement 110 does not have to Depositing function partition function name is treated to be described.
Here, it is described to create the authorization message that also may include there is the code snippet for treating depositing function in task requests And/or the dependence library list for treating depositing function;Whether the authorization message can be as allowing to the depositing function for the treatment of The examination requirements that code snippet is modified, i.e., to it is described when the code snippet of depositing function is modified it is necessary to have The authorization message just allows to change the code snippet;It is described to rely on library list for determining the fortune for treating depositing function Row environment, i.e., only described function trustship unit 11 meet dependence library row for the hosting environment for treating that depositing function creates During the requirement of table, the function calling cell 12 is just allowed to call and described treats depositing function;The authorization message and/or dependence library List can also treat that the sub-information in the information of depositing function is stored to the first function trustship subelement 110 as described in.
The second function trustship subelement 111, is specifically used for:
The mark of depositing function and the ground of code snippet are treated described in being obtained from the first function trustship subelement 110 Location treats the address of the code snippet of depositing function described in parsing, and the mirror image of depositing function is treated according to making analysis result, and The correspondence between the mark of depositing function and the mirror image for treating depositing function is treated described in record.
Here, the mirror image will be used in subsequent processing be it is described treat that depositing function creates container, to be performed in container The code snippet for treating depositing function is realized to the calling for treating depositing function;Depositing function is treated described in the record Mark and the mirror image for treating depositing function between correspondence, available for treating the mark of depositing function according to The mirror image of depositing function is treated described in acquisition.
Here, the 5th function trustship subelement 114 be used for as to it is described treat depositing function calling access point, because This, the third function trustship subelement 112 after depositing function distributes calling interface parameter, needs to wait to hold in the palm by described to be described The calling interface parameter and mark of pipe function are sent to the 5th function trustship subelement 114, so that the 5th function support Unit of pipe 114 is being received comprising described after the call request of the calling interface parameter of depositing function, can be according to described Treat that the mark of depositing function is realized quickly to the calling for treating depositing function.
The function calling cell 12, including:First function calls subelement 120, second function to call subelement 121; Wherein,
The 5th function trustship subelement 114 is additionally operable to receive the service request comprising depositing function is treated described in calling, The service request is packaged into message, and is sent the message to corresponding with the calling interface parameter for treating depositing function Message channel in;Include the calling interface parameter for treating depositing function in the service request;
The first function calls subelement 120, for from corresponding with the calling interface parameter for treating depositing function The message is obtained in message channel and is obtained from the 5th function trustship subelement 114 and treats depositing function with described The corresponding mark of calling interface parameter, and by the message and the mark for treating depositing function be sent to second function call Subelement 121;
The second function calls subelement 121, for according to the message that receives and the depositing function for the treatment of It identifies, treats that depositing function performs the service request, and generates implementing result described in calling.
Here, the service request that the 5th function trustship subelement 114 receives can be a variety of with http, event etc. Mode exists;The calling interface parameter for including called function in need is needed in the service request, to inform the described 5th 114 which function of function trustship subelement is to need called function.
The second function calls subelement 121, is specifically used for:The mark of depositing function is treated according to receiving, The mirror image of depositing function is treated described in being obtained from the second function trustship subelement 111;According to the mirror for treating depositing function As creating container, the code snippet of depositing function is treated described in execution in the container, generates implementing result.
Here, the second function calls subelement 121 to receive the institute that the first function calls subelement 120 to send It states after the mark of depositing function, obtains the second function trustship subelement 111 as the mirror image treated depositing function and made; Then, it based on the mirror image, is created by container techniques such as docker, lxc and treats the corresponding container of depositing function with described;So Afterwards, by mono- subprocess of fork, the subprocess is made to pass through the container techniques such as docker, lxc and enter and treats depositing function with described Inside corresponding container, to treat the code snippet of depositing function described in the execution in the container, implementing result is generated, i.e. generation is adjusted With the result treated depositing function and respond the service request.
In practical applications, the first function trustship subelement 110, second function trustship subelement 111, third function Trustship subelement 112, the 4th function trustship subelement 113, the 5th function trustship subelement 114, first function call subelement 120th, second function calls subelement 121 that can be believed by the central processing unit (CPU), microprocessor (MPU), number for being located at terminal The realizations such as number processor (DSP) or field programmable gate array (FPGA).
Based on the system of above-mentioned function trusteeship service, Fig. 2 is the reality of the method for one function trusteeship service of the embodiment of the present invention Existing flow diagram, this method include:
Step 101:Function trustship unit is received comprising after the establishment task requests of depositing function, and trustship is treated to be described Function creation hosting environment;
Here, the function trustship unit is after depositing function creates hosting environment, so that the function calling cell Can be to treat the hosting environment that depositing function creates based on the function trustship unit when needing described in calling when depositing function It realizes quickly to the calling for treating depositing function.
The function trustship unit, including:First function trustship subelement, second function trustship subelement, third function Trustship subelement, the 4th function trustship subelement, the 5th function trustship subelement;
The function trustship unit is received comprising after the establishment task requests of depositing function, and depositing function is treated to be described Hosting environment is created, including:
What first function trustship subelement reception user submitted includes the establishment task requests for treating depositing function, is treated to be described Depositing function allocation identification, and the information of depositing function is treated described in storage;
Second function trustship subelement treats the letter of depositing function according to storing the first function trustship subelement Breath treats that depositing function makes mirror image, and the mark of depositing function and the mirror image for treating depositing function are treated described in record to be described Between correspondence;
Third function trustship subelement treats that depositing function distributes calling interface parameter, and treats depositing function by described to be described Calling interface parameter and mark be sent to the 5th function trustship subelement;
4th function trustship subelement treats depositing function assignment messages channel, and treat depositing function described in record to be described Correspondence between message channel and the calling interface parameter for treating depositing function;
5th function trustship subelement receives and stores the described of third function trustship subelement transmission and treats trustship letter Several calling interface parameters and mark.
Wherein, the information for depositing function being treated described in first function trustship subelement storage is:Trustship is treated described in storage The address of the code snippet for treating depositing function included in the mark of function and the establishment task requests.
Here, the mark for treating depositing function is for representing the coding for treating depositing function, i.e. any one function All there are one distinguished codings;The coding can be used for determining the identity of function;According to the code for treating depositing function The address of segment is, it can be achieved that the calling for treating depositing function.
Here, the first function trustship subelement can also treat depositing function partition function name and by described in be described Treat that the function name of depositing function treats that the sub-information in the information of depositing function is stored as described in;Certainly, if the establishment Include the function name for treating depositing function in task requests, then the first function trustship subelement does not have to wait to hold in the palm to be described Pipe function partition function name.
Here, it is described to create the authorization message that also may include there is the code snippet for treating depositing function in task requests And/or the dependence library list for treating depositing function;Whether the authorization message can be as allowing to the depositing function for the treatment of The examination requirements that code snippet is modified, i.e., to it is described when the code snippet of depositing function is modified it is necessary to have The authorization message just allows to change the code snippet;It is described to rely on library list for determining the fortune for treating depositing function Row environment, i.e., only described function trustship unit meet the dependence library list for the hosting environment for treating that depositing function creates Requirement when, just allow the function calling cell call described in treat depositing function;The authorization message and/or dependence library list Also it can treat that the sub-information in the information of depositing function is stored to the first function trustship subelement as described in.
The second function trustship subelement treats trustship letter according to being stored in the first function trustship subelement Several information treats that depositing function makes mirror image, and treat that the mark of depositing function treats depositing function with described described in record to be described Mirror image between correspondence, including:
Second function trustship subelement treats the mark of depositing function described in being obtained from the first function trustship subelement With the address of code snippet, the address of the code snippet of depositing function is treated described in parsing, waits to hold in the palm according to making analysis result The mirror image of pipe function, and the correspondence between the mark of depositing function and the mirror image for treating depositing function is treated described in record.
Here, the mirror image will be used in subsequent processing be it is described treat that depositing function creates container, to be performed in container The code snippet for treating depositing function is realized to the calling for treating depositing function;Depositing function is treated described in the record Mark and the mirror image for treating depositing function between correspondence, available for treating the mark of depositing function according to The mirror image of depositing function is treated described in acquisition.
Here, the 5th function trustship subelement as to it is described treat depositing function call access point, it is therefore, described Third function trustship subelement after depositing function distributes calling interface parameter, is needed the tune for treating depositing function to be described The 5th function trustship subelement is sent to interface parameters and mark, so that the 5th function trustship subelement is receiving To comprising described, after the call request of the calling interface parameter of depositing function, the mark that can treat depositing function according to described is real Now quickly to the calling for treating depositing function.
Step 102:After the function trustship unit is received comprising described in calling after the service request of depositing function, letter Number call unit is based upon the hosting environment treated depositing function and created, and treats that depositing function performs the service and asks described in calling It asks, and generates implementing result.
The function calling cell, including:First function calls subelement, second function to call subelement;It is described to work as institute Function trustship unit is stated to receive comprising after the service request of depositing function, function calling cell is based upon described described in calling It treats the hosting environment that depositing function creates, treats that depositing function performs the service request, and generates implementing result described in calling, wrap It includes:
5th function trustship subelement is received comprising the service request that depositing function is treated described in calling, by the service request Message is packaged into, and is sent the message in message channel corresponding with the calling interface parameter for treating depositing function; Include the calling interface parameter for treating depositing function in the service request;
First function calls subelement to be obtained from message channel corresponding with the calling interface parameter for treating depositing function It takes the message and is obtained and the calling interface parameter pair for treating depositing function from the 5th function trustship subelement The mark answered, and the message and the mark for treating depositing function are sent to second function and call subelement;
Second function calls subelement according to the message and the mark for treating depositing function received, described in calling Treat that depositing function performs the service request, and generates implementing result.
Here, the service request that the 5th function trustship subelement receives can be with various ways such as http, event In the presence of;The calling interface parameter for including called function in need is needed in the service request, to inform the 5th function Which function of trustship subelement is to need called function.
The second function calls subelement to be called according to the message and the mark for treating depositing function received It is described to treat that depositing function performs the service request, and generates implementing result, including:
Second function calling subelement treats the mark of depositing function according to receiving, from the second function trustship The mirror image of depositing function is treated described in being obtained in subelement;Container is created according to the mirror image for treating depositing function, in the container The code snippet of depositing function is treated described in interior execution, generates implementing result.
Here, the second function calls subelement to receive the described of first function calling subelement transmission and waits to hold in the palm After the mark of pipe function, the second function trustship subelement is obtained as the mirror image treated depositing function and made;Then, it is based on The mirror image is created by container techniques such as docker, lxc and treats the corresponding container of depositing function with described;Then, pass through fork One subprocess makes the subprocess pass through the container techniques such as docker, lxc and enter and is treated in the corresponding container of depositing function with described Portion to treat the code snippet of depositing function described in the execution in the container, generates implementing result, i.e., treats trustship described in generation calling Function responds the result of the service request.
Embodiment two
The embodiment of the present invention one is described further below by a specific example, Fig. 3 is the embodiment of the present invention two The concrete composition structure diagram of the system of function trusteeship service, the system mainly include:api-server、endpoint The parts such as scheduler, image builder, task scheduler, channel allocator, gw, executor;Its In,
api-server:It is responsible for receiving function (function) request submitted, which, which contains, obtains needed for function URL and access the function it is required cognition password (token) and rely on library list;Wherein, URL is function code piece The address of section, token is the authorization message of access function code, relies on the running environment that library list is used to determine the function, i.e., When the hosting environment only for the function prepared meets dependence library list, just allow to receive the request;In practical applications, it relies on Library list is optional, i.e. the content of the function is possible to include to rely on library list, it is also possible to not comprising dependence library list; The function can be added in the functions tables of database after function is received, that is, exist by api-server A new function is created in functions tables, and should for the function partition function name (name) and mark (id), storage The information such as the token and URL of function;
endpoint-scheduler:It is responsible for monitoring functions tables, once functions tables change, such as when When increasing a new function in functions tables, then endpoint-scheduler will be created in endpoints tables A line records, as function distribution endpoint and name, id, endpoint three for recording the function Between correspondence;And endpoint corresponding with the function is assigned on specific gw nodes, gw nodes are one The id of the node of a business drainage, corresponding specific path and function;
image-builder:It is responsible for monitoring functions tables, once functions tables change, such as when When increasing a new function in functions tables, then image-builder can be obtained from functions tables is somebody's turn to do The information of function parses the URL of the function, and the corresponding mirror images of the function are made on mirror image server (image);After being made to the image of the function, image-builder will be recorded in images lists should Correspondence between function and the image of the function, for example record name, id, image tri- of the function Correspondence between person;
channel-allocator:It is responsible for monitoring functions tables, once functions tables change, such as when When increasing a new function in functions tables, then channel-allocator is to be somebody's turn to do in channels tables Function distributes a message channel (channel), and records between the function and the channel of the function Correspondence, for example record the correspondence between name, id, endpoint, channel of the function;
gw:It is responsible for monitoring endpoints tables and channels tables, if finding to have in endpoints tables corresponding with gw Information, as increased record of a line in relation to new function in endpoints tables, then update the endpoints on gw The correspondence of table and function, will the endpoint of the function store in the endpoints tables to gw, and remember Record the information such as id, name of the function;Here, gw nodes are the nodes that practical receiver function calls;If gw is received The http request of call function under some path, such as ip:The request can be then packaged into message hair by port/adam/func1 It is sent in message queue in channel corresponding with the request;
task-scheduler:It is responsible for specifically the request of the call functions such as http being distributed to the component performed on node; Every message that gw is generated is all corresponding there are one task (task), the message in task-scheduler monitoring information queues, and The corresponding task of the message is assigned in calculate node by certain allocation algorithm, record should in schedules tables task;Only record a line record, allocation algorithm can make according to CPU usage and memory in the database for distribution herein It is scheduled with rate;
There are 2 components in calculate node, one is executor, is responsible for monitoring schedules tables, once it finds When having the distributing to this node of the task in schedules tables, executor will create container on this node;Here, container Create can the image based on function, by using the technologies such as docker, lxc realize;Create container need mirror image be The image of function can be obtained by fetcher from images store, and the mirror image in images store is Image-builder is responsible for what is created;Meanwhile executor will mono- subprocess of fork, subprocess passes through the appearances such as docker Device technology enters inside container, performs the code snippet of function, to realize the calling of function.
In the present embodiment, user is uploaded by api-server after depositing function request, and system is uploaded according to user It treats depositing function, treats that depositing function prepares hosting environment for this, trustship is treated including making the mirror image for treating depositing function, creating this The endpoint of function, the message channel for treating depositing function etc. is created, the trustship ring for treating depositing function is got out in system Behind border, user can obtain the implementing result that this is called to treat depositing function response service request by accessing gw.
Based on above system, function manages the schematic diagram of sequential as shown in figure 4, the function management in the embodiment of the present invention two Sequential includes:
Step 201:User submits function creation task requests to api-server;
Here, the address of function code segment is included in the function creation task requests, access function code is awarded Weigh the dependence library list of information, the running environment for determining function.
Step 202:Api-server receives the function creation task requests that user submits;
Specifically, api-server receives the function creation task requests that user is submitted by document form.
Step 203:Image-builder analytic functions, and make mirror image for function;
Specifically, the address of image-builder analytical functions code snippet, and the function is made on mirror image server Mirror image.
Step 204:Channel-allocator is function assignment messages channel;
Specifically, channel-allocator is function assignment messages channel, so that gw can will call appointing for the function Business is transmitted to task-scheduler by the message channel of the function.
Step 205:Endpoint-scheduler creates function and the relationship of endpoint in the database;
Specifically, endpoint-scheduler creates the corresponding endpoint of and function in the database, and records and be somebody's turn to do The correspondence of function and the endpoint, allows the user to through endpoint call functions.
Step 206:Gw updates the correspondence of endpoint and function, and the reverse proxy being located on gw is configured, and increases Corresponding endpoint paths.
Specifically, gw store the function and endpoint-scheduler create it is corresponding with the function Endpoint, to realize all information that the function can be obtained according to the endpoint of the function.
The schematic diagram of user's access function sequential is as shown in figure 5, user's access function sequential in the embodiment of the present invention two Including:
Step 301:User sends the request of access function to gw;
Here, the endpoint of the function of access in need is included in the request.
Step 302:The request of the access function is packaged into message by gw, and is transmitted in message queue;
Specifically, after gw receives the request for the access function that the user sends, the request of the access function is sealed Message is dressed up, and is disappeared according to the endpoint of the function by corresponding with the function in the message transmission to message queue It ceases in channel.
Step 303:Task-scheduler performs node for the corresponding task distribution of the message;
Specifically, after task-scheduler gets the message from message queue, it is corresponding to obtain the message Task, and node is performed for the corresponding task distribution of the message, to perform the node execution task.
Step 304:Executor is the task creation container, performs the code of the function;
Specifically, executor is based on the mirror image that image-builder is function making, using docker, lxc etc. Technology creates container, to perform the code of the function in container, generates the implementing result that the function responds the request.
Step 305:Executor is returned the result in message queue;
Specifically, executor returns to the implementing result generated in step 304 in message queue.
Step 306:Gw obtains the result from message queue;
Specifically, gw obtains the result that function in trust responds the request from message queue.
Step 307:Gw returns to the result to user.
Specifically, the result is returned to user by gw, to inform that user calls the knot of the function response request Fruit.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.It is all All any modification, equivalent and improvement made within the spirit and scope of the present invention etc. are all contained in the protection model of the present invention Within enclosing.

Claims (10)

1. a kind of system of function trusteeship service, which is characterized in that the system comprises:Function trustship unit, function call list Member;Wherein,
The function trustship unit is included for receiving after the establishment task requests of depositing function, and trustship letter is treated to be described Number creates hosting environment;
The function calling cell is received for working as the function trustship unit comprising the service that depositing function is treated described in calling After request, it is based upon the hosting environment treated depositing function and created, treats that depositing function performs the service request described in calling, And generate implementing result.
2. system according to claim 1, which is characterized in that the function trustship unit, including:First function trustship Unit, second function trustship subelement, third function trustship subelement, the 4th function trustship subelement, the 5th function trustship Unit;Wherein,
The first function trustship subelement, for receive user's submission comprising the establishment task requests of depositing function are treated, be It is described to treat depositing function allocation identification, and the information of depositing function is treated described in storage;
The second function trustship subelement, for treating trustship letter according to being stored in the first function trustship subelement Several information treats that depositing function makes mirror image, and treat that the mark of depositing function treats depositing function with described described in record to be described Mirror image between correspondence;
The third function trustship subelement, for treating that depositing function distributes calling interface parameter, and waits to hold in the palm by described for described in The calling interface parameter and mark of pipe function are sent to the 5th function trustship subelement;
The 4th function trustship subelement for treating depositing function assignment messages channel for described in, and treats trustship described in record Correspondence between the message channel of function and the calling interface parameter for treating depositing function;
The 5th function trustship subelement is waited to hold in the palm for receiving and storing described in the third function trustship subelement transmission The calling interface parameter and mark of pipe function.
3. system according to claim 2, which is characterized in that the function calling cell, including:First function calls son Unit, second function call subelement;Wherein,
The 5th function trustship subelement is additionally operable to receive the service request comprising depositing function is treated described in calling, by described in Service request is packaged into message, and sends the message to message corresponding with the calling interface parameter for treating depositing function In channel;Include the calling interface parameter for treating depositing function in the service request;
The first function calls subelement, for from message channel corresponding with the calling interface parameter for treating depositing function It is middle to obtain the message and obtained from the 5th function trustship subelement and the calling interface ginseng for treating depositing function The corresponding mark of number, and the message and the mark for treating depositing function are sent to second function and call subelement;
The second function calls subelement, for according to the message and the mark for treating depositing function received, adjusting Treat that depositing function performs the service request, and generates implementing result with described.
4. system according to claim 2, which is characterized in that
The information that depositing function is treated described in first function trustship subelement storage is:The mark of depositing function is treated described in storage And the address of the code snippet for treating depositing function included in the establishment task requests;
The second function trustship subelement, is specifically used for:
The mark of depositing function and the address of code snippet are treated described in being obtained from the first function trustship subelement, parse institute The address for the code snippet for treating depositing function is stated, the mirror image of depositing function is treated according to making analysis result, and described in record Treat the correspondence between the mark of depositing function and the mirror image for treating depositing function.
5. system according to claim 3, which is characterized in that
The second function calls subelement, is specifically used for:The mark of depositing function is treated according to receiving, from described The mirror image of depositing function is treated described in being obtained in two function trustship subelements;Container is created according to the mirror image for treating depositing function, The code snippet of depositing function is treated described in being performed in the container, generates implementing result.
A kind of 6. method of function trusteeship service, which is characterized in that the method includes:
Function trustship unit is received comprising after the establishment task requests of depositing function, treats that depositing function creates trustship to be described Environment;
After the function trustship unit is received comprising described in calling after the service request of depositing function, function calling cell base In for the hosting environment treated depositing function and created, treat that depositing function performs the service request, and generates and hold described in calling Row result.
7. according to the method described in claim 6, it is characterized in that, the function trustship unit, including:First function trustship Unit, second function trustship subelement, third function trustship subelement, the 4th function trustship subelement, the 5th function trustship Unit;The function trustship unit is received comprising after the establishment task requests of depositing function, treats that depositing function is created to be described Hosting environment is built, including:
What first function trustship subelement reception user submitted includes the establishment task requests for treating depositing function, and trustship is treated to be described Function allocation identification, and the information of depositing function is treated described in storage;
Second function trustship subelement treats the information of depositing function according to storing the first function trustship subelement, is It is described to treat that depositing function makes mirror image, and is treated between the mark of depositing function and the mirror image for treating depositing function described in record Correspondence;
Third function trustship subelement treats that depositing function distributes calling interface parameter to be described, and by the tune for treating depositing function The 5th function trustship subelement is sent to interface parameters and mark;
4th function trustship subelement is the message treated depositing function assignment messages channel, and depositing function is treated described in record Correspondence between channel and the calling interface parameter for treating depositing function;
5th function trustship subelement receives and stores the described of third function trustship subelement transmission and treats depositing function Calling interface parameter and mark.
8. according to the method described in claim 6, it is characterized in that, the function calling cell, including:First function calls son Unit, second function call subelement;It is described to treat depositing function described in calling when the function trustship unit receives to include After service request, function calling cell is based upon the hosting environment treated depositing function and created, and depositing function is treated described in calling The service request is performed, and generates implementing result, including:
5th function trustship subelement is received comprising the service request that depositing function is treated described in calling, and the service request is encapsulated Into message, and send the message in message channel corresponding with the calling interface parameter for treating depositing function;It is described Include the calling interface parameter for treating depositing function in service request;
First function calls subelement to obtain institute from message channel corresponding with the calling interface parameter for treating depositing function It states message and is obtained from the 5th function trustship subelement corresponding with the calling interface parameter for treating depositing function Mark, and the message and the mark for treating depositing function are sent to second function and call subelement;
Second function calls subelement to wait to hold in the palm described in calling according to the message and the mark for treating depositing function received Pipe function performs the service request, and generates implementing result.
9. according to the method described in claim 6, it is characterized in that, the information that depositing function is treated described in the storage is:Storage The ground of the code snippet for treating depositing function included in the mark for treating depositing function and the establishment task requests Location;
The second function trustship subelement treats depositing function according to being stored in the first function trustship subelement Information treats that depositing function makes mirror image, and the mark of depositing function and the mirror for treating depositing function are treated described in record to be described Correspondence as between, including:
Second function trustship subelement treats mark and the generation of depositing function described in being obtained from the first function trustship subelement The address of chip segment treats the address of the code snippet of depositing function described in parsing, trustship letter is treated according to making analysis result Several mirror images, and the correspondence between the mark of depositing function and the mirror image for treating depositing function is treated described in record.
10. the method according to the description of claim 7 is characterized in that the second function calls subelement according to receiving The message and the mark for treating depositing function treat that depositing function performs the service request, and generates execution described in calling As a result, including:
Second function calling subelement treats the mark of depositing function according to receiving, single from second function trustship The mirror image of depositing function is treated described in being obtained in member;Container is created according to the mirror image for treating depositing function, is held in the container The code snippet of depositing function is treated described in row, generates implementing result.
CN201611239761.8A 2016-12-28 2016-12-28 System and method for function hosting service Active CN108259418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611239761.8A CN108259418B (en) 2016-12-28 2016-12-28 System and method for function hosting service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611239761.8A CN108259418B (en) 2016-12-28 2016-12-28 System and method for function hosting service

Publications (2)

Publication Number Publication Date
CN108259418A true CN108259418A (en) 2018-07-06
CN108259418B CN108259418B (en) 2021-08-24

Family

ID=62720366

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611239761.8A Active CN108259418B (en) 2016-12-28 2016-12-28 System and method for function hosting service

Country Status (1)

Country Link
CN (1) CN108259418B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111240806A (en) * 2020-01-14 2020-06-05 南京邮电大学 Distributed container mirror image construction scheduling system and method
CN111475235A (en) * 2020-04-13 2020-07-31 北京字节跳动网络技术有限公司 Acceleration method, device and equipment for function computation cold start and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826004A (en) * 2009-03-02 2010-09-08 上海科泰世纪科技有限公司 Method for mandating functions by Applet
CN102221994A (en) * 2010-04-19 2011-10-19 微软公司 Intermediate language support for change resilience
CN102662815A (en) * 2012-03-12 2012-09-12 苏州萃智新技术开发有限公司 Cloud computing supervision and management system
CN104836850A (en) * 2015-04-16 2015-08-12 华为技术有限公司 Instance node management method and management equipment
CN105072115A (en) * 2015-08-12 2015-11-18 国家电网公司 Information system invasion detection method based on Docker virtualization
CN105245373A (en) * 2015-10-12 2016-01-13 天津市普迅电力信息技术有限公司 Construction and operation method of container cloud platform system
US20160350105A1 (en) * 2015-05-27 2016-12-01 Runnable Inc. Automatic communications graphing for a source application

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101826004A (en) * 2009-03-02 2010-09-08 上海科泰世纪科技有限公司 Method for mandating functions by Applet
CN102221994A (en) * 2010-04-19 2011-10-19 微软公司 Intermediate language support for change resilience
CN102662815A (en) * 2012-03-12 2012-09-12 苏州萃智新技术开发有限公司 Cloud computing supervision and management system
CN104836850A (en) * 2015-04-16 2015-08-12 华为技术有限公司 Instance node management method and management equipment
US20160350105A1 (en) * 2015-05-27 2016-12-01 Runnable Inc. Automatic communications graphing for a source application
CN105072115A (en) * 2015-08-12 2015-11-18 国家电网公司 Information system invasion detection method based on Docker virtualization
CN105245373A (en) * 2015-10-12 2016-01-13 天津市普迅电力信息技术有限公司 Construction and operation method of container cloud platform system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SCORPION: "阿里云函数计算-事件驱动的serverless计算平台", 《HTTPS://DEVELOPER.ALIYUN.COM/ARTICLE/60966》 *
陈天: "谈谈AWS Lambda和severless architecture", 《HTTPS://ZHUANLAN.ZHIHU.COM/P/20297696》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111240806A (en) * 2020-01-14 2020-06-05 南京邮电大学 Distributed container mirror image construction scheduling system and method
CN111475235A (en) * 2020-04-13 2020-07-31 北京字节跳动网络技术有限公司 Acceleration method, device and equipment for function computation cold start and storage medium
CN111475235B (en) * 2020-04-13 2023-09-12 北京字节跳动网络技术有限公司 Acceleration method, device, equipment and storage medium for function calculation cold start

Also Published As

Publication number Publication date
CN108259418B (en) 2021-08-24

Similar Documents

Publication Publication Date Title
CN109672612A (en) API gateway system
CN103384237B (en) Method for sharing IaaS cloud account, shared platform and network device
WO2018130163A1 (en) Scheduling method and device for mobile cloud computing platform
Nguyen et al. ElasticFog: Elastic resource provisioning in container-based fog computing
CN105930731B (en) A kind of method and device of security application TA interaction
CN112104754B (en) Network proxy method, system, device, equipment and storage medium
CN103986715A (en) Network traffic control method and device
CN108234149B (en) Network request management method and device
CN101501669A (en) Domain name resolution resource allocation
CA2547825A1 (en) System and method for allocating server resources
CN104348798B (en) A kind of method, apparatus, dispatch server and system for distributing network
CN106603262A (en) Method and system of distribution of customer service modes
RU2016103796A (en) SYSTEM AND METHOD OF MANAGING THE DATA BAR
CN108021400B (en) Data processing method and device, computer storage medium and equipment
CN110276184A (en) A kind of cloud computing resources authorization method and device
CN106506475B (en) Group management and device
CN110113394A (en) API Calls method and apparatus
CN105635124B (en) Flow control methods and device
CN110351311A (en) Load-balancing method and computer storage medium
CN109729139A (en) Access request retransmission method, device, equipment and readable storage medium storing program for executing
CN108259418A (en) A kind of system and method for function trusteeship service
CN107070862B (en) Data distribution method, data distribution device and the gateway system of gateway
MXPA03005934A (en) Method of restricting access to resources belonging to interactive services with at least one package.
CN113595926B (en) API data transmission method, device, equipment and medium based on data middlebox
CN104519069A (en) Method and device for intercepting resource requests

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