Skip to content

Slashing WebSocket CPU usage by 30% without upping the cost

WebSocket

OpenPhone customers expect to see the latest information instantly. This sense of immediacy isn’t just a nice-to-have; it’s a requirement. It means never experiencing a delay on an important update or waiting for a message to be sent through or received. 

Behind this up-to-the-moment accuracy on your screen is a key player that’s working hard to make sure that happens: WebSockets. 

Our engineers recently tackled a challenge that involved refining and improving the engines that power your interactions, specifically our WebSocket capabilities. The results of their work lowered our WebSocket server CPU usage by an impressive 30%

First, what the 30% CPU reduction mean for you.

Before we get into the technical babble, let’s chat about how these optimization efforts directly shape your experience with our product.

  • Improved responsiveness: Faster processing means quicker message transmission and notifications. Closer than ever to that real-time communication.
  • Enhanced stability: Less strain on our servers = fewer downtimes. Our product remains reliable whenever you need it.
  • Amplified innovation: Efficient CPU usage helps us manage costs, delaying further infrastructure investments. The benefit is our ability to continuing solving our customers’ needs instead of spending all of our efforts on scaling.

To see how we achieved this impressive milestone and understand the techy bits, keep reading. 

How customer feedback led to these improvements

Our company thrives on the voices of its users. We value every piece of feedback we receive, whether it’s directly from our customers, through surveys, or from our support channels.  This feedback often gives us insights into real-world experiences that raw metrics might miss.

Quote card from Scott Bennett, Chief Architect at OpenPhone. It reads: 'Our engineers are passionate about connecting people and communication. They are continuously watching really cool matrix-state-of-the-art dashboards, sifting through metrics, and on the lookout for anomalies that hint at room for enhancement.'

We first became aware of the problem after our customers began mentioning their notifications were delayed. Because we prioritize timely experiences, we launched an investigation. 

When we looked at our system’s performance data, our engineers pinpointed an unexpected surge in CPU usage. Our team was then able to identify the recent security enhancements and fixes that were the culprits in performance degradation. 

From there, we used diagnostic tools to help us look deeper into the issue and discovered the most resource-intensive operation was a cryptographic function, which inherently consumes a lot of CPU. This was a clear bottleneck, so we needed to quickly optimize this function.

Once we understood the problem, our team took this challenge to refine our process, and through some innovative tweaks, we boosted its efficiency significantly, leading to a 30% reduction in our CPU usage.

What are WebSockets?

We all know what it’s like to wait for a new message to come in. With traditional web interactions, you’d have to constantly check or “refresh” your inbox to see if it has arrived. But with WebSockets, the moment that message is sent, it appears on your screen almost instantly.

WebSockets are what makes this real-time delivery with modern web applications possible. Back in the day, the only way to get the data from the server into your web browser was for your web browser to request it. Now, the server can send data directly to your browser without waiting for a request. 

Quote card from Scott Bennett, Chief Architect at OpenPhone. It reads: 'As we grow our variety of features and integrate with other platforms, we really want OpenPhone to be a central dashboard into your world. The goal is to make sure that every interaction with your customer is show in real time, up to the millesecond.

What does WebSocket power within OpenPhone?

Our WebSocket servers are our hardest working service, making sure that every interaction on OpenPhone is as immediate as it gets, sometimes managing up to 40,000 operations per second. This includes things like:

  • Instant messaging: As soon as a message arrives, it instantly comes over WebSocket, making sure you see it the moment it’s sent.
  • Contact Updates: If you were to make changes to contact information, those changes are reflected in near real-time.
  • Notes: Adding extra details and notes can be updated on the fly.

What is CPU?

It stands for Central Processing Unit, and it powers computing tasks like the functionality of applications like ours. OpenPhone operates as a “cloud application.” This means that while we have plenty of resources, these are shared with all our customers and even other companies. Such shared resources require efficient usage, as they directly impact our costs and performance.

Quote card from Scott Bennett, Chief Architect at OpenPhone. It reads: '“One of the main reasons that we’re able to keep our costs low and provide these rich features is by being very careful about how we ‘re using all of our resources.'

Our team consistently monitors system performance, ensuring we’re prepared for any unexpected surge in activity, say an influx in phone calls. This proactive approach is to make sure there’s plenty of capacity to manage those spikes. 

At OpenPhone, our main priority is to ensure that customers can successfully connect to their customers and grow their business at all times. As our company has grown, maintaining the latest security standards became not only important for compliance but, more critically, to ensure the safety of our customers’ data. The challenge was clear: how do we retain top-notch security without compromising performance?

As OpenPhone’s customer base grows, the demands of our system will surely increase. By achieving efficiency now, we’re laying the groundwork to better prepare to accommodate more customers in the future without compromising on speed or reliability. This optimization underscores our commitment to not only being the best business phone on the market but also ensuring reliability for every customer. 

5/5 - (4 votes)