Reducing Slack’s memory footprint

Our desktop app is the most widely used and most capable Slack client that we offer. For many of our customers, it is one of just a few apps they keep open on their computer throughout the work day. It allows them to communicate and work with all the teams they belong to: reading and…

Johnny Rodgers
8 min readadvanced
--
View Original

Overview

The article discusses the efforts made by Slack to reduce the memory footprint of its desktop application, which is crucial for enhancing user experience. It highlights the introduction of a lightweight client that manages background tasks efficiently while minimizing resource consumption.

What You'll Learn

1

How to implement a lightweight client for background tasks in a desktop application

2

Why managing memory usage is critical for application performance

3

When to migrate client-side logic to server-side for efficiency

Key Questions Answered

What memory usage statistics are associated with Slack's desktop application?
The Slack desktop application can consume between approximately 130MB (p10) and 960MB (p99) of memory depending on team activity and UI state. This significant variation highlights the impact of user engagement on resource consumption.
How does the new lightweight client improve memory usage?
The new lightweight client reduces memory usage by maintaining minimal state and only presenting data as transmitted by the server. This approach allows Slack to keep essential functionalities like notifications while consuming significantly less memory.
What are the key features of the tiny client introduced by Slack?
The tiny client updates unread indicators, displays desktop notifications, and consumes minimal memory. It operates silently in the background for teams that users haven't interacted with recently, ensuring efficient resource management.
What infrastructure changes were made to support the tiny client?
New API endpoints were developed to track user notifications and mentions, allowing the tiny client to keep the team sidebar updated. Additionally, server-side logic was introduced to convert messages into a new desktop_notification type for efficient handling.

Key Statistics & Figures

Percentage of active Slack users signed into multiple teams
36%
This statistic indicates the prevalence of multi-team usage among Slack users, highlighting the need for efficient memory management.
Memory consumption range for a single team
130MB
p10

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Implement a lightweight client for background tasks to optimize memory usage in applications.
This approach is particularly beneficial for applications like Slack, where users may be signed into multiple teams. A lightweight client can help maintain functionality without overwhelming system resources.
2
Migrate client-side logic to the server to improve performance and reduce memory consumption.
By offloading responsibilities to the server, applications can streamline their client-side operations, leading to faster performance and a better user experience.
3
Monitor memory usage statistics to identify areas for optimization.
Understanding how memory is consumed in different scenarios can help developers make informed decisions about where to focus their optimization efforts.

Common Pitfalls

1
Failing to manage memory effectively can lead to degraded application performance.
Applications that do not optimize memory usage may experience slowdowns, crashes, or an overall poor user experience, particularly when users are engaged with multiple teams or tasks.