Few things boost the morale of a developer as much as seeing an application being used. But things can get dark when your monthly cloud bill arrives. 

12 Cloud Savings Tips Developers Should Know

Some developers see the management of computing costs as the responsibility of the DevOps team. You code and distribute software, but don’t worry about the cost. However, this is a wrong idea.

Smart developers know that their coding artifacts make a huge difference to their company’s finances. Larger code is slower and requires more cloud resources to run. Choosing a good algorithm and writing concise code means more than just speed. Properly written code is less expensive to run.

However, it is difficult for developers to keep this in mind all the time. It’s easy to write code on your own machine. When you purchase the device, you also pay for RAM and additional disk space. If you have 2 terabytes of disk space, you may not notice how much space your code is consuming. Even if the new algorithm takes twice as long to run, it won’t do anything to your device. Even if it takes a few more milliseconds, who can detect it? However, doubling the computation will definitely increase the cloud charge.

Related: Why Edge Computing Matters

Cloud developers know they have the power to make smart decisions when writing code. This can be as simple as running a profiler to identify slow parts, or avoid unnecessary data storage and reduce memory footprint. 

Here are 12 ways to simplify your code and make it fast and cost effective. 

Write Code Faster

Most developers don’t spend that much time optimizing their code. Because it runs instantly on your own laptop. You don’t even realize it’s 20%, 30%, or even 300% slower over time. The program still seems to respond quickly. 

But when it happens millions of times on the server, the difference accumulates. Careful profiling can spot the slow parts. By rewriting them, you can reduce the number of instances required by your application.

Reducing your RAM footprint 

RAM usage is an important variable in cloud instance pricing. Usually, doubling the RAM doubles the cost. If you don’t keep the data in memory, you can reduce your RAM footprint. Some streaming algorithms, such as the Java Stream class , are designed to work with large files without loading them into memory. The Apache DataSketches project creates approximations for complex big data statistics without occupying all the memory. 

Reducing your RAM footprint 

Discreet RAM consumption has the added benefit of speeding up the algorithm. Sometimes the operating system will use virtual memory to move data to disk. This can dramatically slow down programs while avoiding crashes.

Using Low-Resolution Images and Images Using

low-resolution images and images is advantageous in several ways. First, the storage cost is low. Second, the data export fee is lower. Third, the application feels faster to the user.

All static images should be minimized in the first place. However, to what extent to minimize it can be a tricky decision. This is because, when a certain level is reached, the visual quality deteriorates to a degree that is obvious to the user. A good choice is a design decision that some programmers cannot make. 

Some applications that use uploaded images may generate small thumbnails and reduced resolution versions of the images after they are received. Toolkits such as ImageMagik and formats such as WebP have been developed for this purpose. 

Discarding unnecessary data

Discarding unnecessary data

Many developers store loads of information that they may need in the future. There is no way to fill a table with endless columns and delete rows. If you own the hardware and have a large disk drive, there’s no problem. But the cloud charges for everything. Will these values ​​really be needed in the future? Do users really want that much detail? Discarding old data can reduce data storage and retrieval costs.

Related: Data Management platform

Limit disk storage

Using local disks on cloud instances can be both dangerous and expensive. Local disk space is designed to be fast enough to run the operating system efficiently. The majority of developers create code on personal devices with a terabyte or more of storage.

Limit disk storage

However, cloud device storage is neither cheap nor readily available. Often, the cloud charges directly for storage based on size. Therefore, it is best to use as little storage as possible. You need to consider how to minimize the necessary system libraries and software packages, as well as the temporary files your application creates.

Log File Cleanup

Log files are very useful for identifying problems during development and debugging software. However, once the code is put into production, there is no need to maintain it all. Excess information always clogs up local disk or object storage. When designing a logging system, it should be set to delete logs frequently. Several log packages, such as Log4j, can be configured to keep logs to a minimum and periodically delete them. 

Serverless-oriented

Serverless architecture pricing plans only charge when your code is running. So if the load is intermittent, you can significantly reduce your charges. Even applications with continuous users have more downtime than expected.

Many serverless plans are advantageous for careful coding that consumes minimal RAM and very fast speed. The billing method counts the response time in milliseconds and only the time the processor is occupied is billed. As a developer, you can directly track reaction times and understand the impact of code changes.

The serviceless approach is ideal for small or experimental projects, often costing only a few cents per month. If your application runs certain functions intermittently, it makes sense to go serverless. 

Old data movement As

data becomes stale, it is used less frequently. If so, your application can be set up to move older data to a less expensive location. Some clouds charge much lower for so-called ‘cold storage’. Cold storage can take minutes or even hours to transfer information. 

Clouds like Wasabi and Backblaze specialize in retention storage for Amazon S3 objects, and charge extremely low rates than larger clouds. In some cases, there is no charge for data export. Clearing data when demand is no longer high can be extremely cost-effective. 

Simplify CSS Layout

3 2

For HTML tags generated by some frameworks, the layout can be ridiculous. It is a form with DIV tag inside DIV tag from beginning to end. It costs money to create and deliver it. As far as I know, a web designer has reported cutting network charges by 30% by using CSS carefully and simplifying the layout.

Building static sites

Some frameworks like React require significant computing power, especially when using features such as server-side rendering. These codes increase your monthly cloud bill. The opposite approach is to build a static site with immutable HTML, CSS, and JavaScript served literally from a cache. Content delivery networks (CDNs) allow you to speed up delivery even more by moving caches closer to users.

Several frameworks embrace this static site philosophy. Jekyll, Hugo , Gridsome , and Pelican are representative tools that wrap entire content into a series of small, immutable files. Customization of the page by AJAX calls is still possible. However, it does not generate much load on the server.

Externalizing computation and storage

As browsers become more powerful, some frameworks have made it simpler to move computations directly to the client. Good JavaScript or WebAssembly code can offload the cloud server by shifting more of the load to the user’s machine. Some developers are reducing the cloud tier to just a database with some business logic for authentication. There are cases where everything is run with static HTML and server-side PostgreSQL version (the procedure for outputting JSON is embedded). 

Browsers also have sophisticated options for storing information locally, such as the HTML Web Storage standard, the W3C Indexed Database API, and so on. It’s no longer short strings and cookies. This data is available more quickly because it doesn’t travel over the Internet, and users have peace of mind knowing that the data isn’t stored in a central, hackable database. It can reside on the user’s device for free, so why spend money on data storage and export? 

Appoint a cost engineer

Some developers specialize in database administration. Others like to make a beautiful first impression with a great front design. Now that cloud costs are so fluid, some teams formally appoint ‘cost engineers’ to manage code costs and efficiencies. 

The cost engineer’s responsibility is to ensure that application code runs cleaner, faster, lighter, and consequently cheaper. This assignment of responsibilities emphasizes the importance of managing code costs as part of the development team’s roles and responsibilities. 

Similar Posts

Leave a Reply