Open-Source Internship opportunity by OpenGenus for programmers. Apply now.
In this article, we will look at the high-level system design of Microsoft Teams, its architecture, and how it works.
Table of Contents
- A Short History of Microsoft Teams
- System Design Requirements for Teams
- Logical Architecture of Teams
- Teams Services
- Teams Client Architecture
- Where is Everything Stored?
A Short History of Microsoft Teams
Microsoft Teams is a collaboration and communication platform used for chats, group communication, meetings, etc. It is proprietary software developed by Microsoft at an internal hackathon at its headquarters. Microsoft Teams is available for IOS, Android, Windows, Mac, and Linux platforms. Throughout the Covid-19 pandemic, Microsoft Teams gained worldwide popularity and as of 2021, it had about 250 Million monthly users.
System Design Requirements for Teams
There are many requirements that should be kept in mind during the design of a platform like Microsoft Teams such as the users of the app, functional and non-functional requirements, various design criteria, challenges, etc
Functional Requirements:
- The users must be able to start and manage a meeting through both video and audio
- The users must be able to send messages to each other
- The ability to form groups or teams
- Send messages to a team of people
- Support for file sharing - Photos, videos, documents, etc.
These are just some of the bare minimum features that our app must support. There can be hundreds of other features like adding emojis to messages, calendar functionality, etc. that can be added.
Non-Functional Requirements:
- The teams app should be able to scale based on the size of the organization.
- How much downtime is allowed and how does it affect performance?
- Ensuring availability of the teams app. what happens if one service goes down?
- How can new updates to the teams app be delivered without affecting the ongoing meetings?
Design Criteria and Challenges:
How do we synchronize the teams app of a user across multiple devices? Should we plan our system for more reads or more writes? for an app like teams, it is fair to assume there will be more writes than reads.
What should be the capacity based on? Assume our app has 10 Million users per day. Each user sends at most 100 messages and each message is around 100 Bytes. Then each user sends about 10KB of messages every day. For 10 Million users, It will account for 100MB of messages per day. What is the total space required for the next 10 years, keeping in mind the exponential growth?
End Users:
Who are the different user groups of the Teams platform?
- Enterprise users such as an Organization
- Personal/ Single User
Logical Architecture of Teams
The following image shows a high-level logical architecture of Microsoft Teams.
A 'Team' in Microsoft Teams is simply a collection of people, content, and tools based on some project or group. Every team uses Office 365 Groups under the hood. We can add, remove members to a team and define a team as private or public with the difference being anyone in the organization can join a public team.
A Team can have different Channels. A channel allows us to organize based on specific topics. For example, we can have a channel called to chat, where employees can chat and share ideas and a separate channel called training where we post the materials for employee training.
Every channel is backed by an instance of Sharepoint, which is a document management and storage system. Each channel has a folder in SharePoint, where the files associated with that channel are stored.
We can also add apps such as Youtube, Powerpoint, Planner, etc to our teams to add more functionality. We can also add Tabs in a channel that allows quick access to an app or file.
Chats can be one-to-one or a group chat. All the files shared in the chat are stored in the respective users' OneDrive for Business account. When you share a file, the recipient gets permission to view the file. We also have contacts inside Microsoft teams. Just like in channels, we can also add apps and tabs to chats but it has a relatively smaller set of apps.
It is important to note that the messages are stored independently of the images, GIFs, and emojis. Even if you insert an emoji into a message, it is stored in its own separate storage in Azure.
Of course, you can have meetings, voice mail, calling with your contacts and other people in your organization with up to 250 participants. The Activity feeds displays the unread messages, mentions, replies and likes in the channels you subscribe to.
Teams Services
Microsoft Teams uses several microservices for Identity and Authentication, Extensibility, Notifications, etc. These are called the "middle-tier" of Teams. It is designed with a scalability mind. Any new microservice can be added, removed, or replaced without affecting the entire system.
Teams Client Architecture
The client application provides user interaction and manages user activities. Teams client can be a desktop client or smart phone client.
The desktop client can be based on Web, Windows, or the MAC platform. Teams were designed with minimizing the codebase in mind. The teams client uses HTML 5 and CSS along with frameworks like Angular, JQuery, etc. More and more parts are being ported to React JS instead of Angular. It also uses the TypeScript flavor of JavaScript and Node Js. The Windows and MAC clients use custom C++ and Objective C wrappers over the Web Client along with Electron which allows building apps for desktop using JavaScript.
The mobile clients are available for Windows Platform, Android, and IOS and use C#, Java, and Swift respectively along with some React Native components. The teams client is built for agility and provides auto-updates.
Where is Everything Stored?
Microsoft Teams does not aim to reinvent the wheel and instead leverages the features of other Office 365 workloads. It was designed to offer the security and compliance features of Office 365. The below image shows where each type of data is stored.
Conversations are stored separately from images and files in table storage. Although this is being migrated to Azure CosmosDB. Images are stored in Azure in the form of blob storage. Both messages and images are also stored in Exchange for compliance reasons.
Team files are stored in SharePoint and chat files are stored in OneDrive.When you start a meeting a bot user is added to it which records the meeting, encodes it into a stream, and stores it in Azure blob storage. It may take 24 hours for the process to complete.
Calendar and voicemail are stored in individual mailboxes for exchange. Microsoft also collects data for monitoring which features of teams are most used, which is least used etc. called telemetry and stores them in Microsoft Datawarehouse. But none of the details of the customer or identifiable data are collected in the telemetry process.
With this article at OpenGenus, you must have the complete idea of System Design of Microsoft Teams.