NGINX Full Version

实时 API 如何助力我们的日常生活

The other day I went to dinner and it made me appreciate the need for fast application programming interfaces (APIs). Confused? Let me explain.

To get to dinner I used an app to hail a car from my smartphone. Most of us are familiar with this routine – you open the app, enter your destination, get a ride, step out of the car when you arrive, and pay for your trip automatically using the credit card on file. While you’re waiting for the driver to pick you up, the map updates in real time to indicate the location of the car on approach. But on that day, the app did not update the map. I waited five increasingly uncomfortable minutes, not knowing if a driver was on the way or had even accepted my request. After 10 minutes, I got frustrated and switched to an alternative ride‑hailing app! This time I was successful and watched in real time as my driver approached and picked me up. I made it to dinner with a few minutes to spare.

The takeaway? Real‑time information is critical to today’s digital experiences. Let’s look at another example.

I recently checked out an Amazon Go store in San Francisco. What a marvelous experience that was! With the Go app downloaded to your smart phone, you just approach the door and it unlocks automatically. As you walk around the store, any item you pick up is automatically added to your virtual cart, and automatically removed if you put it back on the shelf. When you are done, you just walk out! Your card on file is charged and you receive a receipt by email. No lines, no checkout counter, no delays, and no cashiers. It’s an easy, effortless in‑store shopping experience. Amazon Go accomplishes this by connecting a series of real‑time systems, including ones for computer vision, sensor fusion, and deep learning technologies.

Yet again, we see real‑time information is critical to a good experience. And that, evidently, I don’t like taking my credit card out of my wallet.

APIs Are the Connective Tissue of Good Digital Experiences

What’s the technology powering such convenient, and thus satisfying, consumer experiences? APIs! Specifically, real‑time APIs.

In the case of the ride‑hailing app, being able to track the approaching car’s location in real time has some somewhat intangible benefits – it assures the impatient (and aren’t we all?) rider that progress is being made, gives you something to watch as you wait (if you’re bored), and let’s you know when arrival is imminent so you can start looking for the car. On a more practical note, you can tell when the driver has taken a wrong turn and get in touch to help course correct (this has actually happened to me). During the actual journey, both you and the driver can see exactly where you are and can extrapolate how much longer the trip will take. And finally, paying with a card on file is much more convenient than paying a cab driver (by either cash or card), and you don’t have to calculate a tip.

In the case of the Amazon Go store, the entire experience is predicated on real‑time processing: as you enter the store you’re identified immediately and your credit card info accessed so it’s ready even if you just grab one item and dash out. The Go app keeps a running tally as you take or replace items on the shelves, so you don’t have to wait for it to calculate the total cost before you leave the store. You don’t even have to get out your wallet (or worse, wait while the person in front of you watches idly as items get rung up and bagged, and only then starts rummaging through his or her backpack looking for the wallet). Any processing delay that interferes with this frictionless shopping experience, and you might as well walk down the block to a traditional store.

There’s a lot riding (pun intended) on consumers having good, real‑time experiences. The barrier to switching to a competitor in the digital world is very low. That’s why companies like Uber and Amazon invest significantly in ensuring they retrieve information in real time. In fact, Uber relies on Google Maps to provide directions for its drivers and render visualizations for its riders. What does Uber pay to deliver this value? Over a two‑year period they paid Google $58M.

What Does “Real Time” Mean? Less than 30 Milliseconds

Real‑time transaction processing and analytics have become an important building block for compelling digital experiences. How do we characterize what real‑time is? Research suggests real time has to be less than 30 milliseconds (ms).

Consider these proof points:

Real time is all about minimal delay, and the tolerance for latency is getting lower and lower. It’s fair to say that to be perceived as real time, processing has to take no more than 30ms, and in some cases as low as 13ms.

More specifically, the 30ms latency threshold must be maintained all the way up to the 99th percentile of processed requests (meaning that on average only 1 request in 100 takes longer than 30ms). To learn why this is important, read our blog about performance benchmarking of API management solutions.

Real-Time Experiences Require Real‑Time APIs

I opened by saying my dinner made me think of APIs. Let’s connect those dots.

Real‑time experiences rely on API connectivity. Uber retrieves Google Map data via an API call. Amazon connects in‑store Go infrastructure with sensor, vision, and analytics capabilities via API calls.

It stands to reason that a real‑time experience is heavily reliant on real‑time API calls. That means your API infrastructure needs to process API calls in 30ms or less. For some use cases, you need as little as 6ms!

That might not sound difficult, but let’s consider that API infrastructure has to:

Thus, we define a real‑time API as:
One that can process an API call end-to-end in less than 30ms.

And we define real‑time API infrastructure as:
The technology to route, authenticate, secure, shape, and cache APIs in less than 30ms.

Everyday Use Cases for Real‑Time APIs

There are plenty of activities in the digital world that harness the benefits of real‑time APIs. Let me go through some of these.

Chat

Why real‑time APIs are needed: We have all used chat apps in our lives. Nowadays chat seems to be the preferred customer‑service platform for many enterprises, especially in B2C verticals. Chat has replaced 1‑800 customer service numbers! Many chat applications are site plug‑ins that require API calls to a third‑party chat tool or bot.

How not having real‑time APIs affects your business: Low latency for your chat apps is a crucial factor in the customer experience. Without real‑time API calls you will lower customer satisfaction, which can impact revenue and decrease your net promoter score (NPS).

Fraud Detection

Why real‑time APIs are needed: The financial services sector employs fraud detection technologies on credit card transactions at the point of sale. These enterprises process large amounts of data and use predictive/forensic analytics to detect any outliers. For example, are there a large number of high‑value transactions occurring within a short span of time? Is your card being used far away from where you usually shop? Such transactions are flagged as deviations from the cardholder’s usual purchase pattern and the card processor might either block the transaction or call the cardholder for explicit confirmation of the purchase. All this needs to happen in real time, when the customer is at the point of sale.

How not having real‑time APIs affects your business: Chances are your cardholders have more than one credit card. If your transaction takes too long, or gets denied, then they’ll simply use another card. You need real‑time APIs to prevent customers from using someone else’s products and services.

IoT

Why real‑time APIs are needed: IoT is changing our lives at incredible speeds! Let me illustrate a few examples where APIs are used in our everyday lives, and must be done in real time:

How not having real‑time APIs affects your business: A lack of real‑time APIs can prevent adoption of disruptive services like voice‑controlled smart devices, in‑home medical care, and driverless cars. Preventing these new services from reaching their full potential stalls revenue and market expansion.

NGINX Is the Proven Foundation for Real‑Time API Infrastructure

Delivering transformative experiences requires a high‑performance API management solution. NGINX powers more than 400 million websites and, according to our 2019 user survey, more than 47% of NGINX Plus (and 35% of NGINX Open Source) users have already deployed NGINX as an API gateway, the foundational layer in any API management solution. That doesn’t even include all of the solutions where NGINX is a key component, such as traditional API management providers Axway, Kong, MuleSoft, Red Hat 3Scale, and others.

Why is NGINX foundational to all this API infrastructure? We reliably see NGINX process API calls in less than 30ms, with customers telling us 6 ms is common. It’s the only real‑time API solution on the market.

Do you need to serve APIs in real time? We’d love to hear from you in the comments below. Or you can contact our sales team to request a free assessment of your API’s performance. In the meantime, read this report about by IDC to learn about API trends and best practices for API lifecycle management.