Green coding - Diagrid: Code efficiency yields 99% drop in CPU usage

This is a guest post for the Computer Weekly Developer Network written in fully by Mark Fussell, co-founder and CEO, Diagrid.

A diagrid is a framework of diagonally intersecting metal, concrete, or wooden beams that is used in the construction of buildings and roofs.

Diagrid (as a company, not construction technique) is a company that promises developers the chance to code with architectural freedom and deliver with business velocity through its unified APIs for messaging, data and workflow which can be used to develop secure, reliable, event-driven applications and business processes. 

The company’s platform is powered by the popular CNCF open source Dapr project. Dapr is a CNCF incubating project maintained by our company, Diagrid, along with Microsoft, Intel, Alibaba and others.

Fussell writes as follows…

Many people may be familiar with the US online retailer SharperImage.com – for home electronics, gifts and other lifestyle products – which is run by Camelot SI LLC. The Sharper Image Commerce Cloud is composed of 70-plus microservices running in production on Kubernetes, processing in excess of 80,000 orders per day at peak periods such as Black Friday.

By transitioning to open source Dapr (Distributed Application Runtime), Camelot SI eliminated the overhead associated with its custom microservices framework leading to substantial cloud infrastructure cost savings. Dapr’s lightweight and efficient design has proven to be instrumental in optimising resource utilisation, delivering over 99% reduction in CPU usage from 3.5 to 0.03 cores.

Strategic streamlining shift

Strategically, this shift also helped streamline its microservices architecture, reduced the amount of code to maintain and enhanced operational efficiency. Since making the switch, the team has increased their Dapr adoption and developed other supporting apps to take advantage of the selection of Dapr building block APIs.

Camelot SI has been a user of the Dapr project for many years and it has become a core component in its business solutions. The Sharper Image Commerce Cloud depends on Dapr for pub/sub asynchronous communication, synchronous service invocation, state management, and task scheduling. 

Dapr has simplified microservices development by abstracting the complexities associated with setting up services compared to the previous in-house microservices framework. This simplification has directly contributed to an increase in developer output and focus on creating business value, rather than dealing with application architecture and infrastructure challenges. To further lower the operational overhead of running Dapr on their AWS-deployed Kubernetes clusters, Camelot SI became an early adopter of Diagrid Conductor in 2022. A free version of Conductor is available to developers. Right-sizing Kubernetes workloads is a complex ongoing task and one of the most frequent challenges an operations team encounters.

Sidecar architectures, as used by Dapr, can be wastefully resource-intensive if not implemented correctly. To fix this, Conductor provides detailed Kubernetes performance advisories for setting the optimal memory and CPU requests and limits for Dapr-enabled apps and sidecars, including a 10% resource buffer. 

Overall optimisation

Camelot SI uses these advisories to set resource requests and limits on its services, improve their overall provisioning and optimise usage of Kubernetes resources, reducing cost without compromising on performance.

The transition to Dapr for microservices system architecture development, combined with Diagrid Conductor for operations has marked a pivotal shift in Camelot SI’s approach to microservices and DevOps. This has reduced the complexity of developing and managing microservices, leading to increased developer productivity and efficiency while delivering considerable cost savings and improved service reliability.

CIO
Security
Networking
Data Center
Data Management
Close