Caching
In this article:
Caching#
General information#
Caching is a set of K2 Cloud automated services that allows you to quickly deploy and configure popular data caching systems using cloud platform tools. We currently support Memcached and Redis caching systems.
Memcached is a high-performance and scalable open-source system for caching objects in memory. It allows you to store key–value data in a distributed hash table and retrieve it in less than a millisecond. To learn more, visit the official website.
Redis is an open-source resident system for caching data and managing databases. It handles key-value data structures and can be used as a database, cache, message broker, or queue. To learn more about Redis capabilities, visit the official website.
Before you begin#
To be able to work with the cashing service, a user needs to have PaaSServicePolicy project grants. For instance, such grants are available to administrators in CloudAdministrators group. If necessary, you can create a separate user, add the user to the project, and either attach the PaaSServicePolicy policy to the user or add the user to the group of cloud administrators in this project.
In addition, the project should have the following resources:
Мы советуем также ознакомиться с рекомендациями по работе с сервисом в облаке.
Launching the caching service#
To launch the service, go to the Service store or Running services subsection, select the caching service in the Caching tab and click Create.
The caching service launch procedure comprises the following stages:
Note
The text below refers to the Memcached-based caching service. Redis, whether a caching service or database, uses the same launch procedure. Its detailed description is available in the section on creating a database service.
Set the required network parameters for a caching service:
The configuration of the cluster in which the service will be deployed. Only a single node configuration is available for the Memcached service.
VPC where the service will be deployed.
Security groups to control traffic through the interface of the instance on which the Memcached service will run.
Subnet where the service will be deployed.
Set the configuration of an instance where the caching service will run.
Select the instance type and parameters of its volumes: type, size and IOPS (if available for a type).
Note
The caching service performance depends on the node components. We recommend using the Memory Optimized instance type.
In addition, you can also specify an SSH key. In this case, after automatic service setup, you will get an SSH access to the respective instances.
Attention
You can connect to instances using an SSH key while the new caching service is in a beta testing stage. This feature may be disabled in the future.
Set additional caching service parameters:
Service name – An arbitrary unique name for the service.
Enable monitoring – For centralized monitoring of a caching service, first deploy the Prometheus-based monitoring service.
Monitoring service – The selection of a monitoring service is only available when the Enable monitoring checkbox is checked.
Monitoring labels — Optionally, you can set monitoring labels, which the installed monitoring agents will assign to the collected metrics (for details, see Using labels). Labels can only be set when the Enable monitoring checkbox is selected.
Enable logging – For centralized PaaS service logging, first create a logging service. Once a PaaS service is created, you will be able to install logging agents manually only.
Logging service – The selection of a service is only available when the Enable logging checkbox is checked.
Logging tags – Tags are assigned to logs when the latter are imported by the logging service. They simplify search for the required logs. Tags can only be set when the Enable logging checkbox is selected.
Click Create.
Note
The service launching process usually takes 5 to 15 minutes.
Caching service configuration#
If you have not enabled monitoring or logging when creating the caching service, or you want to disable them, you can do it when the service is in the Ready state.
Note
To enable monitoring and logging, first deploy Prometheus-based monitoring service and ELK-based logging service.
Important
If an attempt to modify some settings fails, then the service will be reset to default ones.
To set up the caching service:
Go to PaaS Running services and open the Caching tab.
Find the desired service in the table and click the service ID to go to its page.
Open the Parameters tab and click Modify.
In the window that opens, you can configure monitoring and logging (or disable them if they are already enabled).
To save new settings, click Modify.
Environment upgrade#
PaaS services are updated regularly. If you want the already deployed caching service to support new features, then update its environment. For the current environment version, see the Information tab on the service page.
Note
All services with environment version 3_6 and higher support environment update. It is also available for some previously deployed services with environment version 3_5. To check if you can update them, use the API method DescribeService: the response should contain the common:update_environment
value in the SupportedFeatures list.
Important
If an attempt to update the environment fails, the service will be reset to the default one.
To update the environment version:
Go to PaaS Running services and open the Caching tab.
Find the desired service in the table and click the service ID to go to its page.
In the Information tab, click Update environment version.
In the window that opens, select the version from the list, to which you want to upgrade the current environment.
Click Update to change the version.
Deleting a caching service#
Deleting the caching service deletes all instances and volumes created with it.
You can delete the service using one of the following methods.
Go to the section PaaS Running services.
Open the Caching tab.
Find the service in the table and click on the icon .
Go to the section PaaS Running services.
Open the Caching tab.
Find the service in the table and go to the service page.
Click :Delete in the Information tab.