How Real-Time APIs Power Our Lives
How Real-Time APIs Power Our Lives
In this article, see how real-time APIs power our lives in different ways, such as going out to dinner.
Join the DZone community and get the full member experience.Join For Free
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.
You may also enjoy: Building Real-Time Analytics APIs at Scale
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:
- 13 ms for humans to process images. According to a study by neuroscientists at MIT, the human eye can process and identify entire images in as little as 13 ms. Researchers asked subjects to identify a series of six to twelve images, each presented for between 13 and 80 ms. The fastest rate at which subjects identified these images was 13 ms.
- 20 ms to synchronize video. An IEEE paper about using 'Media fingerprinting' technology to prevent loss of synchronization between image and sound when delivering video content states that the tolerable limit for latency is between 6 and 20 ms.
- 30 ms to deliver wireless data. Ubiquitous connectivity is on the horizon with the introduction of 5G technologies, which promises peak speeds of up to 1 Gbps and latency of less than 30 ms. Why such low latency? Because 5G needs to be that fast to replace in‑home WiFi and wireline broadband like fiber and cable modems.
Real time is all about minimal delay, and the tolerance for latency is getting lower and lower. It's fair to say that real time has to be at least 30 ms, and in some cases as low as 13 ms.
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 30 ms or less. For some use cases, you need as little as 6 ms!
That might not sound difficult, but let's consider that API infrastructure has to:
- Route APIs. Ensure the API consumer — like your ride-hailing app — is correctly directed to the right backend resource, like the mapping service.
- Authenticate APIs. Is this API consumer a valid user allowed to access this backend resource? You have to authenticate the user to ensure it is.
- Secure APIs. Encryption is table stakes these days. APIs are arguably the gateway to your most critical application capital, so they better be secure.
- Shape APIs. Not all API calls are equal. You need a way to shape the traffic to avoid resource contention, provide proper bandwidth, and prioritize certain API calls.
- Cache APIs. Many companies process billions of API calls per day. How do you handle that volume? Caching API responses is one way to boost performance.
Thus, we define a real-time API as:
One that can process an API call end-to-end in less than 30 ms.
And we define real-time API infrastructure as:
The technology to route, authenticate, secure, shape, and cache APIs in less than 30 ms.
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.
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 plugins 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).
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.
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:
- Home automation: Do you have a remote that you can talk to? What about a home automation device powered by Alexa or Siri? A good experience requires real-time voice calls to control everything from streaming video to smart blinds that automatically adjust for optimal sunlight and privacy depending on the time of day.
- Medical device monitoring: IoT is increasingly being used to monitor patient health — from cancer to diabetes. A variety of vital parameters such as glucose levels or blood pressure are recorded on a daily basis. Updates are then sent to the patients' physician who administers appropriate treatment. Accomplishing this in real-time is paramount for improving patient outcomes.
- Driverless cars: They're coming! This technology uses a variety of sensors and software to control, navigate, and drive the vehicle. Key decisions about the best route to take and when and where to stop to avoid or minimize collisions all have to be taken in an instant by analyzing large amounts of data collected by the sensors.
How not having real-time APIs affects your business: A lack of real-time APIs can prevent the adoption of disruptive services like voice-controlled smart devices, in-home medical care, and driverless cars. Preventing these new services from reaching potential stalls revenue and market expansion.
Published at DZone with permission of Karthik Krishnaswamy . See the original article here.
Opinions expressed by DZone contributors are their own.