Horizontal Scaling of KVS (Kernel Video Sharing)
Project Description
The client is a company that provides entertainment video content with a core audience in Europe. The bulk of the infrastructure was hosted on bare-metal servers. Kernel Video Sharing was used as the core of the architecture, providing storage, moderation, and distribution of video content. The main issue was that the service involves a monolithic architecture and vertical scaling of nodes. This led to significant overexpenditure at the start of new projects and the inability to dynamically adjust and scale capabilities.
Main requests from the client:
  • Optimize expenses at the start of new projects.
  • Conduct an audit of the third-party KVS solution and, if possible, enable its horizontal scaling.
Key Metrics
  • 20x reduction in the time to deploy a new project.
  • 3.4x reduction in monthly infrastructure costs at the start of new projects.
Key Challenges and Results
We thoroughly reviewed the documentation from the KVS vendor and concluded that the possibility of horizontal scaling was not initially intended. All service components are located on one server, which is convenient for deployment but greatly reduces flexibility.
The client usually rented a bare-metal server for a new project, which initially led to significant underutilization of capacities, and then to the impossibility of increasing them in case of a sudden increase in load.
In the first iteration, we considered the possibility of deploying nodes as monolithic self-sufficient nodes on virtual machines. Subsequently, we managed to find a way to divide and automate the deployment of the service on several independent virtual machines:
  • Frontend (nginx + specific client-side PHP code)
  • Administration module (video moderation, conversion, and other tasks)
  • Database
  • Sphinx node (search engine)
By implementing MariaDB MaxScale, we were able to achieve effective horizontal scaling of the database, dividing the intensive load on reading and writing across different nodes. Other architectural elements were also modified to allow for quick horizontal scaling of the number of nodes.
All new projects are now fully described using terraform and ansible, which allows deploying the entire infrastructure for a new project from scratch within a few minutes, adding or reducing the number of necessary nodes. Reliability also increased due to geo-redundancy of critical elements. The client gained the ability to start with a minimal-sized virtual infrastructure, increasing capacity as load grows. This led to a 3.4-fold reduction in the average cost of maintaining infrastructure at the start compared to previous indicators.
All IaC code and documentation on scaling were handed over to the client.

Related services
CI/CD implementation services & development process organization
We provide CI/CD implementation services & development process organization services for your business
We provide Containerization & orchestration services for your business
The Wise Ops Team creates a scalable and fault-tolerant environment by deploying application components into containers using Docker and Kubernetes.