Canva interview questions & answers

20 real Canva interview questions with full model answers — System design, Technical, Coding, Behavioral. Drawn from the same verified bank ChannelPulse drills from (46 Canva questions in total).

BehavioralEasyCanva

1. Tell me about a time when you had to quickly learn a new programming language or technology for a project.

The full question

Tell me about a time when you had to quickly learn a new programming language or technology for a project. How did you approach it?

Model answer

Situation At my previous job as a software developer, I was assigned to a project that required integrating a new machine learning library written in Python. Until then, I had primarily worked with JavaScript and was unfamiliar with Python. The project was critical for our client, as it aimed to enhance the predictive capabilities of their application, and the timeline was tight.

Task My specific goal was to quickly learn Python to effectively implement the machine learning library and ensure the integration was seamless. The key constraint was the limited time available to upskill and deliver the project without compromising on quality.

Action

  • I began by enrolling in an intensive online course focused on Python programming, which provided a structured learning path and helped me build a solid foundation.
  • To accelerate my learning, I dedicated additional hours outside of work to practice coding in Python, focusing on the specific features and libraries relevant to our project.
  • I reached out to colleagues who were proficient in Python, seeking their guidance and feedback on my code. This collaboration helped me understand best practices and avoid common pitfalls.
  • I applied what I learned by working on small, related personal projects. This hands-on approach allowed me to experiment and solidify my understanding of Python in a practical context.
  • Throughout the process, I kept the team updated on my progress and shared insights that could benefit others working on similar tasks.

Result As a result of my focused efforts, I was able to proficiently use Python within a few weeks. We successfully integrated the machine learning library into the client's application, which significantly improved its predictive accuracy. The project was delivered on time, and the client was highly satisfied with the enhanced functionality. This experience reinforced the value of continuous learning and adaptability, teaching me to embrace new challenges as opportunities for growth.

BehavioralMediumCanva

2. Describe a time you faced a significant technical challenge while working on a project.

The full question

Describe a time you faced a significant technical challenge while working on a project. How did you resolve it?

Model answer

Situation

While working as a software developer at a mid-sized tech company, I encountered a significant technical challenge during a major update of one of our key products. The update was crucial as it aimed to enhance user experience and integrate new features. However, during the development phase, I discovered that a significant portion of the legacy code was incompatible with the new features we planned to implement. This posed a risk to our timeline and the overall success of the project.

Task

My task was to identify a solution that would allow us to integrate the new features without compromising the existing functionality or delaying the project timeline. The key constraint was ensuring minimal disruption to the ongoing development process while maintaining code stability.

Action

  • I began by conducting a thorough analysis of the legacy code to understand the specific areas of incompatibility. This involved reviewing documentation and collaborating with team members who had previously worked on the codebase.
  • I proposed a phased refactoring approach, which involved incrementally updating the legacy code to align with the new architecture. This approach minimized the risk of introducing new bugs and allowed for continuous testing.
  • To ensure a smooth transition, I set up a parallel testing environment where both the legacy and updated code could be tested simultaneously. This helped in identifying potential issues early and allowed for quick iterations.
  • I communicated regularly with the project stakeholders, providing updates on progress and any potential risks. This transparency helped manage expectations and ensured that everyone was aligned with the approach.
  • I also facilitated code review sessions with the team to gather feedback and ensure that the refactoring aligned with best practices and project goals.

Result

The phased refactoring approach proved successful, allowing us to integrate the new features without significant delays. The project was completed on time, and the updated product received positive feedback from users for its improved functionality. This experience reinforced the importance of a methodical approach to problem-solving and the value of clear communication and collaboration in overcoming technical challenges. It also taught me the significance of balancing short-term goals with long-term code maintainability.

BehavioralMediumCanva

3. Can you share an experience where you had to optimize a piece of code for performance?

The full question

Can you share an experience where you had to optimize a piece of code for performance? What steps did you take?

Model answer

Situation

In my previous role as a software developer at a fintech company, we encountered a performance issue in one of our key applications. The application was experiencing significant lag during peak usage times, which directly impacted user satisfaction and our service level agreements. As the developer responsible for the application, it was crucial to address these performance bottlenecks promptly to maintain our reputation and client trust.

Task

My primary task was to optimize the code to improve performance without incurring the high costs and risks associated with a complete system rewrite. The challenge was to identify the root causes of the inefficiencies and implement solutions that would deliver immediate improvements.

Action

  • I began by conducting a thorough analysis of the application's performance using profiling tools to pinpoint bottlenecks. This helped me identify specific areas in the code and server response times that required attention.
  • After gathering data, I organized a brainstorming session with my team to discuss potential solutions. I advocated for prioritizing code optimization as the first step, given its cost-effectiveness and potential for immediate impact.
  • I led the effort to refactor inefficient code segments and remove unnecessary elements contributing to the lag. This involved optimizing database queries and implementing caching mechanisms to enhance response times.
  • Simultaneously, I proposed a plan to management for potential server infrastructure upgrades and the implementation of a CDN as part of our future scalability strategy.
  • Throughout the process, I ensured transparent communication with stakeholders, providing regular updates on progress and expected outcomes.

Result

The code optimization efforts led to a significant improvement in the system's performance, with response times reduced by 50%. The project was completed ahead of schedule and under budget, and the enhanced performance metrics were well-received by stakeholders. This experience taught me the importance of data-driven decision-making and effective communication in team settings. It also reinforced the value of taking initiative to drive better outcomes without resorting to drastic measures like a complete rewrite.

BehavioralHardCanva

4. Tell me about a time when you had to make a critical architectural decision for a system.

The full question

Tell me about a time when you had to make a critical architectural decision for a system. What factors did you consider?

Model answer

Situation

In my role as a software developer at a fintech company, I was part of a team responsible for a critical system that processed financial transactions. The system was experiencing performance issues, and there was pressure from stakeholders to resolve these quickly to maintain customer satisfaction and trust. The stakes were high, as any downtime or errors could lead to significant financial losses and damage to the company's reputation.

Task

I was tasked with making a critical architectural decision to improve the system's performance. The challenge was to find a solution that would be effective in the short term while also setting the foundation for long-term scalability and efficiency. The key constraint was the tight timeline, as the stakeholders expected a solution within a few weeks.

Action

  • I began by conducting a thorough analysis of the system's current architecture and performance metrics. This involved identifying bottlenecks and inefficient code segments that were contributing to the performance issues.
  • I considered several options, including a complete system rewrite, but determined that this would be too risky and time-consuming given the constraints. Instead, I proposed a targeted refactoring approach to optimize specific parts of the codebase.
  • To support my proposal, I prepared a detailed analysis and a proof of concept that demonstrated the potential performance improvements from refactoring. This included data and projections to back up my recommendations.
  • I communicated my findings and proposal to the team and stakeholders, emphasizing the benefits of a less risky, more efficient approach. I addressed concerns about the timeline by showing how the refactoring could be completed within the given timeframe.
  • I led the refactoring effort, coordinating with other developers to ensure a smooth implementation. I also set up monitoring tools to track performance improvements and ensure that the changes were having the desired effect.

Result

The decision to refactor rather than rewrite was supported by the team and management. We completed the refactoring process within the timeline, resulting in a significantly more robust and efficient system. Performance metrics improved noticeably, and the feedback from stakeholders was overwhelmingly positive. This experience reinforced the importance of data-driven decision-making and effective communication. It taught me the value of balancing short-term needs with long-term goals and the impact of strategic planning in software development.

CodingEasyCanva

5. Given a list of image URLs, write a function to filter out the URLs that do not end with common image file extensions (.jpg, .png, .gif).

Model answer

function filterImageUrls(urls) {
    // Define the common image file extensions
    const validExtensions = ['.jpg', '.png', '.gif'];

    // Filter the URLs that end with one of the valid extensions
    return urls.filter(url => {
        // Check if the URL ends with any of the valid extensions
        return validExtensions.some(extension => url.toLowerCase().endsWith(extension));
    });
}

// Example usage:
const urls = [
    "https://example.com/image1.jpg",
    "https://example.com/image2.png",
    "https://example.com/document.pdf",
    "https://example.com/image3.gif",
    "https://example.com/photo.bmp"
];

console.log(filterImageUrls(urls));
// Output: ["https://example.com/image1.jpg", "https://example.com/image2.png", "https://example.com/image3.gif"]
  • Approach:
  • Define a list of valid image file extensions.
  • Use the filter method to iterate over the list of URLs.
  • For each URL, use some to check if it ends with any of the valid extensions.
  • Convert URLs and extensions to lowercase to ensure case-insensitive comparison.
  • Complexity:
  • Time: O(n * m), where n is the number of URLs and m is the number of extensions.
  • Space: O(n), for storing the filtered list of URLs.
CodingEasyCanva

6. Check if a number is a palindrome.

Model answer

function isPalindrome(number) {
  // Convert the number to a string
  const str = number.toString();
  
  // Initialize two pointers
  let left = 0;
  let right = str.length - 1;
  
  // Use two-pointer technique to compare characters
  while (left < right) {
    if (str[left] !== str[right]) {
      return false; // Mismatch found
    }
    left++;
    right--;
  }
  
  return true; // No mismatches, it's a palindrome
}

// Example usage:
console.log(isPalindrome(121)); // true
console.log(isPalindrome(-121)); // false
console.log(isPalindrome(10)); // false
  • Approach:
  • Convert the number to a string to easily access individual digits.
  • Use a two-pointer technique: one pointer starts at the beginning and the other at the end of the string.
  • Move the pointers towards each other, comparing the characters at each step.
  • If a mismatch is found, return false.
  • If no mismatches are found by the time the pointers meet or cross, return true.
  • Complexity:
  • Time: O(n), where n is the number of digits in the number, as each digit is checked once.
  • Space: O(1), since no additional space is used beyond a few variables.
CodingEasyCanva

7. Reverse a string.

Model answer

function reverseString(s) {
  // Convert the string to an array of characters
  let charArray = s.split('');
  
  // Initialize two pointers
  let left = 0;
  let right = charArray.length - 1;
  
  // Swap characters while left is less than right
  while (left < right) {
    // Swap the characters at left and right indices
    let temp = charArray[left];
    charArray[left] = charArray[right];
    charArray[right] = temp;
    
    // Move the pointers towards the center
    left++;
    right--;
  }
  
  // Convert the array back to a string and return
  return charArray.join('');
}

// Example usage:
console.log(reverseString("hello")); // Output: "olleh"
  • Convert the string into an array to manipulate individual characters.
  • Use two pointers: one starting at the beginning (left) and the other at the end (right) of the array.
  • Swap the characters at these pointers and move the pointers towards the center until they meet.
  • Convert the array back to a string and return the result.

Complexity:

  • Time: O(n), where n is the length of the string, as each character is visited once.
  • Space: O(n), due to the array used to store characters.
CodingMediumCanva

8. Count unhappy friends.

Model answer

function countUnhappyFriends(n, preferences, pairs) {
    // Create a map to store the rank of each friend in another friend's preference list
    const rank = Array.from({ length: n }, () => Array(n).fill(0));
    
    // Fill the rank map with the preference rankings
    for (let i = 0; i < n; i++) {
        for (let j = 0; j < preferences[i].length; j++) {
            rank[i][preferences[i][j]] = j;
        }
    }

    // Create an array to store the pairings
    const pairMap = new Array(n);
    for (const [x, y] of pairs) {
        pairMap[x] = y;
        pairMap[y] = x;
    }

    let unhappyCount = 0;

    // Check each friend to see if they are unhappy
    for (let x = 0; x < n; x++) {
        const y = pairMap[x]; // x's current pair
        const xRankY = rank[x][y]; // x's rank for y

        // Check if there exists a friend u that x prefers more than y
        for (let i = 0; i < xRankY; i++) {
            const u = preferences[x][i];
            const v = pairMap[u]; // u's current pair

            // Check if u prefers x over v
            if (rank[u][x] < rank[u][v]) {
                unhappyCount++;
                break;
            }
        }
    }

    return unhappyCount;
}

// Example usage:
const n = 4;
const preferences = [
    [1, 2, 3],
    [3, 2, 0],
    [3, 1, 0],
    [1, 2, 0]
];
const pairs = [
    [0, 1],
    [2, 3]
];
console.log(countUnhappyFriends(n, preferences, pairs)); // Output: 2
  • Approach:
  • Create a rank matrix to store each friend's preference ranking for every other friend.
  • Use a pairMap to track the current pairings of friends.
  • Iterate over each friend to check if they are unhappy by comparing their preference for their current pair against others they prefer more.
  • If a friend prefers someone else who also prefers them back over their current pair, they are unhappy.
  • Complexity:
  • Time: O(n^2), where n is the number of friends. We iterate over each friend and their preferences.
  • Space: O(n^2), for storing the rank matrix and pair mappings.
Product & growthEasyCanvaProduct Manager

9. What is your favorite product, and how would you improve it?

Model answer

Clarify & scope: Identify your favorite product and a specific area for improvement, assuming the goal is to enhance user experience.

User segments & pain points: Choose a user segment that frequently uses the product and faces specific challenges.

Goals & success metrics: Define success as increased user satisfaction and engagement with the product.

Solutions:

  1. Enhanced Usability: Simplify the user interface to make navigation more intuitive.
  2. New Features: Introduce features that address unmet user needs.
  3. Performance Optimization: Improve the product's speed and reliability.

Recommendation: Focus on enhancing usability to provide immediate value to users.

Prioritization & trade-offs: Usability improvements have high impact with moderate effort compared to new feature development.

MVP, measurement & rollout: Implement small usability changes, measure user feedback, and iterate based on results.

Product & growthEasyCanvaProduct Manager

10. What key metrics would you track to evaluate the success of Canva's new mobile app feature?

Model answer

Clarify: Define the specific feature and its intended impact on user experience.

Define metric(s): Track metrics such as feature usage rate, user retention, and time spent on the app.

Break down: Analyze the user journey to understand feature interaction:

funnel
    A[App Download] --> B[Feature Discovery]
    B --> C[Feature Use]
    C --> D[User Feedback]
Diagram

Ranked hypotheses:

  1. High usage indicates feature value.
  2. Low retention suggests usability issues.
  3. Negative feedback points to unmet user needs.

How to investigate:

  • Monitor analytics dashboards for real-time data.
  • Conduct A/B testing to compare user engagement.
  • Collect qualitative feedback through surveys.

Decision & guardrails: Use data to iterate on the feature, ensuring alignment with overall app engagement goals.

Product & growthMediumCanvaProduct Manager

11. How would you improve Canva's template recommendation system for new users?

Model answer

Clarify & scope: The goal is to enhance the onboarding experience for new Canva users by improving template recommendations, assuming that new users might feel overwhelmed by the variety of templates available.

User segments & pain points: Focus on new users who are unfamiliar with design software and struggle to find templates that match their needs or style.

Goals & success metrics: The North Star metric is the increased engagement rate with recommended templates. Guardrail metrics include user satisfaction scores and time spent on the platform.

Solutions:

  1. Personalized Onboarding Quiz: Implement a short quiz during onboarding to understand user preferences and needs.
  2. AI-driven Recommendations: Use AI to analyze user behavior and preferences to suggest templates.
  3. User Feedback Loop: Allow users to rate template recommendations to refine future suggestions.

Recommendation: Implement the personalized onboarding quiz as it directly addresses new user needs without requiring complex AI systems.

graph TD;
A[New User Onboarding] --> B{Take Quiz};
B --> C[Template Recommendations];
C --> D[User Feedback];
D --> E[Refine Recommendations];
Diagram

Prioritization & trade-offs: Using RICE, the onboarding quiz scores high on impact and ease of implementation compared to AI-driven solutions.

MVP, measurement & rollout: Launch the onboarding quiz to a small user segment, measure engagement, and iterate based on feedback.

Product & growthMediumCanvaProduct Manager

12. How would you design a new feature for Canva to enhance team collaboration?

Model answer

Clarify & scope: The goal is to enhance team collaboration within Canva, assuming that current tools may not fully support remote work dynamics.

User segments & pain points: Focus on teams within organizations that collaborate on design projects but struggle with real-time editing and feedback.

Goals & success metrics: The North Star metric is the increase in the number of collaborative projects completed. Guardrail metrics include user satisfaction and feature adoption rates.

Solutions:

  1. Real-time Co-editing: Allow multiple users to edit the same design simultaneously.
  2. Integrated Commenting System: Enable users to leave comments and feedback directly on designs.
  3. Version Control: Implement a version history feature to track changes and revert if necessary.

Recommendation: Prioritize real-time co-editing as it directly addresses the need for synchronous collaboration.

graph TD;
A[User A Edits Design] --> B[User B Edits Design];
B --> C[Real-time Updates];
C --> D[Collaborative Feedback];
Diagram

Prioritization & trade-offs: Real-time co-editing has high impact but requires significant technical effort compared to an integrated commenting system.

MVP, measurement & rollout: Launch a beta version of real-time co-editing, gather user feedback, and iterate based on usage patterns.

System designEasyCanva

13. Design a simple image upload service that allows users to upload images for their designs.

The full question

Design a simple image upload service that allows users to upload images for their designs. What components would you include?

Model answer

1. Requirements & scale

Functional Requirements:

  • Users can upload images for their designs.
  • Support multiple image formats (e.g., JPEG, PNG).
  • Provide a URL for accessing the uploaded image.
  • Ensure images are stored reliably and can be retrieved quickly.

Non-Functional Requirements:

  • High availability and durability of stored images.
  • Low latency for upload and retrieval operations.
  • Scalability to handle varying loads of image uploads.
  • Security measures for image uploads and access.

Estimates:

  • Assume 1 million active users with an average of 10 image uploads per user per day.
  • Average image size: 1 MB.
  • Total uploads per day: 10 million.
  • Storage: 10 million MB/day = ~10 TB/day.
  • Bandwidth: 10 million MB/day upload = ~116 MB/s.

2. High-level architecture

flowchart TD
    subgraph Client
        A[User Device]
    end

    subgraph Edge/CDN
        B[CDN]
    end

    subgraph Load Balancer
        C[Load Balancer]
    end

    subgraph API / Services
        D[Image Upload Service]
    end

    subgraph Message Queue
        E[Message Queue]
    end

    subgraph Workers
        F[Image Processing Worker]
    end

    subgraph Datastores
        G["Object Storage (S3)"]
        H[Metadata DB]
    end

    A -->|Upload Image| B
    B -->|Forward Request| C
    C -->|Route to Service| D
    D -->|Store Metadata| H
    D -->|Publish to Queue| E
    E -->|Process Image| F
    F -->|Store Image| G
    G -->|Image URL| D
    D -->|Return URL| A
Diagram

3. API design

  • POST /upload: Upload an image. Accepts image data and returns a URL for accessing the image.
  • GET /image/{imageId}: Retrieve an image using its unique identifier.

4. Data model & storage

Datastores:

  • Object Storage (e.g., S3): Used for storing the actual image files. Chosen for its scalability, durability, and cost-effectiveness.
  • Metadata Database (SQL): Stores metadata about images, such as image ID, URL, user ID, and upload timestamp. SQL is chosen for its ACID properties, ensuring consistency in metadata operations.

Key Tables:

  • Images Table:
  • image_id (Primary Key)
  • user_id
  • image_url
  • upload_timestamp

5. Deep dive

The core of this system is the image upload and processing pipeline. When a user uploads an image, the Image Upload Service handles the request, stores metadata in the database, and publishes a message to a queue for further processing. This decouples the upload process from image processing, enhancing scalability and reliability.

sequenceDiagram
    participant User
    participant CDN
    participant UploadService
    participant MetadataDB
    participant MessageQueue
    participant ImageWorker
    participant ObjectStorage

    User->>CDN: Upload Image
    CDN->>UploadService: Forward Request
    UploadService->>MetadataDB: Store Metadata
    UploadService->>MessageQueue: Publish Message
    MessageQueue->>ImageWorker: Consume Message
    ImageWorker->>ObjectStorage: Store Image
    ObjectStorage->>UploadService: Return Image URL
    UploadService->>User: Return Image URL
Diagram

6. Scale, bottlenecks & trade-offs

Scalability:

  • The use of a message queue allows the system to handle varying loads by decoupling image upload from processing.
  • Object storage scales horizontally, accommodating large volumes of data.

Bottlenecks:

  • The metadata database could become a bottleneck under high load. Implementing read replicas and sharding can alleviate this.
  • Network bandwidth could be a constraint during peak upload times.

Trade-offs:

  • Consistency vs. Availability: Using eventual consistency for image processing ensures high availability, but there might be a slight delay before an image is fully processed and available.
  • Push vs. Pull: The system uses a push model for uploading images and a pull model for processing, balancing immediate user feedback with backend processing efficiency.
  • SQL vs. NoSQL: SQL is used for metadata to ensure strong consistency, while object storage handles the unstructured image data efficiently.

By designing with these considerations, the image upload service can efficiently handle large volumes of uploads while maintaining high availability and performance.

System designMediumCanva

14. Design a simple in-memory cache system that supports 'get' and 'put' operations with a maximum size limit.

The full question

Design a simple in-memory cache system that supports 'get' and 'put' operations with a maximum size limit. When the cache exceeds this limit, it should evict the least recently used (LRU) item.

Model answer

1. Requirements & scale

Functional Requirements:

  • Support get(key) operation to retrieve data from the cache.
  • Support put(key, value) operation to add data to the cache.
  • Implement a Least Recently Used (LRU) eviction policy when the cache exceeds its maximum size.

Non-Functional Requirements:

  • High performance with low latency for get and put operations.
  • Ensure cache availability and fault tolerance.
  • Efficient memory usage.

Scale Estimates:

  • Assume a cache size limit of 100,000 items.
  • Each item is approximately 1 KB, leading to a total memory requirement of about 100 MB.
  • Assume a QPS (queries per second) of 10,000 for both get and put operations.

2. High-level architecture

flowchart TD
    subgraph Client
        A[Client]
    end

    subgraph Edge/CDN
        B[CDN]
    end

    subgraph Load Balancer
        C[Load Balancer]
    end

    subgraph API / Services
        D[Cache Service]
    end

    subgraph Cache
        E[In-Memory Cache]
    end

    A -->|HTTP Request| B
    B -->|Forward Request| C
    C -->|Route Request| D
    D -->|Get/Put| E
Diagram

3. API design

  • GET /cache/{key}: Retrieve the value associated with the given key from the cache.
  • PUT /cache/{key}: Add or update the value associated with the given key in the cache.

4. Data model & storage

Datastore Choice:

  • Use an in-memory data store like Redis or a custom in-memory structure for high-speed access.

Data Structure:

  • Use a combination of a HashMap and a Doubly Linked List to implement the LRU cache:
  • HashMap: Maps keys to nodes in the Doubly Linked List for O(1) access.
  • Doubly Linked List: Maintains the order of usage, with the most recently used item at the head and the least recently used item at the tail.

5. Deep dive

The core of the LRU cache implementation involves maintaining the order of usage and ensuring efficient access and updates. The HashMap provides O(1) access to cache entries, while the Doubly Linked List allows for O(1) insertions and deletions.

sequenceDiagram
    participant Client
    participant CacheService
    participant InMemoryCache

    Client->>CacheService: PUT /cache/{key}
    CacheService->>InMemoryCache: Add/Update Key
    InMemoryCache-->>CacheService: Acknowledge
    CacheService-->>Client: Success

    Client->>CacheService: GET /cache/{key}
    CacheService->>InMemoryCache: Retrieve Key
    InMemoryCache-->>CacheService: Return Value
    CacheService-->>Client: Return Value
Diagram

LRU Eviction Policy:

  • On a put operation, if the cache exceeds its size limit, remove the tail of the Doubly Linked List (the least recently used item).
  • On a get operation, move the accessed node to the head of the Doubly Linked List to mark it as recently used.

6. Scale, bottlenecks & trade-offs

Scaling:

  • Implement sharding to distribute the cache across multiple nodes, reducing the load on any single node and mitigating the risk of a single point of failure (SPOF).
  • Use consistent hashing to ensure even distribution of keys across shards.

Bottlenecks:

  • A single cache node can become a bottleneck; therefore, deploying multiple cache servers across different data centers is recommended.

Trade-offs:

  • Consistency vs. Availability: In a distributed cache, achieving strong consistency may reduce availability. A cache-aside strategy can be used to balance this trade-off.
  • Memory Usage vs. Performance: Overprovision memory to handle spikes in usage, but this increases cost.
  • Simplicity vs. Complexity: A simple in-memory cache is easy to implement but may not scale well without additional mechanisms like sharding and replication.

By carefully considering these aspects, the designed cache system can efficiently handle high loads while maintaining low latency and high availability.

System designMediumCanva

15. How would you design a notification system to alert users about changes to their designs or comments from collaborators?

Model answer

1. Requirements & scale

Functional Requirements:

  • Notify users about changes to their designs.
  • Alert users when collaborators comment on their designs.
  • Support real-time notifications.
  • Allow users to customize notification preferences (e.g., email, push notifications).

Non-Functional Requirements:

  • High availability and low latency.
  • Scalability to handle millions of users.
  • Reliability to ensure message delivery.
  • Security to protect user data and preferences.

Scale Estimates:

  • Assume 10 million active users.
  • Each user receives an average of 5 notifications per day.
  • Peak QPS (Queries Per Second) = 10 million users * 5 notifications / 86,400 seconds ≈ 580 QPS.
  • Storage: Assume each notification is 1KB. Daily storage = 10 million 5 1KB = 50GB.
  • Bandwidth: Similar to storage, approximately 50GB per day.

2. High-level architecture

flowchart TD
    subgraph Client
        A[User Device]
    end

    subgraph Edge/CDN
        B[CDN]
    end

    subgraph Load Balancer
        C[Load Balancer]
    end

    subgraph API / Services
        D[Notification API]
        E[User Preferences Service]
    end

    subgraph Cache
        F[Redis Cache]
    end

    subgraph Datastores
        G[SQL Database]
        H[NoSQL Database]
    end

    subgraph Message Queue
        I[Pub/Sub System]
    end

    subgraph Workers
        J[Notification Workers]
    end

    A --> B --> C --> D
    D --> E
    D --> I
    I --> J
    J --> F
    J --> G
    J --> H
    F --> D
    G --> E
    H --> E
Diagram

3. API design

  • POST /notifications: Create a new notification.
  • GET /notifications/{userId}: Retrieve notifications for a user.
  • PUT /notifications/preferences/{userId}: Update notification preferences for a user.
  • DELETE /notifications/{notificationId}: Remove a notification.

4. Data model & storage

Datastores:

  • SQL Database: Store user preferences and metadata for reliable transactions.
  • NoSQL Database: Store notifications for quick access and scalability.

Key Tables:

  • UserPreferences: (userId, emailEnabled, pushEnabled, lastUpdated)
  • Notifications: (notificationId, userId, type, message, timestamp)

Partitioning Strategy:

  • Notifications: Partition by userId to distribute load evenly across the database.

5. Deep dive

The core of the notification system is the Pub/Sub mechanism that ensures real-time delivery of notifications.

sequenceDiagram
    participant User as User Device
    participant API as Notification API
    participant Queue as Pub/Sub System
    participant Worker as Notification Worker
    participant Cache as Redis Cache
    participant DB as NoSQL Database

    User->>API: Create/Update Design
    API->>Queue: Publish Notification Event
    Worker->>Queue: Subscribe to Notification Event
    Worker->>Cache: Check User Preferences
    alt Preferences Allow
        Worker->>DB: Store Notification
        Worker->>User: Send Notification
    else Preferences Deny
        Worker->>DB: Store Notification
    end
Diagram

6. Scale, bottlenecks & trade-offs

Scalability:

  • Use a Pub/Sub system to decouple producers and consumers, allowing the system to scale horizontally.
  • Redis Cache is used to store frequently accessed user preferences, reducing database load.

Bottlenecks:

  • The load balancer could become a bottleneck if not properly scaled.
  • The Pub/Sub system must handle high throughput efficiently.

Trade-offs:

  • Consistency vs. Availability: Using a NoSQL database for notifications prioritizes availability and partition tolerance (AP in CAP theorem), which may lead to eventual consistency.
  • Push vs. Pull: Push notifications offer real-time updates but require more resources. Pull mechanisms (e.g., polling) are less resource-intensive but introduce latency.
  • SQL vs. NoSQL: SQL is used for user preferences due to the need for ACID transactions, while NoSQL is used for notifications to handle high write throughput and scalability.

By addressing these considerations, the notification system can efficiently alert users about changes and comments, ensuring a seamless user experience.

System designMediumCanva

16. What is the architecture of Canva's backend?

Model answer

1. Requirements & scale

Functional Requirements:

  • User authentication and authorization.
  • Image and design editing capabilities.
  • Real-time collaboration on designs.
  • Asset storage and retrieval (images, fonts, templates).
  • Version control for designs.

Non-Functional Requirements:

  • High availability and reliability.
  • Low latency for a seamless user experience.
  • Scalability to handle millions of users.
  • Consistent performance across global regions.

Scale Estimates:

  • Users: Assume 10 million active users.
  • Requests per second (QPS): If each user makes an average of 10 requests per session and there are 1 million concurrent users, QPS could be around 10 million / 24 hours / 3600 seconds ≈ 115 QPS.
  • Storage: Assuming each user stores an average of 100 MB of assets, total storage required is 10 million * 100 MB = 1 PB.
  • Bandwidth: For real-time collaboration and asset retrieval, estimate 1 GB/s bandwidth.

2. High-level architecture

flowchart TD
    subgraph Client
        A[User Devices]
    end
    
    subgraph Edge/CDN
        B[CDN]
    end
    
    subgraph Load Balancer
        C[Load Balancer]
    end
    
    subgraph API / Services
        D[Auth Service]
        E[Design Service]
        F[Collaboration Service]
    end
    
    subgraph Cache
        G[Redis Cache]
    end
    
    subgraph Datastores
        H["SQL DB"]
        I["Blob Storage (S3)"]
        J["NoSQL DB"]
    end
    
    subgraph Message Queue
        K[Message Queue]
    end
    
    subgraph Workers
        L[Background Workers]
    end

    A -->|HTTP Requests| B
    B -->|Cached Content| A
    B --> C
    C -->|Route Requests| D
    C -->|Route Requests| E
    C -->|Route Requests| F
    D -->|Auth Data| H
    E -->|Design Data| I
    F -->|Collab Data| J
    E -->|Cache Designs| G
    F -->|Cache Sessions| G
    E -->|Publish Events| K
    K --> L
    L -->|Process Events| I
Diagram

3. API design

  • POST /api/v1/auth/login: Authenticate a user.
  • GET /api/v1/designs/{designId}: Retrieve a design.
  • POST /api/v1/designs: Create a new design.
  • PUT /api/v1/designs/{designId}: Update an existing design.
  • POST /api/v1/collaborate/{designId}: Start a collaboration session.

4. Data model & storage

Datastores:

  • SQL DB: Used for user authentication and metadata. Tables include Users, Sessions.
  • Blob Storage (S3): Stores design assets like images and templates.
  • NoSQL DB: Stores real-time collaboration data and design versions. Sharded by designId.

Key Tables:

  • Users: userId (PK), email, passwordHash.
  • Designs: designId (PK), userId, metadata.
  • Collaborations: sessionId (PK), designId, participants.

5. Deep dive

The core challenge is enabling real-time collaboration. This involves synchronizing changes across multiple users efficiently.

sequenceDiagram
    participant U1 as User 1
    participant U2 as User 2
    participant S as Collaboration Service
    participant MQ as Message Queue
    participant W as Worker

    U1->>S: Edit Design
    S->>MQ: Publish Change Event
    MQ->>W: Process Event
    W->>S: Update Design State
    S->>U2: Push Update
Diagram

The collaboration service listens for design changes and publishes events to a message queue. Workers process these events to update the design state, which is then pushed to other users in the session.

6. Scale, bottlenecks & trade-offs

Scalability Techniques:

  • Horizontal Scaling: Distribute load across multiple servers to handle increased traffic.
  • Sharding: Split databases by userId or designId to manage large datasets.
  • Caching: Use Redis for frequently accessed data to reduce latency.

Bottlenecks:

  • Database Load: Mitigated by sharding and read replicas.
  • Network Latency: Minimized by using CDNs and edge caching.

Trade-offs:

  • Consistency vs. Availability: Opt for eventual consistency in collaboration features to ensure high availability.
  • Push vs. Pull: Use push notifications for real-time updates to reduce client polling.

By employing these strategies, Canva's backend can efficiently support a large, global user base with robust real-time collaboration features.

TechnicalEasyCanva

17. What is the difference between a stack and a queue, and can you provide an example of when you would use each?

Model answer

Difference between a Stack and a Queue

  1. Stack: - A stack is a linear data structure that follows the Last In, First Out (LIFO) principle. - Operations: - Push: Add an element to the top of the stack. - Pop: Remove the element from the top of the stack. - Peek/Top: Retrieve the top element without removing it. - Use Case Example: - Function Call Management: In programming, stacks are used to manage function calls. When a function is called, its details are pushed onto the stack. When the function execution is complete, it is popped from the stack. This helps in tracking the return addresses and local variables.
  2. Queue: - A queue is a linear data structure that follows the First In, First Out (FIFO) principle. - Operations: - Enqueue: Add an element to the end of the queue. - Dequeue: Remove an element from the front of the queue. - Front: Retrieve the front element without removing it. - Use Case Example: - Task Scheduling: Queues are used in task scheduling systems where tasks are processed in the order they arrive. For instance, print jobs sent to a printer are queued and processed sequentially.

Practical Examples

  • Stack Example:
  • Undo Mechanism in Text Editors: When you perform actions in a text editor, each action is pushed onto a stack. If you need to undo an action, the editor pops the last action from the stack and reverts it.
  • Queue Example:
  • Message Queues in System Design: As mentioned in [R1], message queues like Kafka and RabbitMQ enable asynchronous communication between services. They decouple services and handle high volumes of requests by queuing messages, ensuring that each service processes messages in the order they were received.

Complexity

  • Stack:
  • Time Complexity: O(1) for push, pop, and peek operations.
  • Space Complexity: O(n), where n is the number of elements in the stack.
  • Queue:
  • Time Complexity: O(1) for enqueue and dequeue operations.
  • Space Complexity: O(n), where n is the number of elements in the queue.

Understanding the differences between these data structures and their use cases is crucial for selecting the right tool for specific problems in software development.

TechnicalMediumCanva

18. Describe Canva's CI/CD pipeline.

Model answer

  1. Continuous Integration (CI):
  • Code Commit and Version Control:
  • Developers commit code to a shared repository using a version control system like Git.
  • Each commit triggers an automated build process.
  • Automated Testing:
  • Unit tests are executed to ensure individual components function correctly.
  • Integration tests check the interaction between components.
  • Load and stress tests are performed to evaluate system performance under different conditions.
  • Build Automation:
  • A build server compiles the code and runs tests automatically.
  • Successful builds are packaged for deployment.
  1. Continuous Delivery (CD):
  • Artifact Storage:
  • Built artifacts are stored in a repository, ready for deployment.
  • Ensures that the same build is deployed across all environments.
  • Automated Deployment:
  • Deployments to staging environments occur automatically after successful builds.
  • Staging environments mirror production to catch potential issues before live deployment.
  • Manual Approval:
  • A manual approval step may be included before deploying to production, ensuring human oversight.
  1. Continuous Deployment:
  • Automated Production Deployment:
  • Upon approval, the deployment to production is automated.
  • Ensures fast and reliable release cycles.
  • Monitoring and Feedback:
  • Post-deployment monitoring checks system health and performance.
  • Feedback loops allow for quick rollback in case of issues.
  1. Multi-Data Center Deployment:
  • Consistency Across Data Centers:
  • Automated tools ensure consistent deployment across multiple data centers.
  • This setup supports high availability and disaster recovery.
  • Decoupled Components:
  • Components are decoupled to allow independent scaling.
  • Messaging queues facilitate communication between components, enhancing scalability.
  1. Testing and Quality Assurance:
  • Comprehensive Testing:
  • Includes unit, integration, load, and stress testing.
  • Ensures robustness and reliability of the application.
  • Continuous Feedback:
  • Continuous testing provides immediate feedback to developers.
  • Helps in maintaining code quality and reducing bugs.

Complexity: The CI/CD pipeline is designed to streamline the development process, ensuring rapid and reliable deployments. It balances automation with necessary manual checks to maintain quality and consistency across deployments.

TechnicalMediumCanva

19. What is Canva's approach to data security?

Model answer

Canva's Approach to Data Security

  1. Multi-Data Center Strategy - Canva employs a multi-data center setup to ensure redundancy and reliability. This approach helps in maintaining service availability even if one data center experiences issues. By distributing data across multiple locations, Canva can mitigate risks related to data loss and enhance disaster recovery capabilities.
  2. Automated Deployment Tools - To maintain consistency and security across all data centers, Canva uses automated deployment tools. These tools help in ensuring that security patches and updates are uniformly applied, reducing the risk of vulnerabilities due to inconsistent software versions.
  3. Decoupled System Architecture - Canva's system architecture is designed to be decoupled, allowing different components to be scaled independently. This design not only aids in scalability but also enhances security by isolating components, thus minimizing the impact of a potential security breach in one part of the system.
  4. Messaging Queue for Secure Communication - Messaging queues are utilized to facilitate secure and reliable communication between different components of Canva's distributed system. This ensures that data is transmitted securely and efficiently, reducing the risk of data interception or loss during transit.
  5. Redundancy and Load Balancing - Redundancy is built into every tier of Canva's architecture to prevent single points of failure. Load balancing is used to distribute traffic evenly across servers, preventing overload and ensuring that security measures are consistently applied across the infrastructure.
  6. Caching and Sharding - Caching strategies, such as using Redis or CDN, are employed to store frequently accessed data in memory, which not only speeds up response times but also reduces the load on primary data stores, enhancing security by minimizing direct access to sensitive data. - Sharding is used to split large datasets into smaller, manageable chunks, allowing for parallel access and reducing the risk of data breaches by limiting the scope of data exposure.
  7. Monitoring and Automation - Continuous monitoring and the use of automation tools are critical in Canva's approach to data security. These tools help in detecting anomalies, unauthorized access attempts, and potential security threats in real-time, enabling prompt responses to mitigate risks.

By integrating these strategies, Canva ensures a robust data security framework that protects user data while maintaining high availability and performance across its platform.

TechnicalMediumCanva

20. How does Canva handle image processing?

Model answer

How Canva Handles Image Processing

  1. Image Upload and Storage
  • Users upload images via Canva's web or mobile applications.
  • Images are stored in a scalable object storage solution, such as Amazon S3, which provides durability and high availability.
  1. Image Processing Pipeline
  • Once an image is uploaded, it enters an image processing pipeline.
  • This pipeline is typically implemented using a queue-based system, where images are processed asynchronously.
  • A message queue like RabbitMQ or AWS SQS is used to decouple the upload process from processing tasks, ensuring that the system remains responsive.
  1. Processing Tasks
  • Image processing tasks include resizing, format conversion, and applying filters.
  • These tasks are handled by worker nodes, which are distributed systems that can scale horizontally to handle varying loads.
  • Workers retrieve tasks from the queue, process the images, and store the results back in the object storage.
  1. API Design for Image Processing
  • Canva provides APIs for image manipulation, which are designed with RESTful principles.
  • Endpoints might include /images/upload, /images/process, and /images/download.
  • These APIs use JSON for request and response formats and are secured with HTTPS to ensure data integrity and confidentiality.
  1. Caching and CDN
  • Processed images are cached using a Content Delivery Network (CDN) to reduce latency and improve load times for end-users.
  • CDNs distribute the images across global edge locations, ensuring fast access regardless of the user's geographical location.
  1. Scalability and Fault Tolerance
  • The system is designed to be highly scalable, with the ability to add more worker nodes as demand increases.
  • Redundancy and failover mechanisms are in place to handle node failures without affecting the overall system performance.
  1. Security and Compliance
  • All communications are secured using HTTPS to protect user data during transit.
  • The system complies with data protection regulations, ensuring user privacy and data security.

Complexity

  • Time Complexity: The time to process an image is dependent on the specific tasks (e.g., resizing, filtering) and the size of the image.
  • Space Complexity: Storage requirements are determined by the number of images and their processed versions, managed efficiently using scalable object storage solutions.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions