Video platform

Case study

Business Challenge

The Global Forecast predicts that the global video streaming software market is expected to grow by 19.7% annually (Compound Annual Growth Rate) during the forecast period until 2025.

The main factors driving the growth of the video platforms include increasing penetration of mobile devices and internet users, growing demand for VoD streaming and impact of COVID-19 pandemic. Many companies from different industries immediately react to this market demand and look for custom video streaming solutions.

The client is one of the biggest players in online ticket selling operations in Central Europe and wanted to fulfill its customers demand for online content. They requested a video platform that would be able to communicate with its online ticket selling website and capable of handling up to 40K parallel users. The main idea was simple: right after the customer purchases a ticket for an online content he can watch the purchased video stream on his TV, smartphone or computer. In other words the client wanted to implement and integrate pay-per-view service at a large scale.

The challenge was to develop a video platform that would meet following requirements:

  •  Security
    • Implement a token (ticket) based authentication – no one without a valid ticket can watch an online content 
    • Protect ticket sharing, i.e. avoid parallel connections based on one valid ticket
    • Implement Geo IP address restrictions
  • High Availability
    • Design a fault-tolerant system which will highly dependable in case of video platform upgrades or maintenance
  • Scalability
    • Design a fault-tolerant system which will highly dependable in case of video platform upgrades or maintenance
  • Interoperability
    • Design an API that would communicate with client online ticket selling website

Our Solution

Our team of developers and devops engineers are well oriented in cloud design patterns and end-to-end (Day 0/Day 1/Day 2) cloud based solutions. Based on our experiences we designed a platform according to defined requirements, focused on the high load expectations.

Backend

 

The video platform backend was written in Lua, blazingly fast and lightweight scripting language which can be embedded directly inside Nginx web server. We decided to choose OpenResty project as a backend platform that integrates Nginx core, enhanced version of LuaJIT and many useful  Lua libraries. The client requirements for different levels of security were covered. Each sold ticket cointans unique token which is propagated from client’s website to our video platform via API. Token is used for client authentication and to keep an eye on any parallel connections. Incoming traffic can be filtered by IP address geolocation. Geo IP address database is updated on a regular basis. Designed API is used for user’s token registration and also as an admin console where the video content management system is provided. 

Frontend

HTML page with Javascript composed in Lua and served by Nginx web server.

Storage

 

Proposed video platform backend keeps its data (user’s tokens, video URLs) in the Redis in-memory data storage. Redis is another extremely fast piece of our video platform puzzle. The data persistence is ensured by Redis point-in-time snapshots at specified intervals. The backups of provided snapshots are stored in our backup server located in different DC.

Each registered video content is delivered to multiple CDNs from different providers to ensure redundancy. In case of failure, the affected CDN provider can be removed from the list of providers (via API) which guarantee a smooth run.    

Proposed video software and related components are packed in containers, tested by our GitLab CI pipelines and finally (to achieve high availability and scalability) shipped into the Kubernetes cluster. Application observability is ensured by complex dNation Kubernetes Monitoring solution. It provides a clear overview of relevant application metrics side-by-side with logs, which rapidly reduces incident resolution time.