What is the API interface platform? What is the role?

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/red_sheeps/article/details/100827452

In each of the Internet is never a lack of a unified API interface platform, the company, departmental and so on. There is reasonable, what a background of the birth interface platform, in order to solve the problem? How to deal with it?

Interface Management

A system call System B, both sides test various FBI, and finally transferred through the day. Meet with the on-line, on-line evening underestimate the amount of no problem, then the next day on the amount being given a meal, we all panicked, and quickly re-take process, emergency fallback. Down to the end of a process, not an hour, and can be imagined, R & D center is the small brother of collapse. If the entire call chain can do it in seconds fallback it must have been excellent.

FBI re-tested, and ready on the line, led by the last question out fear, little sister came to the test, asked: are the full measure of it. Little sister replied that the measuring features are measured, and are reasonably typical run through, but a wide range of parameters of the line, can not say 100% no problem. Leadership, suddenly face down on the sink, a half-day test is not yet known interface has no problem ah. Leadership thought, if we can have online component features not Miya?

Gingerly on the line, God bless Fortunately, the interface operating normally, business systems did not jump. R & D brother hanging heart also come down, leading again, and asked: How? Nothing new interface on the problem, right? R & D brother with confidence: No problem, various business systems are properly informed, and no abnormal feedback received. Leading one, frowned on their own line of business system interface requires the system to verify that there is a problem, a little passive. It seems, interface monitoring is necessary to put on the agenda.

Suddenly one day, one of the other business units to run it: your interface has a problem ah. Various abnormal data, how is it? R & D brother thought: Recently did not make the line ah, how there will be problems, other problems caused by it. Bottom of my heart more, retorted: We have not changed recently, you check under their own problems now. The results of the investigation meal and found the interface name too similar to result in a wrong. R & D brother took a deep breath, leadership development took little brother said: This incident also reflects the potential problems of our system, like how to adjust the interface on how to adjust, and must have interfaces authorization functions ah.

And proximity to big promotion, most recently during the pressure test the various systems. R & D needs little brother put pressure measurement interfaces have carried out the expansion, I thought: it should be nothing issue. The next morning and saw all kinds of mobile phone alarm, each line of business systems have found him, he said interface call failure / timeout and the like, get up quickly troubleshoot problems, and found that a certain amount of calls last night, the interface needs no abnormal pressure measurement huge, affecting other interfaces. Leading furious: Interface limiting and Interface Isolation how to do?

As an interface platform, the interface downgrade is also essential, active downgrade / passive downgrade is a must, otherwise the system itself, or whether it could cause unpredictable impact on the business system.

Interface layout

There is such a scenario, the business would like to call interface A system, according to the decision to return the call interface port A is B or interface C, R & D brother pledged that, it is not that easy? Determine what is not good enough? If you want to change the logical follow-up of it? D tune the interface how to do? You have to change the code again more last line it? To change it to decision logic. If the call can be before the interface logic is encapsulated in an interface, the interface between the calling logic may be configured, for every business systems without on-line, but also to achieve a single interface, and control the same function, the business influence do the minimum.

Method to realize

These are the individuals that understand the API interface for the platform at the least need to have the following functions

  • Version control (second level rollback, component test)
  • Monitor / alarm
  • Authorize
  • Limiting
  • isolation
  • Demote
  • Arrange

version control

Version Control As the name suggests, is to maintain multiple versions of the same interface, increased on-line state, each interface can only have one on-line version for release in question can be achieved in seconds back. Function component, each interface maintains an environment advance for interfaces can be specified in the on-line environment, the components after opening, will verify the correctness of the specified interface environment.

Monitor / alarm

Record the operation of the interface, including the time-consuming / success / failure rate.
If an alarm is set, to see if the alarm condition, while others call alarm interface. (E-mail / micro-channel / SMS / outbound)

Authorize

Interface add token authorization verification and the like for each, there is no error or reject the call

Limiting

General large-scale systems are distributed, so the use of distributed limiting, redis + lua and so on, in order to interface dimension to limit the current.

isolation

Interface dimensions to allocate server resources, each interface calls without disturbing each other.

Demote

Initiative downgrade: API interface platform allows the user to set a downgrade mode, the interface dimensions, generally if registered on the API interface platform interface requires maintenance window, within that time the interface is often not available, the interface can be carried out at that point in time downgrade, return the default value of the class. Pro or a large time, some of the interfaces are allowed to be degraded, then in order to increase the throughput of the system, but also can be appropriately degraded.

Passive Downgrade: There is no system no problem, then the problem of how to get a good time to avoid it. Do as little as possible impact on business. Use fuse / is a good way to downgrade, Hystrix may be a better choice. Within a certain time window, the failure rate is much reach downgrade return to the default value, over a certain period of time, try to open the fuse, if that fails, continue to downgrade, if successful recovery call.

Arrange

To prepare conditions for a simple scripting language, based on the results returned by the calling script execution engine condition (yes / no), node (interfaces) to select a next should be executed. A plurality of interface combination ultimately object choreography.

to sum up

API interface platform is much more than so many features, I also shortly fourth year, for which the use of technology is scanty, Cipian theory-based, follow-up will write in-depth understanding of the point of technical points. Including Fused / downgrade generalization using the interface, the interface is implemented limiting the like. We hope to have a little bit of help it to readers.

Guess you like

Origin blog.csdn.net/red_sheeps/article/details/100827452