CN107918562A - A kind of unified interface management method and system - Google Patents

A kind of unified interface management method and system Download PDF

Info

Publication number
CN107918562A
CN107918562A CN201610886055.6A CN201610886055A CN107918562A CN 107918562 A CN107918562 A CN 107918562A CN 201610886055 A CN201610886055 A CN 201610886055A CN 107918562 A CN107918562 A CN 107918562A
Authority
CN
China
Prior art keywords
interface
service
http
service interface
calling
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
CN201610886055.6A
Other languages
Chinese (zh)
Other versions
CN107918562B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201610886055.6A priority Critical patent/CN107918562B/en
Publication of CN107918562A publication Critical patent/CN107918562A/en
Application granted granted Critical
Publication of CN107918562B publication Critical patent/CN107918562B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • 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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Abstract

The present invention, which provides a kind of unified interface management method and system, wherein this method, to be included:The protocol information of each service interface in interface warehouse is obtained, protocol information includes interface type, enters ginseng, go out ginseng, routing rule, call time-out time and data mapping ruler;The service request sent according to user to HTTP interface, obtains the routing rule in the protocol information of HTTP interface, and according to routing rule, determines the service interface that HTTP interface calls;According to protocol information, the interface type of the service interface of calling is obtained, and according to interface type and enter ginseng, go out ginseng, call service interface;The business datum that the service interface called returns is obtained, and business datum is sent to user according to data mapping ruler.The present invention, which can be realized, to be managed collectively and is monitored to different service interfaces, and the development and maintenance cost for cutting the functions such as flow, gray scale issue is effectively reduced using a variety of routing rules.

Description

A kind of unified interface management method and system
Technical field
The present invention relates to computer software fields, and in particular to a kind of unified interface management method and system.
Background technology
Almost all of internet system is all initially integrated design, and all function code business realizings are all one Completed in a system.As user constantly increases, business also can be more and more diversified, complexity, the stabilization of corresponding system Property, it is maintainable also more and more unmanageable.With the rise and development of the serviceization of operation system, system service is brought Another problem is that service interface disperses.That is, the information that is presented of front page layout is very likely from multiple service interfaces, And each service interface may be by different business departments and be safeguarded.When these service interfaces are abnormal situation When, front page layout just occurs various problems, such as typesetting entanglement, puts in a skylight, or even display error message, causes system user Experience poor.Further, since these service interfaces are from different business departments, therefore easily it can not be monitored.
In the prior art, the management system for Http service interfaces is generally divided into front end management and rear end management, its Middle front end management generally using JS scripts it is carried out data check, data backing etc. manage, and rear end pipe reason be exactly will such as Cut flow, gray scale test, performance monitoring etc. and be placed in rear end to do.Either it can all be produced by front-end processing or back-end processing Substantial amounts of workload, such as A systems and B system have all used some service interface C, and two systems are just needed to service interface C Same data check is done, is write if A systems and B system are same-languages, is worked relatively easy, direct code is public just Can be with, but if two systems are write with different language, development and maintenance cost is with regard to bigger.Due to only carrying out an item number It is just so troublesome according to verification task, think and cicada if completing other function complexities again.
The content of the invention
In view of this, it is more to complexity to realize the object of the present invention is to provide a kind of unified interface management method and system The service interface of sample is managed collectively, and reduces exploitation and the cost safeguarded, and then lift user experience.
The technical scheme is that a kind of unified interface management method is provided, wherein, the described method includes:
The protocol information of each service interface in interface warehouse is obtained, the protocol information includes interface type, enters ginseng, goes out Ginseng, routing rule, call time-out time and data mapping ruler;
The service request sent according to user to HTTP interface, obtains the route rule in the protocol information of the HTTP interface Then, and according to the routing rule, the service interface that the HTTP interface calls is determined;
According to the protocol information, the interface type of the service interface of calling is obtained, and according to the interface Type and it is described enter ginseng, call the service interface;
The business datum that the service interface called returns is obtained, and the business datum is mapped according to the data Rule is sent to the user.
Alternatively, the interface type includes but not limited to:Http Get and HttpPost and Webservice.
Alternatively, the routing rule includes but not limited to:Default route rule, Cookie routing rules and request header Routing rule.
Alternatively, according to the routing rule, determine that the HTTP interface calls the service corresponding with service request Interface, further includes:
When the user sends the service request to the HTTP interface, calculate what is called according to the routing rule The caching key of the service interface, and the service interface of calling is preserved into the shared buffer memory of Nginx or Redis.
Alternatively, this method further includes:When the user sends the service request to the HTTP interface, according to institute Caching key is stated to inquire about in the shared buffer memory with the presence or absence of the service interface called;
If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then Call the service interface in the interface warehouse.
Alternatively, this method further includes:If the calling of the service interface is occurred to call abnormal or described calling Time-out time is more than or equal to predetermined threshold value, then returns to the backing data of the service interface.
Alternatively, this method further includes:The system data of the HTTP interface and the service interface is called in collection, and The system data is preserved into journal file.
The present invention also provides a kind of unified interface management system, wherein, the system comprises:
Protocol information acquisition device, for obtaining the protocol information of each service interface in interface warehouse, the agreement letter Breath includes interface type, enters ginseng, go out ginseng, routing rule, call time-out time and data mapping ruler;
Interface selection devices, for the service request sent according to user to HTTP interface, obtain the HTTP interface Routing rule in protocol information, and according to the routing rule, determine the service interface that the HTTP interface calls;
Interface calling device, for according to the protocol information, obtaining the interface class of the service interface of calling Type, and according to the interface type and it is described enter ginseng, call the service interface;
Business processing device, the business datum returned for obtaining the service interface called, and by the business number Sent according to according to the data mapping ruler to the user.
Alternatively, the interface type includes but not limited to:Http Get and HttpPost and Webservice.
Alternatively, the routing rule includes but not limited to:Default route rule, Cookie routing rules and request header Routing rule.
Alternatively, the interface selection devices, are additionally operable to:Asked when the user sends the business to the HTTP interface When asking, the caching key of the service interface called is calculated according to the routing rule, and the service interface of calling is protected Deposit into the shared buffer memory of Nginx or Redis.
Alternatively, which further includes:Buffer storage, the buffer storage are used to work as the user to the HTTP interface When sending the service request, inquired about in the buffer storage according to the caching key and connect with the presence or absence of the service called Mouthful;
If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then Call the service interface in the interface warehouse.
Alternatively, which further includes:Data backing device, if the data backing device is used to connect the service The calling of mouth occurs to call abnormal or described calling time-out time to be more than or equal to predetermined threshold value, then returns to the service interface Backing data.
Alternatively, which further includes:Data acquisition device, the HTTP interface and the service are called for gathering The system data of interface, and the system data is preserved into journal file.
By unified interface management method provided by the invention and system, it can realize and different service interfaces are carried out with unification Management and monitoring, and the development and maintenance cost for cutting the functions such as flow, gray scale issue is effectively reduced using a variety of routing rules. In addition, by carrying out shared buffer memory to the protocol information of interface and using data backing function, the property of interface is effectively increased The problem of putting in a skylight because of interface exception and can be avoided.
Brief description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for For those of ordinary skill in the art, without creative efforts, other can also be obtained according to these attached drawings Attached drawing.In the accompanying drawings:
Fig. 1 is the flow diagram of the unified interface management method of one embodiment of the invention;
Fig. 2 is the structure diagram of the unified interface management system of one embodiment of the invention.
Embodiment
For the purpose, technical scheme and advantage of the embodiment of the present invention are more clearly understood, below in conjunction with the accompanying drawings to this hair Bright embodiment is described in further details.Here, the schematic description and description of the present invention is used to explain the present invention, but simultaneously It is not as a limitation of the invention.
Art technology technical staff knows, embodiments of the present invention can be implemented as a kind of system, device, equipment, Method or computer program product.Therefore, the disclosure can be implemented as following form, i.e.,:It is complete hardware, complete soft Part (including firmware, resident software, microcode etc.), or the form that hardware and software combines.
Herein, it is to be understood that in involved term:
Interface warehouse:Exactly store the database of third party's service interface message.
lua-nginx-module:It is nginx third party's module of exploitation, lua language can be embedded into nginx configurations by it In, the performance of nginx is greatly enhanced thereby using lua.
Illustrative methods
The unified interface management method of exemplified embodiment of the present invention is introduced below with reference to Fig. 1.Need to note Meaning, above application scene, which is for only for ease of, to be understood spirit and principles of the present invention and shows, embodiments of the present invention It is unrestricted in this regard.On the contrary, embodiments of the present invention can be applied to applicable any scene.
It is the flow diagram of the unified interface management method of one embodiment of the invention for example, with reference to shown in Fig. 1.
As shown in the figure, this method includes:
Step S101:The protocol information of each service interface in interface warehouse is obtained, the protocol information includes interface class Type, enter ginseng, go out ginseng, routing rule, call time-out time and data mapping ruler;
Step S102:The service request sent according to user to HTTP interface, obtains the protocol information of the HTTP interface In routing rule, and according to the routing rule, determine the service interface that the HTTP interface calls;
Step S103:According to the protocol information, the interface type of the service interface of calling is obtained, and according to The interface type and it is described enter ginseng, call the service interface;
Step S104:The business datum that the service interface called returns is obtained, and by the business datum according to institute Data mapping ruler is stated to send to the user.
Alternatively, the interface type includes but not limited to:Http Get and HttpPost and Webservice.
Alternatively, the routing rule includes but not limited to:Default route rule, Cookie routing rules and request header Routing rule.
Alternatively, according to the routing rule, determine that the HTTP interface calls the service corresponding with service request Interface, further includes:
When the user sends the service request to the HTTP interface, calculate what is called according to the routing rule The caching key of the service interface, and the service interface of calling is preserved into the shared buffer memory of Nginx or Redis.
Alternatively, this method further includes:When the user sends the service request to the HTTP interface, according to institute Caching key is stated to inquire about in the shared buffer memory with the presence or absence of the service interface called;
If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then Call the service interface in the interface warehouse.
Alternatively, this method further includes:If the calling of the service interface is occurred to call abnormal or described calling Time-out time is more than or equal to predetermined threshold value, then returns to the backing data of the service interface.
Alternatively, this method further includes:The system data of the HTTP interface and the service interface is called in collection, and The system data is preserved into journal file.
Embodiment
The present invention is specifically described with reference to a specific embodiment, however, it should be noted that the specific implementation Example merely to preferably description the present invention, do not form inappropriate limitation of the present invention.
First, the protocol information of each service interface is obtained from an interface warehouse of background system maintenance, record is adjusted What is needed during with these interfaces enters ginseng, goes out ginseng, calls the agreements such as time-out time, interface type, routing rule, data mapping ruler Information, and the protocol information is preserved into database.
It is illustrated below with a third party's service interface, third party's service interface url is:http:// a.jd.com/fetchA=zhang&b=3&c=4, we can disassemble the service interface and come, and in the form of json goes here and there Database is stored in, the form of json strings is as follows:
What is needed when can obtain by json strings and call these interfaces enters ginseng, goes out ginseng, calls time-out time, interface The protocol informations such as type, routing rule, data mapping ruler.It is specific real since the interface warehouse has background system storage management Existing mode can be grasped easily for those skilled in the art, therefore not repeat herein.
Secondly, the service request that user sends to HTTP interface, obtains the route rule in the protocol information of the HTTP interface Then.
Again, the routing rule in the protocol information of the HTTP interface, determines that the service that the HTTP interface calls connects Mouthful.
Specifically, protocol information both defines a weighted value for each interface, the meaning that specific weight value represents with And how to use, depending on the routing rule set for the service interface.The present invention supports a variety of routing rules, and can be square Just extend.
In an embodiment of the present invention, which can include:Default route rule, Cookie routing rules and Request header routing rule.
Describe in detail respectively to above-mentioned routing rule below.
(1) default route rule
Weighted value is considered as the priority level that interface can be accessed by default route rule.Assuming that HTTP interface A is corresponding The weight of two service interfaces i1 and i2 are respectively 20 and 80, if HTTP interface A is accessed 100 times, then HTTP interface A The data of output have be for 20 times service interface i1 data, be for 80 times service interface i2 data.
(2) Cookie routing rules
Weighted value is considered as an interval range by the routing rule.The routing rule can be according to some cookie value, will It is fixed in the access of any HTTP interface.Also assume that HTTP interface A corresponding service interface i1's and service interface i2 Weight is followed successively by 20 and 80 respectively, and extraction system provides in the service request which can send from user to HTTP interface Cookie values, and by its hash into a numeral h, then allow weights of the digital h respectively with service interface i1 and service interface i2 The sum of take and touch.Service interface i1 is routed to if the value b drawn is between 0 to 19, if the value b drawn is between 20 to 99 Then it is routed to service interface i2.
(3) request header routing rule
Since the routing rule is similar with cookie routing rules, simply the cookie values in above-mentioned routing rule are changed into Request header value, therefore details are not described herein.
By the task such as above-mentioned routing rule easily to multiple interfaces can cut flow, gray scale is issued, and There is no the workload of any exploitation during this.Three above routing rule be provided in one embodiment of the invention it is basic Rule, the present invention can extend new routing rule again in implementation process according to different business.
Then, according to the protocol information, the interface type of those service interfaces of calling is obtained, and is serviced according to those The interface type of interface and enter ginseng, call those service interfaces.
Specifically, in an embodiment of the present invention, service interface supports three kinds of interface types at present, is http respectively Get, http post and webservice.Wherein,
Http get represent that those service interfaces are called in a manner of the get of http agreements;
Http post represent that those service interfaces are called in a manner of the post of http agreements;
Webservice represents that those service interfaces are called in a manner of webservice.
Three of the above type is the same in the representation of data, is had been described above in the code of beginning, these three connect The difference of mouth type is that the value of type is different, and specifically, 1 represents http get requests, and 2 represent http post Request, 3 represent webservice requests.
The invoked procedure that interface type is http get is described in detail below.
When calling the service interface of the interface type, the json strings for representing this interface are taken out first from database, Therefrom obtain the information of this stage needs:Syn_time and conn_time.Then set before http request is sent, according to url Complete url, i.e. http are asked with assembled this of the field in input://a.jd.com/fetchA=[is set in advance [the value] &c=[client is transmitted through the value come] set in advance, finally sending http to the back-end using the url please by value] &b= Ask.
It is illustrated with reference to any of the above-described routing rule and different interface type.
Assuming that using " default route rule ", some HTTP interface A then corresponds to three service interfaces, and these three are serviced The interface type of interface is http get, http post, webservice respectively, the weight of each interface is 30 respectively successively, 30th, 40, it is [0,29], [30,59], [60,99] respectively between at this time each interface can correspond to a digital block.Then, should be " silent Recognize routing rule " can be that HTTP interface A sets a counter, often ask start-stop counter to add 1, which is specifically routed to The service interface of rear end then needs Counter Value according to 100 modulus, the value drawn we represented with index.If index is Then call the interface of http get between [0,29], the method for calling of other service interfaces and so on, do not repeat herein.
In addition, these three interface types can be json forms, xml forms, java objects, each of which form all can The result data of interface can be assembled into output template definition by a corresponding mapper, the mapper according to data mapping ruler Form.
Finally, the business datum that those service interfaces of calling return is obtained, and by business datum according to default data Mapping ruler is sent to the user.
Specifically, each HTTP interface can correspond to multiple third party's service interfaces in the present invention, and each third party The data format of service interface output can be different.Therefore, an adaptation mechanism is just needed here, so may insure same One HTTP interface no matter the data format for calling external output after which third party's service interface of rear end is unified, Certain content can change.
In order to realize this function, the present invention defines an output template and a mapper for each hole position, this is defeated Go out template and unified data output format is set for each HTTP interface, and define one for each third party's HTTP interface and reflect Rule is penetrated, i.e., no matter which kind of form is the data of third party's service interface output be, finally can all map and advise according to default data Then it is converted into the form of output template.
Default data mapping ruler is described in detail below.
It is assumed that it is service interface i1, service interface i2 respectively that HTTP interface A, which corresponds to two third party's service interfaces, now.
The data output format of service interface i1 is:
id:xxx
name:xxx
age:xxx
The data output format of service interface i2 is:
Person:
Pid:xxx
Pname:xxx
Page:xxx
On practical business, if only needing id the and name fields or service interface i2 using service interface i1 Pid and Pname fields, so can so be defined for the output template of HTTP interface A:
After condition assumed above, we can respectively map data id and the name field of service interface i1 Onto Tid the and Tname fields of the output template:
Tid:Obj.id,
Tname:obj.name
To the data of service interface i2, Pid the and Pname fields under Person, can be respectively mapped to the output template Tid and Tname fields on:
Tid:Obj.person.pid,
Tname:obj.person.pname
Wherein with the field in the field references output template of T beginnings, obj is that an abstract field is used to represent The returned data of HTTP interface, final mapper provided by the present invention is by it according to the preset format of output template into line number Sent according to assembling to the user.
Specifically, in order to improve system performance, the present invention connects for the corresponding all third party's services of each HTTP interface Mouth provides a caching function.Specifically data cached preservation into Redis or can be used lua by the data cached guarantor Deposit into the shared buffer memory of nginx.
In an embodiment of the present invention, the shared buffer memory of a nginx is provided using lua-nginx-module modules Dict, to improve the performance of whole system.
The specific implementation process is as follows:
First, the instruction lua_shared_dict provided with lua-nginx-module defines a shared buffer memory.It is false If the interface externally provided ishttp://i.jd.com/slotSlotid=5, when receive service request that user sends it Afterwards, go in dict to call service interface to obtain corresponding business datum using slotid=5 as caching key first.If it can obtain Get business datum, then directly return to business datum.
If business datum (may cache expired or ask for the first time) is not read, it is necessary to from back-end server Obtain data.In an embodiment of the present invention, the mode for data being obtained from back-end server can use lua-nginx- The api that module is provided is obtained, and can also use luasocket, can also use the modes such as cosoket.
It is updated again to data cached after the service interface in back-end server returns to correct data.In the present invention In one embodiment, by the use of slotid=5 as caching key, value is with the data obtained from back-end server, is put it into Into dict.
In fact, when user accesses some HTTP interface for the first time, system can be first according to the association of the HTTP interface View information calculates caching key, then reads data from shared buffer memory dict according to caching key.If in caching not There are the service interface that just may proceed to during the data in request back-end server, treats that the service interface in back-end server returns just It is updated again to data cached after true data.
In the process, because even being the data cached correctness that also ensure routing rule, therefore above-mentioned routing rule It will be realized again using lua one time at nginx layers.The record information of caching key includes at present:HTTP interface id, service connect Mouth id, enter ginseng (configuration rule according to agreement is ordered into).
According to the record information of caching key, those skilled in the art can be run away with as drawn a conclusion:Cache key's Actual quantity service interface quantity corresponding with HTTP interface is corresponding.In addition, the data of each service interface are in the buffer Storage duration can be separately provided by background system, specifically if caching key be -1 if represent not cache.
In addition, in an embodiment of the present invention, system provides a data backing function for each hole position, to ensure to work as When service interface can not normally provide service, its corresponding HTTP interface remains to normal returned data, and backing data are every Updated once during secondary cache invalidation.
Specifically, data backing is to use lua-resty-redis moulds based on the module on lua-nginx-module What block was realized.Can be being provided by lua-resty-redis modules from the data that back-end server obtains when cache invalidation Api is put it into Redis.If external HTTP interface id=5, we can use " bottom_5 " to represent backing Storage mark of the data in Reids, at this time backing data be just updated, later work as back-end server in service interface When service can not be normally provided or after opening backing switch directly data can be obtained from backing data.
In addition, in an embodiment of the present invention, the present invention is also provided with for each service interface and calls time-out time.When HTTP interface, which exceedes the calling of any service interface in back-end server, sets threshold values, and system will degrade and return automatically Backing data.
Specifically, automatic degradation is exactly to have two parameters in the protocol information for each service interface being previously mentioned: Syn_time and conn_time, the two parameters are exactly for realizing the function of degrading automatically.When request is sent, one Denier, which exceedes pre-set value, will produce time-out, this is that method call will produce exception, it is automatic degrade be exactly capture this It is a little abnormal.A default value (such as character string " null ") is then back to, can so ensure that program is more healthy and stronger.For example, one Third party's service interface ishttp://a.jd.com/fetchA=6, the response time of the service interface is 500ms.Based on upper Situation is stated, if the conn_time parameters of the service interface are arranged to 400ms, then every time to the calling of the service interface It will automatically be degraded, be then back to " null " character string.
In addition, system also provides the function of degrading manually for each HTTP interface.Specifically, degrade manually and use two Kind key assignments is to realize switching function, and one of which is to set global switch to be used for controlling all HTTP interfaces, and another kind is to set Local switch is put to be used for controlling any one or more HTTP interfaces.The switch is put in the buffer, every time it is requested come after can be excellent First check whether corresponding switch is opened, obtain backing data directly from caching if being opened, otherwise perform normal Flow (flow turned off the switch).
Specifically, degrade manually is exactly that switching for HTTP interface is exactly to be used for degrading manually.For example, a HTTP connects Mouthful it ishttp://i.jd.com/slotSlotid=3, a third party's service of the corresponding back-end server of the HTTP interface Interface is http://a.jd.com/fetchA=4.If the third party's service interface breaks down at some moment, this When can manual unlocking this HTTP interface data backing switch, and after data backing switch is opened, the HTTP Interface would not ask the third party's service interface again, that is to say, that will directly return to backing data.
In addition, each access cache of system, access back-end services, access backing data all can gather and be recorded in daily record In.Specifically, system can at the beginning of record access between, access duration, access identities (monitor_key) etc..According to this A little information can easily calculate performance, interface call number and backing data call number of outgoing interface etc..It is so follow-up The information such as the performance entirely asked, call number can be got by analyzing daily record.System manager can be according to these letters Breath sets it alarming threshold value to grasp system dynamic in time.
Daily record implementation is described in detail below.In order to accurately obtain the time, an embodiment of the present invention provides one A method for obtaining the current time in system, the time that this method returns can be accurate to millisecond.Wherein, when receiving service request Afterwards, the current time obtained by this method is start, and this method is reused after service request terminates and is obtained currently Time end.Then, the period for calculating end-start is exactly the time elapsed that the service request is consumed.This process Identifier can be identified with data key.Finally, instructed using the log developed based on nginx by these information records to daily record In file.
In an embodiment of the present invention, the implementation method of log instructions can be:Log " file path " " log information ", The ngx.log methods of lua-nginx-module modules can be used, the file operation api provided in lua can also be provided.
Fig. 2 is the structure diagram of the unified interface management system of one embodiment of the invention, wherein, the system 2 includes:
Protocol information acquisition device 21, for obtaining the protocol information of each service interface in interface warehouse, the agreement Information includes interface type, enters ginseng, go out ginseng, routing rule, call time-out time and data mapping ruler;
Interface selection devices 22, for the service request sent according to user to HTTP interface, obtain the HTTP interface Protocol information in routing rule, and according to the routing rule, determine the service interface that the HTTP interface calls;
Interface calling device 23, for according to the protocol information, obtaining the interface of the service interface of calling Type, and according to the interface type and it is described enter ginseng, call the service interface;
Business processing device 24, the business datum returned for obtaining the service interface called, and by the business Data are sent to the user according to the data mapping ruler.
Alternatively, the interface type includes but not limited to:Http Get and HttpPost and Webservice.
Alternatively, the routing rule includes but not limited to:Default route rule, Cookie routing rules and request header Routing rule.
Alternatively, the interface selection devices 22, are additionally operable to:When the user sends the business to the HTTP interface During request, the caching key of the service interface called is calculated according to the routing rule, and by the service interface of calling Preserve into the shared buffer memory of Nginx or Redis.
Alternatively, which further includes:Buffer storage 25, the buffer storage 35 are used to work as the user to the HTTP When interface sends the service request, inquired about according to the caching key in the buffer storage 25 described in whether there is calling Service interface;
If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then Call the service interface in the interface warehouse.
Alternatively, which further includes:Data backing device 26, if the data backing device 36 is used for the clothes The calling of business interface occurs to call abnormal or described calling time-out time to be more than or equal to predetermined threshold value, then returns to the service and connect The backing data of mouth.
Alternatively, which further includes:Data acquisition device 27, the HTTP interface and the clothes are called for gathering The system data of business interface, and the system data is preserved into journal file.
Since unified interface management system provided by the invention is the corresponding system of the above method, therefore details are not described herein.
By unified interface management method provided by the invention and system, it can realize and different service interfaces are carried out with unification Management and monitoring, and the development and maintenance cost for cutting the functions such as flow, gray scale issue is effectively reduced using a variety of routing rules. In addition, by carrying out shared buffer memory to the protocol information of interface and using data backing function, the property of interface is effectively increased The problem of putting in a skylight because of interface exception and can be avoided.
In addition, although in the accompanying drawings with the operation of particular order the invention has been described method, still, this do not require that or Imply that the operation having to carry out shown in whole could realize desired result.Additionally or alternatively, it is convenient to omit some steps, Multiple steps are merged into a step to perform, and/or a step is decomposed into execution of multiple steps.
Particular embodiments described above, has carried out the purpose of the present invention, technical solution and beneficial effect further in detail Describe in detail it is bright, it should be understood that the foregoing is merely the present invention specific embodiment, the guarantor being not intended to limit the present invention Scope is protected, within the spirit and principles of the invention, any modification, equivalent substitution, improvement and etc. done, should be included in this Within the protection domain of invention.

Claims (14)

  1. A kind of 1. unified interface management method, it is characterised in that the described method includes:
    Obtain interface warehouse in each service interface protocol information, the protocol information include interface type, enter ginseng, go out ginseng, Routing rule, call time-out time and data mapping ruler;
    The service request sent according to user to HTTP interface, obtains the routing rule in the protocol information of the HTTP interface, And according to the routing rule, determine the service interface that the HTTP interface calls;
    According to the protocol information, the interface type of the service interface of calling is obtained, and according to the interface type Enter to join with described, call the service interface;
    The business datum that the service interface called returns is obtained, and by the business datum according to the data mapping ruler Send to the user.
  2. 2. according to the method described in claim 1, it is characterized in that, the interface type includes but not limited to:
    Http Get and Http Post and Webservice.
  3. 3. according to the method described in claim 1, it is characterized in that, the routing rule includes but not limited to:
    Default route rule, Cookie routing rules and request header routing rule.
  4. 4. according to the method described in claim 1, it is characterized in that, according to the routing rule, the HTTP interface tune is determined With the service interface corresponding with service request, further include:
    When the user sends the service request to the HTTP interface, calculated according to the routing rule described in calling The caching key of service interface, and the service interface of calling is preserved into the shared buffer memory of Nginx or Redis.
  5. 5. according to the method described in claim 4, it is characterized in that, further include:
    It is described shared slow according to caching key inquiries when the user sends the service request to the HTTP interface With the presence or absence of the service interface called in depositing;
    If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then calling The service interface in the interface warehouse.
  6. 6. according to the method described in claim 1, it is characterized in that, further include:
    If occurring to call abnormal or described calling time-out time to be more than or equal to predetermined threshold value to the calling of the service interface, Then return to the backing data of the service interface.
  7. 7. according to method according to any one of claims 1 to 6, it is characterised in that further include:
    The system data of the HTTP interface and the service interface is called in collection, and the system data is preserved to daily record In file.
  8. A kind of 8. unified interface management system, it is characterised in that the system comprises:
    Protocol information acquisition device, for obtaining the protocol information of each service interface in interface warehouse, the protocol information bag Interface type is included, enters ginseng, goes out ginseng, routing rule, calls time-out time and data mapping ruler;
    Interface selection devices, for the service request sent according to user to HTTP interface, obtain the agreement of the HTTP interface Routing rule in information, and according to the routing rule, determine the service interface that the HTTP interface calls;
    Interface calling device, for according to the protocol information, obtaining the interface type of the service interface of calling, and According to the interface type and it is described enter ginseng, call the service interface;
    Business processing device, the business datum returned for obtaining the service interface called, and the business datum is pressed Sent according to the data mapping ruler to the user.
  9. 9. system according to claim 8, it is characterised in that the interface type includes but not limited to:
    Http Get and Http Post and Webservice.
  10. 10. system according to claim 8, it is characterised in that the routing rule includes but not limited to:
    Default route rule, Cookie routing rules and request header routing rule.
  11. 11. system according to claim 8, it is characterised in that the interface selection devices, are additionally operable to:
    When the user sends the service request to the HTTP interface, calculated according to the routing rule described in calling The caching key of service interface, and the service interface of calling is preserved into the shared buffer memory of Nginx or Redis.
  12. 12. system according to claim 11, it is characterised in that further include:Buffer storage, the buffer storage are used to work as When the user is to the HTTP interface transmission service request, being inquired about according to the caching key in the buffer storage is It is no to there is the service interface called;
    If there is the service interface of calling, then the service interface in the shared buffer memory is called, conversely, then calling The service interface in the interface warehouse.
  13. 13. system according to claim 8, it is characterised in that further include:Data backing device, the data backing dress If put for the calling of the service interface to occur to call abnormal or described calling time-out time to be more than or equal to default threshold Value, then return to the backing data of the service interface.
  14. 14. the system according to any one of claim 8~13, it is characterised in that further include:Data acquisition device, is used The system data of the HTTP interface and the service interface is called in collection, and the system data is preserved to daily record text In part.
CN201610886055.6A 2016-10-11 2016-10-11 Unified interface management method and system Active CN107918562B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610886055.6A CN107918562B (en) 2016-10-11 2016-10-11 Unified interface management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610886055.6A CN107918562B (en) 2016-10-11 2016-10-11 Unified interface management method and system

Publications (2)

Publication Number Publication Date
CN107918562A true CN107918562A (en) 2018-04-17
CN107918562B CN107918562B (en) 2021-11-26

Family

ID=61891831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610886055.6A Active CN107918562B (en) 2016-10-11 2016-10-11 Unified interface management method and system

Country Status (1)

Country Link
CN (1) CN107918562B (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108509313A (en) * 2018-03-23 2018-09-07 深圳乐信软件技术有限公司 A kind of business monitoring method, platform and storage medium
CN108897612A (en) * 2018-07-17 2018-11-27 北京京东金融科技控股有限公司 Route the method and apparatus jumped
CN109194495A (en) * 2018-06-29 2019-01-11 平安科技(深圳)有限公司 server, message processing method and computer readable storage medium
CN109379284A (en) * 2018-09-17 2019-02-22 平安科技(深圳)有限公司 Route execution method, storage medium and terminal device
CN109947410A (en) * 2019-03-28 2019-06-28 北京致远互联软件股份有限公司 Third party's service interface construction method and device
CN110007912A (en) * 2019-03-05 2019-07-12 山东浪潮通软信息科技有限公司 A kind of visual configuration realization system and method for data sharing interface
CN110020317A (en) * 2017-12-25 2019-07-16 北京京东尚科信息技术有限公司 Web page-container backing file determines method, apparatus, equipment and readable storage medium storing program for executing
CN110262851A (en) * 2019-06-24 2019-09-20 北京搜房科技发展有限公司 Interface allocation method and device
CN110535780A (en) * 2019-08-27 2019-12-03 深圳前海环融联易信息科技服务有限公司 Route control method, device, computer equipment and the storage medium of load balancing
CN110704483A (en) * 2019-09-06 2020-01-17 平安普惠企业管理有限公司 User routing process positioning method, device, storage medium and device
CN110912930A (en) * 2019-12-13 2020-03-24 杭州城市大数据运营有限公司 Data interface management method
CN111309490A (en) * 2020-03-26 2020-06-19 北京奇艺世纪科技有限公司 Resource allocation method and device, electronic equipment and storage medium
CN111400219A (en) * 2020-03-15 2020-07-10 杭州卓健信息科技有限公司 Interface adapter and electronic equipment thereof
CN111597059A (en) * 2020-04-18 2020-08-28 北京奇保信安科技有限公司 Interface calling request processing method and device and electronic equipment
CN111797149A (en) * 2019-06-27 2020-10-20 厦门雅基软件有限公司 Data acquisition method, device, equipment and computer readable storage medium
CN112422643A (en) * 2020-11-02 2021-02-26 中关村科学城城市大脑股份有限公司 Third-party interface protection request forwarding method and device
CN112769975A (en) * 2020-12-31 2021-05-07 武汉联影医疗科技有限公司 Data integration method and device, server and storage medium
CN112769700A (en) * 2020-12-29 2021-05-07 浙江合众新能源汽车有限公司 Routing method and routing system based on application method number
CN113242241A (en) * 2021-05-11 2021-08-10 浙江鸿程计算机系统有限公司 Method for converting SAP RFC protocol into HTTP protocol
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN116700940A (en) * 2023-08-08 2023-09-05 成都数智创新精益科技有限公司 Request handling method, system and device based on encapsulation class and medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101013986A (en) * 2007-02-02 2007-08-08 南京邮电大学 Method for realizing data inquiring system of sensor network based on middleware of mobile agent
US20080062891A1 (en) * 2006-09-08 2008-03-13 Van Der Merwe Jacobus E Systems, devices, and methods for network routing
CN102209076A (en) * 2011-06-03 2011-10-05 用友软件股份有限公司 Method and system for interaction between server and client
CN102799424A (en) * 2012-06-12 2012-11-28 上海雷腾软件有限公司 Interface architecture of agile efficient layering server side
CN103324566A (en) * 2012-03-20 2013-09-25 阿里巴巴集团控股有限公司 Multi-version test method and device for web page product
CN103345420A (en) * 2013-06-03 2013-10-09 百度在线网络技术(北京)有限公司 Method for massively calling API interfaces, system for massively calling API interfaces and device for massively calling API interfaces
CN103647811A (en) * 2013-11-28 2014-03-19 北京奇虎科技有限公司 A method and an apparatus for application's accessing backstage service
CN103699367A (en) * 2012-09-27 2014-04-02 中国电信股份有限公司 HTTP (hyper text transport protocol) API (application program interface) invoking method and device
CN105578528A (en) * 2016-01-08 2016-05-11 努比亚技术有限公司 Data interface distribution method and apparatus and terminal device
CN105808365A (en) * 2016-03-22 2016-07-27 深圳市宁远科技股份有限公司 HIS (Hospital Information System) interface calling method and HIS interface configuration method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080062891A1 (en) * 2006-09-08 2008-03-13 Van Der Merwe Jacobus E Systems, devices, and methods for network routing
CN101013986A (en) * 2007-02-02 2007-08-08 南京邮电大学 Method for realizing data inquiring system of sensor network based on middleware of mobile agent
CN102209076A (en) * 2011-06-03 2011-10-05 用友软件股份有限公司 Method and system for interaction between server and client
CN103324566A (en) * 2012-03-20 2013-09-25 阿里巴巴集团控股有限公司 Multi-version test method and device for web page product
CN102799424A (en) * 2012-06-12 2012-11-28 上海雷腾软件有限公司 Interface architecture of agile efficient layering server side
CN103699367A (en) * 2012-09-27 2014-04-02 中国电信股份有限公司 HTTP (hyper text transport protocol) API (application program interface) invoking method and device
CN103345420A (en) * 2013-06-03 2013-10-09 百度在线网络技术(北京)有限公司 Method for massively calling API interfaces, system for massively calling API interfaces and device for massively calling API interfaces
CN103647811A (en) * 2013-11-28 2014-03-19 北京奇虎科技有限公司 A method and an apparatus for application's accessing backstage service
CN105578528A (en) * 2016-01-08 2016-05-11 努比亚技术有限公司 Data interface distribution method and apparatus and terminal device
CN105808365A (en) * 2016-03-22 2016-07-27 深圳市宁远科技股份有限公司 HIS (Hospital Information System) interface calling method and HIS interface configuration method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
FLAVIO R.C. SOUSA等: "Towards Elastic Multi-Tenant Database Replication with Quality of Service", 《2012 IEEE FIFTH INTERNATIONAL CONFERENCE ON UTILITY AND CLOUD COMPUTING》 *
初宁等: "基于策略的可控服务发现与动态路由模型", 《计算机工程与设计》 *

Cited By (32)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110020317B (en) * 2017-12-25 2021-12-14 北京京东尚科信息技术有限公司 Webpage container bottom supporting file determining method, device, equipment and readable storage medium
CN110020317A (en) * 2017-12-25 2019-07-16 北京京东尚科信息技术有限公司 Web page-container backing file determines method, apparatus, equipment and readable storage medium storing program for executing
CN108509313B (en) * 2018-03-23 2021-03-19 深圳乐信软件技术有限公司 Service monitoring method, platform and storage medium
CN108509313A (en) * 2018-03-23 2018-09-07 深圳乐信软件技术有限公司 A kind of business monitoring method, platform and storage medium
CN109194495A (en) * 2018-06-29 2019-01-11 平安科技(深圳)有限公司 server, message processing method and computer readable storage medium
CN109194495B (en) * 2018-06-29 2021-08-24 平安科技(深圳)有限公司 Server, message processing method, and computer-readable storage medium
WO2020015562A1 (en) * 2018-07-17 2020-01-23 京东数字科技控股有限公司 Routing jump method and apparatus
CN108897612A (en) * 2018-07-17 2018-11-27 北京京东金融科技控股有限公司 Route the method and apparatus jumped
CN109379284A (en) * 2018-09-17 2019-02-22 平安科技(深圳)有限公司 Route execution method, storage medium and terminal device
CN110007912A (en) * 2019-03-05 2019-07-12 山东浪潮通软信息科技有限公司 A kind of visual configuration realization system and method for data sharing interface
CN109947410B (en) * 2019-03-28 2022-09-02 北京致远互联软件股份有限公司 Third-party service interface construction method and device
CN109947410A (en) * 2019-03-28 2019-06-28 北京致远互联软件股份有限公司 Third party's service interface construction method and device
CN110262851A (en) * 2019-06-24 2019-09-20 北京搜房科技发展有限公司 Interface allocation method and device
CN111797149A (en) * 2019-06-27 2020-10-20 厦门雅基软件有限公司 Data acquisition method, device, equipment and computer readable storage medium
CN111797149B (en) * 2019-06-27 2023-01-31 厦门雅基软件有限公司 Data acquisition method, device, equipment and computer readable storage medium
CN110535780A (en) * 2019-08-27 2019-12-03 深圳前海环融联易信息科技服务有限公司 Route control method, device, computer equipment and the storage medium of load balancing
CN110704483A (en) * 2019-09-06 2020-01-17 平安普惠企业管理有限公司 User routing process positioning method, device, storage medium and device
CN110912930A (en) * 2019-12-13 2020-03-24 杭州城市大数据运营有限公司 Data interface management method
CN110912930B (en) * 2019-12-13 2021-12-28 杭州城市大数据运营有限公司 Data interface management method
CN111400219A (en) * 2020-03-15 2020-07-10 杭州卓健信息科技有限公司 Interface adapter and electronic equipment thereof
CN111309490A (en) * 2020-03-26 2020-06-19 北京奇艺世纪科技有限公司 Resource allocation method and device, electronic equipment and storage medium
CN111597059A (en) * 2020-04-18 2020-08-28 北京奇保信安科技有限公司 Interface calling request processing method and device and electronic equipment
CN112422643A (en) * 2020-11-02 2021-02-26 中关村科学城城市大脑股份有限公司 Third-party interface protection request forwarding method and device
CN112769700B (en) * 2020-12-29 2022-07-05 浙江合众新能源汽车有限公司 Routing method and routing system based on application method number
CN112769700A (en) * 2020-12-29 2021-05-07 浙江合众新能源汽车有限公司 Routing method and routing system based on application method number
CN112769975B (en) * 2020-12-31 2022-06-24 武汉联影医疗科技有限公司 Data integration method and device, server and storage medium
CN112769975A (en) * 2020-12-31 2021-05-07 武汉联影医疗科技有限公司 Data integration method and device, server and storage medium
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN114996181B (en) * 2021-03-02 2023-09-26 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN113242241A (en) * 2021-05-11 2021-08-10 浙江鸿程计算机系统有限公司 Method for converting SAP RFC protocol into HTTP protocol
CN116700940A (en) * 2023-08-08 2023-09-05 成都数智创新精益科技有限公司 Request handling method, system and device based on encapsulation class and medium
CN116700940B (en) * 2023-08-08 2023-10-03 成都数智创新精益科技有限公司 Request handling method, system and device based on encapsulation class and medium

Also Published As

Publication number Publication date
CN107918562B (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN107918562A (en) A kind of unified interface management method and system
CN108471366A (en) A kind of stereoscopic monitoring system of facing cloud native applications
US9633358B2 (en) Interactive presentations with integrated tracking systems
CN108965381A (en) Implementation of load balancing, device, computer equipment and medium based on Nginx
CN111581054B (en) Log embedded point service analysis alarm system and method based on ELK
CN109344170B (en) Stream data processing method, system, electronic device and readable storage medium
CN110515912A (en) Log processing method, device, computer installation and computer readable storage medium
US20030167180A1 (en) System and methods for determining contract compliance
US7853562B2 (en) System and method for obtaining information from a data management system
FI114066B (en) Traffic flow analysis method
CN111861140A (en) Service processing method, device, storage medium and electronic device
CN106888135A (en) The querying method and device of a kind of task status
EP1401181A1 (en) Method and apparatus for integrating data aggregation of historical data and real-time deliverable metrics in a database reporting environment
US20150332316A1 (en) System and method for unifying user-level data across different media platforms
CN105224296B (en) Web service Qos attribute evaluation system and its evaluation method based on independent third party
CN110022354A (en) Mobile application integrated approach, device, computer equipment and storage medium based on http protocol
US7363368B2 (en) System and method for transaction recording and playback
CN111931189B (en) API interface reuse risk detection method, device and API service system
CN109460307A (en) Micro services a little, which are buried, based on log calls tracking and its system
US20050086664A1 (en) Method and apparatus for transaction tracking in a web presentation architecture
US10922624B2 (en) Identifying users of shared devices based on user interactions and identity graph
CN106559498A (en) Air control data collection platform and its collection method
CN109409948B (en) Transaction abnormity detection method, device, equipment and computer readable storage medium
EP1189160A1 (en) Method and system for transforming session data
CN113821254A (en) Interface data processing method, device, storage medium and equipment

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