Serverless is being explored and chosen as a cloud architecture options by start-ups keen to leverage the new technology to gain a disruptive edge, as well as by established enterprises looking to extract efficiency and cost savings from particularly cumbersome corners of their workloads.
Even in these early days of serverless, we are seeing some common serverless design patterns and use cases with serverless. The Apache OpenWhisk platform, for instance, appears to attract customers who fear vendor lock in and may even have their eyes set, contradictorily, on the idea of hosting their serverless functionality on their own infrastructure (or with another vendor) in the future, according to Andreas Nauerz, IBM senior technical staff member and technical product manager for OpenWhisk, which IBM open sourced last year.
Nauerz divided OpenWhisk users into start-ups keen to work with something new and build an entirely serverless application, and existing enterprises who might want to use serverless for a specific task, especially when they are dealing with volatile workloads that can be arranged as short processing tasks.
Amongst the OpenWhisk community, five use cases are emerging as key trends in how serverless is being used in production today. These are:
- Mobile Backend Development
- Data Processing
- Cognitive Processing
- Streaming Analytics
- Internet of Things.
Mobile Backend Development
Serverless could help developers better decouple front and backend development by helping enterprises create serverless microservices with API backends. “Customers implement little functions or actions that take care of a particular business logic like creating or querying a customer,” said Nauerz. “These functions are then being exposed to front end developers by making API gateway functionalities and giving the API endpoints to front-end devs to evoke.”
In particular, Nauerz pointed out, are serverless mobile backend environments. “The problem we usually have is that mobile apps need server side logic but mobile developers are experts in front end. So OpenWhisk makes it easy for them to develop their front end app and access the server-side logic that has been implemented for others. Using the API gateway, mobile devs can evoke them. For simple stuff, the mobile dev can do that in languages like Swift even on the backend side. We provide SDKs for iOS for consumption of these sorts of functions.”
This is how the mobile app WeatherGods uses OpenWhisk. The program aligns a different god avatar to represent each climactic phenomena (snowfall, for example). Mobile users can specific weather events they are interested in, like being notified when there is snow in Berlin.
“Architecturally, [the app] periodically scans the weather condition using weather company servers, then checks what each user has configured, and then executes OpenWhisk actions (called scanners) on the weather model. If that identifies something the user is interested in, like the snow in Berlin, it sets up a trigger to fire 15, 30 or 45 minutes before the weather event is meant to happen and mobile users receive the animated weather god notification.”
Data processing is a very dominant field for serverless, no matter the platform, and that’s also a key use case trend for OpenWhisk. In particular, image processing, or other tasks like noise reduction in sound files, are most common. What Nauerz sees is an increasing use of data processing of multimedia files in particular.
As mentioned at Serverlessconf in Austin earlier this year by Jason McGee, image processing of cheques drew on serverless architecture to handle key spikes in need rather than maintain unnecessary compute resources the rest of the time (for one customer, the majority of cheques needed to be processed on payday Fridays, for example).
Of course, other businesses are all doing image processing in serverless. One of the most ubiquitous serverless design patterns and use cases is one in which a hybrid model is used where image processing of object stored images (such as resizing images into a standard gallery of options) occurs in serverless and the results are then fed back into existing architecture workflows.
Similar to the data processing scenario is cognitive processing, where OpenWhisk is used in conjunction with IBM Watson ML algorithms to perform some cognitive tasks on a multimedia file. IBM has been floating the use case of an insurance company using drones to take images of properties and then using cognitive processing in a serverless environment to identify property damages and speed up insurance payment calculations or to carry out risk assessments.
“A drone flies over a certain area, continuously taking pictures,” explained Nauerz. “As soon as the images are stored in a database, they are analyzed. For example, you can train Watson to detect if a roof has hail damage. You can let the drone fly over an entire area and get the immediate results.”
It is such a compelling use case for IBM that they have since built the serverless example project Skylink specifically to help insurance companies to implement this idea. However, in informal discussions with a couple of insurance companies, it is difficult to ascertain if any enterprise is ready to implement such a use case in production.
So far, only nine GitHub members have forked the Skylink project example with only one of those forkers looking like they may work in an enterprise where there is a potential use case, the rest being hobbyists or working within IBM. Nauerz admitted it is possibly still early days for established traditional industries to be able to create a production-level workflow using serverless that can manage all the steps in such a process.
“So far, in these use cases, we have been talking about data at rest. But what you also want to do with serverless is to react to streaming real-time data feeds,” Nauerz said.
He described an integration with Kafka and Bluemix where data posted in Kafka can immediately start being analyzed. He suggested that financial use cases are one of the key pure streaming analytics serverless examples. The other, he says, deserves a separate category itself, namely…
Internet of Things
“Devices are continuously processing data but if you handled individual data points, that would be cost intensive,” said Nauerz. Instead, he sees a common design pattern emerging where data is pushed to Watson, which may have simple rules defined to identify thresholds. Where those thresholds are reached, for example, a sensor reading reports temperature exceeding a certain level, the additional processing is then triggered, such as activating a sprinkler.
Nauerz pointed to Abilisense as one business that is using Watson and OpenWhisk in combination to manage an IoT messaging platform for people with hearing difficulties. Abilisense provides an in-home device that continuously records ambient noise, extracts the audio when a spike occurs, such as may have happened if there is a smoke alarm or a window broken, analyzes that noise and then sends an appropriate light or other notification signals to the user so they can respond.
“The audio file is being pushed to object storage, then being analyzed, alongside any readings from additional sensors which are being pushed to the IoT platform using MQTT. So the audio file itself and then data from additional sensors are managed by defining rules which then evoke OpenWhisk actions where necessary,” said Nauerz.
In Abilisense’s case, said Nauerz, they were able to make some usage needs assumptions based on the expected thousand devices they will have operating. “They know how many action invocations they are expecting, the memory consumption, etc so they can do cost calculations. They estimated they could handle all the monthly load for less than $15 a month,” shared Nauerz.
Nauerz also pointed to Israeli smart city start-up GreenQ which uses OpenWhisk for an “internet of garbage” platform. GreenQ is optimizing waste disposal truck routes in Tel Aviv, estimating that by using serverless architecture to keep track of the truck locations, weigh waste bins, and analyze photos of waste bin contents, they can calculate optimal routes, lower city carbon emissions and create municipal cost savings of up to 50 percent. OpenWhisk is used in combination with Watson to improve the knowledge of city waste disposal management needs after each route.
The availability of an API gateway capability earlier this year has been a key usability factor for OpenWhisk and increases the viability of OpenWhisk as an option for some serverless architecture choices. Amongst the use case trends, it is interesting that while the platform is open source and Nauerz identified the lack of vendor lock-in is one of the key decision factors, users so far are not shying away from production use cases and are already advancing beyond using OpenWhisk solely for experimentation. In particular, the Santander and GreenQ examples point to the growing acceptance of serverless as a general purpose technology that is being drawn upon for business production uses.