We would like to share the experience of modernizing the architecture of the web portal, which made possible to make the product convenient, stable and fault-tolerant: traffic increased from 350 thousand to 7 million users! The story will be useful to those who plan to expand their product. First, we’ll look at factors, which can interfere with the work and development of the web portal:

  • Mental obsolescence. The usability approach, adaptation to different devices, elementary appearance and structure cease to meet the needs of the audience over time.
  • Technological obsolescence. Web standards and technology are constantly evolving. Changes affect both developer tools (for example, frameworks, databases, other software), and fundamental base of the web. From relatively recent – a massive transition from http to https and abandonment of support for DNS legacy.
  • Errors and crashes. Developers can imperfectly cope with their task and allow flaws. As a result of this, can occur violations of the site – starting with the fact that the buttons don’t work from the first time, till the complete fail of the systems.

Case

We had a client whose web portal needed further development. At a certain point, an amount of 350 thousand unique visitors was reached every month. This seemed insufficient – the project clearly had prospects, and we had to find out what exactly stood in the way of further scaling the resource.

Audit

It turned out that the old Bitrix engine was not adapted to loads and scaling. Every single component of the system closely intersected and depended on each other. To constantly fix bugs was such a painful task that we proposed a flexible and understandable microservice architecture. In them, each component is independent enough so that the errors inside it do not “hurt” the remaining elements of the system.

Bitrix stayed as the basis of the architecture – at least, authorization is tied to it, but where it was possible and promised great efficiency, we transferred the functionality to microservices. Exactly they started to be the main part of the project.

The new combined architecture has provided us with stable, faster operation of systems and an almost complete absence of errors on some modules. It also served as the basis for the effective work of marketers. Because of improved architecture, promotion specialists managed to increase the attendance of the resource by 20 times.

Microservices

In separate microservices, we distinguished modules such as a file loader, search, and news feed. In addition to these user-friendly and obvious things, many other functional elements were implemented in the form of microservices:

  • Uploading, storage and management of data from open source projects;
  • Dynamic creation of RSS feeds;
  • Dynamic creation of a blocks system, composition of the materials of any services in structural blocks;
  • Adding additional data to service materials;
  • Technical support service;
  • A single catalog of various data.

In addition to all of the above, we have created many microservices for convenient work with the admin panel.

Each functional block of the site has become a fairly autonomous unit. A dedicated process is used for loading and rendering, minimizing intersection with other services.

It is obvious, that when the user makes a payment, he will not want to wait a long time for loading the script, which is responsible for playing the video in another part of the page. Indeed, this is what happens in monolithic systems – side functionalities sometimes interfere with the work of really important components.

We took the first step and made life easier for both users and developers, releasing more than 20 new services in a year. As a result:

  • We solved the problem of scaling.
  • Implemented a more efficient development process by distributed teams.
  • Set up dynamic resource management for smooth and fast system operation.

Technology Stack Upgrade

In parallel, we updated the technology stack. If the portal was originally based on php 5.6 and MySQL 5.6, then in the during the improving of engine, we switched it to php 7.0 and MySQL 5.7. Implemented Yii2 framework, provided memcache caching.

Task queue

In order to better parallelize tasks, we transferred web workers – internal handlers – to the RabbitMQ queue. It optimizes the sequence of triggering events, which reduces the load on the system. Working with the site has become much faster and more comfortable.

Continuous integration

A transparent and manageable development process is supported using GitLab CI. This is a truly continuous development that leaves programmers and testers more time with important questions instead of closing holes.

In order to minimize errors, we introduced additional development loops. The chain consists of several application and infrastructure testing loops: pre-release, where is the latest assembly testing (pre-prod), combat (prod), several test loops for testing few builds at once, as well as a loop for developers.

Assembly system

At the initial stage, builds are created from the project sources. Instead of a disparate set of classes, styles, and handlers, are used combined entities – each in the shell of one executable file. Only necessary constructions are placed in the assembly for performing events on the page. This additionally provides flexibility and speed of the site.

Error monitoring

GitLab CI provides advanced features for code validation and automated testing. At the slightest discrepancy of assemblies with the given parameters, the system notifies developers and doesn’t allow to start the further process of component implementation until bugs are fixed. Additionally, we installed Sentry, a complete error monitoring tool.

Process optimization

To maintain the system in a state of high performance, we have consistently optimized business processes and infrastructure. Shared libraries and prototypes of services became the basis for the rapid implementation of new functions – we take ready-made templates and in a short time we get a working product.

Monitoring and operation

All processes are in full view. To monitor the status of each node we provide Zabbix – a comprehensive tracking system. We got the opportunity to look into the very core of the project structure and see it compactly.

We also connected the Grafana platform, which turns data into a visual dashboard for the convenience of customer employees.

Stabilization and refactoring

Step-by-step, we refactored the system – the code is simplified and becomes concise. At the same time, there is always space to grow, since regular doping of systems speeds up the site. As a result, the resource has become more friendly to search engines and users.

New architecture is the basis for growth

At the start of work, the resource had a modest potential for promotion and was not convenient enough for customers, which impeded the company’s business processes. To improve the process of user interaction with the site, we almost completely updated the portal architecture and its structure, created a flexible mechanism that integrates with a large number of services and applications, thanks to our own API. Many services have been working optimally for more than a year, without requiring intervention – the number of errors in their work has decreased to almost zero.

The new site is a powerful tool for business development, with the potential for further scaling. Using the updated architecture of the web application, the project’s marketers were able to implement their range of promotional activities and increase traffic from 350 thousand unique visitors per month to more than 7 million. Moreover, after a multiple increase in audience, the portal continues to function stably.