Ways to Save on your Altinity.Cloud bill
Your applications are up and running and your business is growing robustly. That’s great, but you want to make sure you keep your costs reasonable as your storage and compute needs grow. Altinity.Cloud has a lot of options and controls that can be used. Here’s a list of them.
Understanding Your Bill
Your Altinity.Cloud Bill is available on the Billing page. Once opened, you’ll see the Usage Summary at the top:
Figure 1 - The billing summary
You can also drill down to specific clusters or environments, but at a high level the summary gives you an understanding of where you spend money.
The are three major line items:
- Support is based on the number of ClickHouse nodes.
- Compute is based on the number of vCPUs.
- Storage (both data and backup) is based on the data volume, and billed only for environments in the Altinity account.
(There’s also the obvious approach of prepaying your bill, which can give you a discount of up to 30%, We cover that later.)
Addressing any of these can reduce your bill. Let’s get started!
Compute Costs Optimization
Compute instances are the biggest part of the bill for many Altinity.Cloud users. There are several ways to reduce the cost.
1. Make sure you are not overprovisioned
Altinity.Cloud has built in monitoring that helps to understand system workload. Check the load average of your ClickHouse nodes. It should be close to the number of vCPUs of the corresponding node type. If it often goes above this level – your nodes are overloaded, if it is below half of vCPUs most of the time – your nodes are underloaded and can be scaled down.
Sometimes schema and query optimization helps to reduce the load. Check query statistics on the Workload tab of the Cluster Explorer in order to understand queries that take use the most CPU.
2. Pick the right instance type
Altinity.Cloud runs in multiple cloud providers and comes with predefined node types for ClickHouse that are suited well for general workloads. However, it is often possible to pick node types that work better and more efficiently for the particular application.
AWS gives you the most flexibility. Gravitons are processors produced by Amazon specifically for AWS. Graviton 2 was the first to work well with ClickHouse starting in 2020. It is 20% cheaper than corresponding Intel m6i instances but slower. Graviton 3 was a big step forward in terms of performance, but the 20% faster/cheaper ratio compared to Intel m7i ones persisted (see the Tournament of AWS CPUs we did a while back). Graviton 4 is the best so far, and m8g/r8g is on par with other node types. So consider the newest Graviton based instances – it will cut compute cost with insignificant performance degradation.
Another possibility is to use compute nodes with more RAM for one CPU core. By default, Altinity.Cloud nodes have 4 GB of RAM per core. Sometimes you need more RAM but fewer vCPUs. Both GCP and AWS have such options, and it may significantly reduce your costs. For example, moving from 8 vCPU 32 GB m7g.2xlarge instance to r7g.xlarge with the same amount of RAM but 4vCPUs would almost halve your compute bill!
3. Use Activity Schedule
Sometimes you do not need the maximum performance all the time. Altinity.Cloud allows you to configure an Activity Schedule. You may define when your ClickHouse cluster is scaled up and down, or even paused completely. It especially makes sense for development or staging systems that do not need to run all the time.
For example, you may configure the staging cluster to run from 7AM to 23PM on workdays, and be paused on weekends. That will save 5*8 + 2*24 = 88 hours per week, that is more than 50% of the hours in a week!
The Activity Schedule also applies to support. There is no support charge for inactive clusters obviously. Note that you do still pay for storage–you would not want to lose that.
Storage Cost Optimization
ClickHouse is very fast at scanning big volumes of data and it quickly develops a habit to store everything. In Altinity.Cloud it is easy to scale storage up, but it is harder to scale it down. So be careful with scaling, since it may result in big bills for storage. Below are some recipes in order to reduce data size.
But first, check your tables and understand which ones take the most disk space. You can do it in the Schema tab of the Cluster Explorer or the Cluster Metrics Grafana dashboard.
4. Store what you need
Make sure you store only the data you need. Altinity.Cloud has some tools to help with that. The Unused Tables section of our DBA Tools lets you find tables that have not been queried for a given period of time. Also check if there are any system tables that grow big – sometimes ClickHouse writes too much. The System Tables section makes it easy to truncate system tables or set a TTL to make sure those are cleaned automatically.
TTL rules can also be set on your application tables.
5. Use codecs and compression
Using column codecs and compression may dramatically reduce the data size and thus allow you to keep more data without the need to increase storage.
Altinity.Cloud uses LZ4 compression for all data by default. LZ4 is the fastest for both writes and reads, but it does not compress as well as ZSTD or some specialized codecs. So the easiest way to compress data more efficiently is to enable ZSTD compression server wide. It can be done by adding a server configuration file like config.d/compression.xml
:
<clickhouse>
<compression>
<case>
<method>zstd</method>
<level>1</level>
</case>
</compression>
</clickhouse>
This change only applies to new and merged data; old data needs to be explicitly recompressed.
You may also configure TTL Recompress rules for specific tables. See the TTL Recompress example in the Altinity Knowledge Base for details.
Finally you may configure column codecs. This may require quite a lot of work and experimentation, but at the end of the day it lets you get more efficient compression without cost compromises. For examples, check out the Codecs section of the Altinity Knowledge Base.
Keep in mind that you pay for more efficient compression with CPU cycles, especially on write. So when adjusting codes and compression, always re-check performance of queries and CPU metrics.
6. Use Object Storage as a Tier
Object Storage in ClickHouse was introduced back in 2020. Since then Altinity has put a lot of development effort into making it a production-ready storage option for any ClickHouse user, leading a community project to fix some limitations.
Still, object storage is a viable tiered storage option for advanced users today, see the instructions for working with object disks to learn how to configure them for a ClickHouse cluster.
7. Make a flexible backup schedule
Altinity.Cloud stores 7 daily backups by default. While backups are stored on non-expensive object storage, it may be a substantial amount for big clusters. In order to reduce backup costs, users may configure different schedules and retention. For example, if one configures 2 daily backups and 2 weekly ones, that would reduce backup storage costs more than twice compared to the default. Also in AWS, backups that are stored longer than 15 days are automatically switched to Infrequent Access S3 storage class that costs less.
Deployment Optimization
Altinity.Cloud gives users an option to choose from multiple deployment options, those having different price points.
8. Deploy BYOC
One of the ways to use Altinity.Cloud is Bring Your Own Cloud (BYOC). With this option, ClickHouse and infrastructure are deployed in your account. You not only own your data in this case. You can also control costs on your own by deploying reserved instances, savings plans, and credits, thus reducing cloud costs. In return, you pay a management fee to Altinity. Most importantly the BYOC fee is only based on compute usage. It does not include storage.
9. Use a Low-cost Cloud Provider
AWS, GCP, and Azure are the best known but not the only available cloud options. Altinity.Cloud can also run in Hetzner, reducing operational costs 2-3 times compared to major cloud vendors. Hetzner is somewhat bare-bones compared to the rich array of services offered by the major public cloud, but if you just need compute and storage, Hetzner may be a good option with a low price tag.
Billing Optimization
Finally, Altinity.Cloud provides several options to optimize billing itself. Let us name two of them.
10. Pay via Marketplace
Altinity.Cloud is available both on AWS and GCP marketplaces. Marketplace subscriptions are used for billing services only. But it has certain advantages. For example, all spends via marketplaces accumulate to user’s account spends thus allowing to claim private pricing agreements (PPA) and so on. If there are any credits those can be used to pay for Altinity.Cloud as well. It is a good option for startups. You may check with your cloud provider account manager for details.
11. Prepay for discounts
We do not discover America here, We’ll state the obvious here: if you pay in advance, there is always a discount. It can be a discount on the bill amount in whole, or a discount on compute only if prepayment is used to buy a savings plan. Please reach out to our sales team for various options.
More to come!
Cost optimization is a key focus for many Altinity.Cloud users. We’re constantly working on improvements to deliver better cost/performance for ClickHouse. One of our biggest areas of investment is better support for shared object storage. We’ll be announcing major improvements in this area soon. Check with us if you want a preview now.
A 12th way to save
Altinity.Cloud flexibility lets you find a workable solution for every user, small or big. We have explained 11 ways to reduce your Altinity.Cloud bill. But there is one more. We work as a team with our users to make everybody successful. So the last way is the easiest. Talk to our excellent support engineers or your customer success rep if you need advice on how to bend cost curves and use Altinity.Cloud more efficiently. There are multiple ways to cut costs specific to particular applications. Let us help you find them!