How-to: How the infrastructure of a hosting provider is built
The business of hosting providers is extremely technological - in order to ensure the smooth operation of even the largest and most popular sites, it is necessary to create a powerful infrastructure. Today we will talk about the architecture of the external systems of the 1cloud project .
Infrastructure Elements
When building the infrastructure, it was decided to maximize the separation of the various components of the product, which can be called "hosting services". With an increase in load, this approach will allow us not to split a single application and not to deal with complex migration, but simply transfer the necessary service to a new server.
The 1cloud system consists of the following components:
- External site
- Inner panel;
- Admin panel and support services;
- Notification Service;
- Task processing service;
- Billing service;
- Service for working out tasks asynchronous in time;
- Monitoring service.
When creating services, C #, ASP.NET MVC 5, Entity Framework 6.1 technologies were used. All of these components are connected by a common software part called DataLayer - it contains information on models, static methods, and general dictionaries. The same decision defines the so-called data facade for working with the database.
Schematically, the infrastructure can be represented in a similar way: By clicking on the image, the image will open in full size .
External site and internal panel
The main site 1cloud , which we recently talked about redesigning , is used to attract new customers and serves as a kind of showcase that visitors primarily see. To increase the conversion of site pages, important elements were added for users, such as a calculator that allows you to calculate the cost of services (this decision was made based on an analysis of the behavior of visitors to the previous version of the site, where this page was divided into two).
The internal panel is primarily focused on performing typical operations for managing its servers and paying for services (integration with the MoneyOnline payment gateway has been implemented).
There is also an “administrative” part of the site, access to which is available to support staff.
Any action performed on an external site, admin panel or control panel is not executed immediately, but is queued for asynchronous processing (in other words, the corresponding task is created - task). Only information entered into the database is instantly recorded.
Task processing service
The created tasks are handled by a special service. Processing is carried out according to the fifo method in parallel. There are several types of handlers - it depends on the type which handler will interact with the incoming task. This service is responsible for working with the API of third-party systems.
During task processing, it is often necessary to send notifications, which are also not sent immediately, but are queued for processing.
Notification Service
This part of the system was originally designed with the expectation of working under significant loads. In particular, thanks to this, the service does not perform almost any analysis of messages sent (there is only protection against sending duplicate alerts).
All correspondence parameters (fields to whom, from whom, subject, message body in html / plane text) are determined at the level of the task processing service. The notification service also works on the basis of the fifo principle.
Billing subsystem
One of the most important elements of the system from a business point of view. This service is responsible for charging services and debiting money from customers. Every 10 minutes, the service collects the parameters of the ordered services, calculates the cost and, accordingly, deducts from the personal accounts of users. At present, the subsystem is not particularly complex - and this is one of its main advantages, since such an architecture is easier to maintain (although the number of generated operations per day at first made us difficult to deal with separately). In the future, we will have to develop billing, since it is planned to introduce new services and a payment model for actually consumed resources (pay as you go) - during this project, we plan to work with the VMware vSphere API.
Asynchronous Message Service
The hosting provider has to periodically bother customers with automatic messages (for example, reminders about the removal of a blocked server after 14 days). Such messages can be created only by a “specially trained” service, which receives information from other modules of the system.
Monitoring system
The "chief diagnostician" of the system, which mainly monitors its internal health and looks for errors like freezing tasks or failures during their processing, problems with billing, sending messages and parsing logs (the log4net component is used for logging).
Plans
In the future, we plan to launch a load balancing service, which will allow customers to order load balancing for an application that is also running on servers in geographically dispersed data centers.
That's all for today. Write in the comments about what elements of the infrastructure of the hosting provider would you like to know more?