1 of 85

edX Architecture Onboarding��Last updated: Feb 2019

2 of 85

edX Architecture

Part 1: High-level Overview

Part 2: Data and Scale

Part 3: Technical Feature Detail

Part 4: Technical Development

3 of 85

Part 1

edX Architecture: High-level Overview

  • What is edX?
  • Where are we today?
  • Where are we going?

4 of 85

Part 1

edX Architecture: High-level Overview

  • What is edX?
  • Where are we today?
  • Where are we going?

5 of 85

edX Mission

To create the world’s leading learning destination site and platform so that everyone around the world can become better educated.

We will do this through:

increasing access to high quality education,

improving quality of education

on-campus and on-line,

and enabling research.

6 of 85

edX Themes

  • D
  • R
  • E
  • A
  • M
  • C
  • O
  • iscovery
  • evenue
  • nterprise
  • rchitecture
  • asters
  • ontent
  • perational Excellence

7 of 85

edX Core Value

  • Scalable Quality Education with Support
  • Partner Brand recognition and amplification
  • Connecting People, Learning Content and Corporations
  • Content Stackability with Credentialing
  • Flexible Platform for deep learning, experimentation and pedagogy
  • Inclusivity: open to all learners, affordable, open source

8 of 85

9 of 85

10 of 85

Part 1

edX Architecture: High-level Overview

  • What is edX?
  • Where are we today?
  • Where are we going?

11 of 85

12 of 85

13 of 85

14 of 85

Data Flow

15 of 85

16 of 85

17 of 85

Authentication

18 of 85

Authorization

19 of 85

Authorization

20 of 85

Part 1

edX Architecture: High-level Overview

  • What is edX?
  • Where are we today?
  • Where are we going?

21 of 85

22 of 85

23 of 85

24 of 85

25 of 85

26 of 85

27 of 85

Part 2

edX Architecture: Data and Scale

  • Content
  • Analytics
  • Scale

28 of 85

Part 2

edX Architecture: Data and Scale

  • Content
  • Analytics
  • Scale

29 of 85

Content

30 of 85

User

31 of 85

Data Sources of Truth

ECommerce

  • Products & Pricing
  • User Baskets
  • User Orders

Marketing

  • Program Pages
  • Course Pages

Studio

  • Course Run Content
  • Course Structures

LMS

  • Users
  • Groups & Roles
  • User ↔ Content-Metadata Relationships�Enrollments, Entitlements, ..
  • User↔Organization�Relationships
  • Submissions
  • Grades & Completion
  • Field Overrides

Credentials

  • Program Certificates
  • Course Certificates (TBD)

Analytics Result Store

  • Data Stream
  • Computed Data

Catalog

  • Organizations
  • Program Metadata
  • Course Metadata�title, description, syllabus, prereqs
  • Course Run Metadata�start, end, instructors, language
  • Content Metadata ↔ Content Metadata Relationships
  • Content Metadata ↔ Organization�Relationships

32 of 85

Course Structure

XBlock: reusable building block for course content��Course structure: directed acyclic graph of XBlocks�

XBlock types:

  • Structural (platform-provided)
    • Section = chapter
    • Subsection = sequential
    • Unit = vertical
  • Component (platform-provided + custom-built)
    • problem (Checkboxes, Dropdown, etc)
    • html (Text, Announcement, etc)
    • video
    • discussion
    • openassessment (Open Response Assessment)
    • drag-and-drop-v2
    • library_content (Randomized Content Block)
  • Orphan (not in course hierarchy)
    • course_info: handouts, updates

33 of 85

LMS View

Course Outline

Course

Section

Subsection

34 of 85

LMS View

Courseware

Subsection

Section

Unit

Unit

html�component

CAPA problem�component

35 of 85

Content Size(# of XBlocks in edx.org courses, with 60 types of XBlocks)

36 of 85

XBlock Types on edx.org

annotatable

chapter

combinedopenended

conditional

customtag

discussion

done

drag-and-drop-v2

edx_sga

edx-reverification-block

error

google-calendar

google-document

graphical_slider_tool

html

HTML

imageannotation

library_content

lti

lti_consumer

problem

problem-builder

problemset

randomize

rate

recommender

schoolyourself_lesson

schoolyourself_review

sequential

split_test

step-builder

survey

textannotation

ubcpi

vertical

video

videoalpha

videosequence

word_cloud

wrapper

mentoring

officemix

openassessment

oppia

p

pb-answer

pb-answer-recap

pb-choice

pb-column

pb-completion

pb-dashboard

pb-instructor-tool

pb-mcq

pb-message

pb-mrq

pb-table

pb-tip

peergrading

poll

poll_question

37 of 85

XBlock views provide HTML and JS to run in user’s browser.

XBlock developers implement front-end and back-end code,

requiring approval to install on edx.org.

Backend code must be written in Python.

XBlock backends run in an edX platform (LMS or Studio) runtime. The runtime provides out-of-the-box services such as internationalization, etc.

The Field Data runtime service provides a data storage abstraction for user data (in SQL) and content data (in mongoDB).

The modulestore is edX’s abstraction for content data.

38 of 85

Course Content Extensions

  • Installation required on edX server
    • XBlock
      • custom frontend (HTML/JS) and backend (Python)
  • Installation not required
    • HTML XBlock
      • custom frontend only
      • (currently) not sandboxed
    • JSInput Problem
      • custom frontend view
      • custom grading (Python)
    • LTI
      • need external server to host content
      • frontend view constrained within an iFrame
    • External Grader

39 of 85

Part 2

edX Architecture: Data and Scale

  • Content
  • Analytics
  • Scale

40 of 85

Analytics

41 of 85

Analytics

42 of 85

Part 2

edX Architecture: Data and Scale

  • Content
  • Analytics
  • Scale

43 of 85

edx.org Usage Growth(per quarter)

44 of 85

edx.org Usage Growth

(compounded)

45 of 85

edx.org Content Growth(# of courses)

46 of 85

Developer Growth

(edX employees only)

47 of 85

Web Usage

All

Desktop

Mobile & Tablet

1 Week

1 Month

1 Day

Tues

48 of 85

Web Usage

(courses.edx.org only)

All

Desktop

Mobile & Tablet

1 Week

1 Month

1 Day

49 of 85

Mobile Usage

All

Android

iOS

50 of 85

Web Performance�(average across all LMS pages)

requests per min

avg response time

51 of 85

Web Performance�(LMS Courseware page)

requests per min

avg response time

percentiles of response time

52 of 85

Scaling with Reactive Manifesto

Elastic

LMS: 13k rpm�Studio: 60 rpm

no bottlenecks�

Responsive

99% < 2s

consistent

Resilient�99.9% uptime

MTTF & MTTR

isolation

53 of 85

Scaling with Reactive Manifesto

Elastic

LMS: 13k rpm�Studio: 60 rpm

no bottlenecks�

Responsive

99% < 2s

consistent

Resilient�99.9% uptime

MTTF & MTTR

isolation

Message Driven

event-driven

asynchronous

loosely coupled

location transparency

54 of 85

Scaling in devOps

  • Environments have own AWS Virtual Private Cloud
    • prod, stage
  • Deployments have own AWS account, secure-config repos
    • edx, edge
  • Clusters are independently deployed applications (IDAs)
    • edxapp-cms, edxapp-lms, discovery, xqueue, insights, forums, ecommerce, analytics-api, credentials
  • Create triplets: prod-edx-discovery

55 of 85

Scaling in devOps

  • Auto scaling groups (ASG) for edxapp
    • Production: typically 7-12
    • Edge: 2-4
    • Stage: 2
  • Each ASG typically has 22 instances
  • MongoDB
    • Primary & secondary - both are readable
    • CMS - accesses primary only
    • LMS - accesses primary or secondary
  • MySQL
    • Replica failover provided by RDS
    • Secondaries spread across Availability Zones

56 of 85

Part 3

edX Architecture: Technical

57 of 85

58 of 85

Learning Tools Interoperability (LTI)

  • Connects learning systems (LMS) with external tools.
  • Standard created by IMS Global Learning Consortium
    • Version 1.0 (2010)
      • LTI Tool Consumer
        • Typically an LMS that consumes external tool
        • Provides user and context to the Provider.
      • LTI Tool Provider
        • Provides learning service/tool to the Consumer.
        • Can be hosted anywhere.
    • Version 1.1 (2012)
      • Introduces LIS Outcomes Service for Provider to pass back scores to Consumer.
    • Version 2.0 (2014)
      • Introduces Tool Proxy and REST-based communication between services.

59 of 85

LTI 1.1 Config

  • Tool Provider administrator provides configuration and credentials to Tool Consumer administrator as an initial out of band exchange.�
  • For Open edX, configuration information is entered in Course and LTI consumer block settings as described in the documentation.�

60 of 85

LTI 1.1 Launch

Whenever a user accesses an LTI link, the Tool Consumer “launches” the LTI tool in an embedded iFrame or a new browser window by sending a POST request to the Tool Provider.

Fields sent in HTML Form to TP

* context_id is identifier of TC's context� Context may be of type:

1. Course template

2. Course offering

3. Course section

4. Group

5. None if launched outside of context�

* resource_link_id: unique per TC's usage of the LTI link�

* user_id: non-identifiable, primary-key of user�

* custom parameters requested by TP in its configuration

If scores are passed back to TC:� * lis_outcome_service_url: where to pass back� * lis_result_sourcedid: unique for (context_id, resource_link_id, user_id)

61 of 85

LTI 1.1 Score API

  • A Tool Provider may optionally send scores back to the Tool Consumer.�
  • As server-to-server calls, these score management APIs may be called at any time.�
  • lis_result_sourcedid remains as the unique identifier for the (context_id, resource_link_id, user_id) tuple.

62 of 85

63 of 85

64 of 85

Automated Communication Engine

65 of 85

Schedules

Command Query Responsibility Segregation (CQRS)

  • Writes
    • Course Team Content edits
    • Learner Enrollment changes
  • Reads
    • Asynchronous schedules task management

Separation of Concerns

  • Schedules
    • Higher-level business and policy layer
    • Enrollments, dates and deadlines
  • Automated Communication Engine (ACE)
    • Lower-level detail layer
    • Pluggable Notifications framework

Data-driven development

  • Monitoring of errors and metrics via�New Relic and Splunk Logs
  • Data analysis via Tracking Logs and GA

Schedules README

66 of 85

XQueue

67 of 85

XQWatcher Pull Model

  • “Active” model that constantly polls for submissions.�
  • Recommended pattern for external graders�

68 of 85

XServer�Push Model

  • “Passive” model that registers a web interface to be called by XQueue.

  • Deprecated pattern in favor of other xBlock integrations such as LTI.

69 of 85

eCommerce

  • Each user has only one Basket.
  • edX.org sells seats, not content.
  • Code uses Django Oscar and its models.
  • Otto is the pet name for our edX extensions.
  • Product classes
    • Entitlement: course id, seat type
    • Course Run Seat: course run id, type, verification required, credit provider, num of credits
    • Coupon: B2B
    • Enrollment codes: quantity of seats with a CSV of codes to enter in a Basket.

70 of 85

Purchase Flow

  • Order fulfillment happens asynchronously from the checkout workflow.
  • User is taken to the receipt page before order is fulfilled.�
  • ECOM, ECOM Worker, and LMS are each separate IDAs. The enrollment path depends on each of them to be responsive.
  • ECOM Worker is a thin wrapper above Django celery in the context of order fulfillment, calling REST APIs in the ECOM process - unclear of its value in the fulfillment flow.
  • Order status remains open until enrollment is successful.

71 of 85

Forums

72 of 85

Django Frontend

73 of 85

TODO

Topics/Features that still need slides

  • SSO & OAuth
  • JSInput
  • CAPA

74 of 85

Part 4

edX Architecture: Technical Development

75 of 85

edx.org Server Environments

(running on AWS services, except Devstack)

  • Production:
    • Prod: Hosts courses published on edx.org marketing site
    • Edge: Secondary production environment with few additional features enabled; courses not published on marketing site
  • Stage: Final testing environment before deployment to Prod
  • Sandbox: Temporary servers created by developers for testing
  • Load: Shared resource for load testing
  • Devstack: Localhost development and testing

76 of 85

Tools & Technology (1)

  • Languages:
    • Server-side: Python 2.7
    • Client-side: ES6/ES2015, HTML, CSS (Sass)�deprecated: Coffeescript, ES5
  • Web frameworks:
    • Server-side: Django 1.8.13 -> Django 1.11
    • Client-side: React, Redux, Bootstrap, Webpack�deprecated: Backbone, Underscore, RequireJS
  • Storage: MySQL, MongoDB, S3
  • Search: ElasticSearch
  • Docs: ReStructured Text, Sphinx

77 of 85

Tools & Technology (2)

  • Analytics
    • Processing Environment: Hadoop (EC2 & EMR), Luigi
    • Storage: HDFS (AWS S3) + Hive, MySQL, Vertica (Postgres DB) on EC2
    • Visualization: Google Analytics, Tableau, DataDog
  • Mobile
    • OS and Languages: Android (Java) & iOS (Swift, ObjectiveC)
    • IDEs: Android DevStudio, Xcode
    • Build tools: Gradle

78 of 85

Monitoring & Data Analysis

  • New Relic – performance and crash analysis
  • Splunk – log analysis
  • Datadog – statistical analysis
  • Crashlytics (Fabric) – crash analysis of mobile apps
  • Coursegraph - graph query of course content
  • Google Analytics – usage analysis
  • Analytics Pipeline (Vertica and Tableau)
  • Local Profiling: PyInstrument, RunSnakeRun

79 of 85

Coding Standards

  • Internationalization (i18n) / Localization (l10n)
    • RTL (Right-to-Left)
  • Accessibility (a11y)
  • REST API Conventions
  • Quality linters: PyLint, ESLint, etc
  • Test Coverage
  • Security
  • Clean Code

80 of 85

Testing

  • CI: Jenkins, Travis
  • Unit tests: Python unit tests
  • UI Unit tests: Jest (JS Tests)

deprecated: Karma/Jasmine

  • Acceptance tests: Bokchoydeprecated: Lettuce
  • Load tests:
    • Server-side: Locust.io
    • Client-side: sitespeed.io
  • Task management: paver, npm scripts

81 of 85

Security

  • Goals
    • Confidentiality (who can read)
    • Integrity (who can edit)
    • Availability (prevent denial of service)
  • Authentication
    • Django Authentication classes
    • Session cookies (Web transactions)
    • OAuth bearer tokens (API transactions)
    • JWT tokens (server-server transactions for now)deprecated: API Keys
    • Single Sign On
  • Authorization
    • Django Permission classes
    • LMS: has_access
    • Server-side checks; can’t trust client

82 of 85

Security Attacks

  • XSS (Cross-site scripting)
    • Safe Templates Linter
  • CSRF (Cross-site request forgery)
    • Safe Endpoints Middleware
    • CSRF Middleware
    • exceptions: CORS (Cross-origin Resource Sharing)
  • Safe Sessions Middleware
    • Binds user to session cookie
    • Enforces cookie expiration

83 of 85

API Design

  • Authentication: OAuth2/JWT access tokens using Bearer authentication scheme.
  • Authorization: Server-side access control checks for all data access.
  • Client/server separation of concerns
    • Business logic centralized on server
    • Pluses: Thinner clients and future maintainability
    • Minuses: Offline support is difficult
  • Performance:
    • Response Time: 95% response time < 2 seconds
    • Round Trips minimized. Tradeoffs between payload size, pre-fetching, and client-side caching of the data.
    • Payload Size minimized by parameterized APIs (filters, etc).
  • Strategy: Favoring Generic APIs over Mobile-specific ones
  • API Conventions: Wiki document

84 of 85

Part 5

edX Architecture: Sustainability

85 of 85

Developer Documentation