Video API Service on Serverless Engine

January 30, 2019 Python

Brief

On a recent project I did we provided a service for providing video data for many different clients like browsers, mobile apps and more. This service was in charge of fetching data from other external services and hiding all the “complexity” from the clients. The service authenticated the calling user with a passed JWT token.
After that it called another service to fetch video data that checked if user the authorized to watch the video. With that it will get the last viewed point in the video, so the user will have a great experience as continuing the video from his last watched point. And last item was to check if the user has signed the proper waiver for watching the video (fitness and health videos).

Tech Stack

We used python 3.6 as of programming language, with the “serverless” framework. It was deployed to lambda functions.
For automation we used Travis.
We used git as our version control on Github.
Our testing was built with pytest both for unit tests and integration tests.

Flow

At first we ran all the code and external services http calls as sequential code one after another.
But as we decided to improve the response time, we moved some independent calls to run in parallel and we cut the response time in almost 40%.

Data storage

We used DynamoDB from aws. For storing waivers signing and for storing cached responses from other services.

Leave a Reply

avatar
  Subscribe  
Notify of