Tuning Open edX uWSGI workers for the LMS and Studio

Raising the LMS and Studio uWSGI worker counts on one server helps only while CPU and memory have room. This page covers how to read latency against CPU and the memory limits that cap the change.

On this page

When raising uWSGI workers for the Open edX LMS and Studio helps

Raise the worker count only when a single Tutor-run server shows slow LMS or Studio pages under load and the host still has spare CPU and memory. The two levers are OPENEDX_LMS_UWSGI_WORKERS for learner-facing pages and OPENEDX_CMS_UWSGI_WORKERS for Studio, the authoring interface used by course teams. Both are set through your Tutor configuration (the config.yml file in the Tutor project root), and you apply them by regenerating and redeploying the platform so the new values reach the running containers. uWSGI workers are separate Python processes that each handle one request at a time, so more workers let the server serve more requests in parallel. Each worker also holds its own copy of the application in memory, which is why the count cannot grow without limit.

Adding workers is the right lever when requests queue because every worker is busy, while CPU and memory still have headroom. It is the wrong lever when the bottleneck sits elsewhere. If MySQL or MongoDB is slow, extra workers only send more queries to the same slow databases. If Celery queues back up, grading and email delays will not improve from more web workers. If the host swaps memory, more workers will make latency worse, because the server pages out and each request waits longer. Before changing anything, measure the request queue, CPU load, resident memory per worker and database response times over a representative window, and record a baseline so you can judge whether the change helped. Ask your operator or partner to confirm which of these signals they will use as the acceptance check.

Which worker setting to change and when

Learner complaints about course pages, progress loading or the dashboard usually point to the LMS. Before touching OPENEDX_LMS_UWSGI_WORKERS, check whether requests are queuing for a free worker or whether each request is slow on its own. Queuing shows up as rising response times with spare CPU and memory on the host. Slow individual requests show up as high CPU during peaks, usually with database or cache calls dominating the trace.

  • Read latency first: Compare p95 response time for LMS paths during the complaint window against a normal hour. Queuing rises gradually as concurrency climbs.
  • Check CPU next: If the host has idle cores while latency is high, more workers may help. If cores are saturated, more workers will only add contention.
  • Watch memory: Each uWSGI worker holds its own copy of the application in memory. Confirm headroom before adding workers, or the host may swap.
  • Expect the change to affect: Throughput and queue wait for learner requests. It does not shorten an individual slow database query.
  • Confirm the database side: Check MySQL and Memcached or Redis latency. A saturated backend will not be fixed by more LMS workers.

If the LMS workers are busy but the host still has capacity, increase the count in small steps and re-measure before going further.

Configuration options and what each one trades off

This table compares the LMS worker count, the Studio worker count and the shared server memory budget, showing what each setting gains and what it costs. Read each row as a question: raise it only when the signal in the last column appears, and confirm the key names and defaults in the Tutor release you run.

SettingEffect when raisedRisk and too-high signal
OPENEDX_LMS_UWSGI_WORKERSMore learner requests served in parallel on the LMS, which can lower queueing for course pages and progress savesEach worker holds its own memory. Signal: swap use climbs, the kernel logs OOM kills of uwsgi processes, or CPU stays saturated with no latency gain
OPENEDX_CMS_UWSGI_WORKERSMore parallel Studio requests for authors, such as saving units and loading the course outlineStudio workers compete with LMS workers for the same RAM. Signal: authors see slow saves while LMS response times also rise, suggesting the server is overcommitted
Shared server memory budgetSets the ceiling for total worker count. Plan it from measured resident memory per worker under real trafficIf the sum of LMS and CMS workers, plus MySQL, MongoDB, Redis or Memcached and Celery, exceeds physical RAM, the host swaps and latency degrades sharply
CPU capacity per workerMore workers only help when CPU is idle. Check load average and per-core utilization before raising a valueSignal: CPU is pinned near 100 percent across cores and p95 latency grows as workers are added, meaning the bottleneck is compute, not worker count
Latency under loadConfirms whether an increase helps. Compare response times for the same test profile before and after the changeSignal: no measurable improvement after a raise, or errors appear as requests time out at the proxy, which usually points to memory pressure or a database limit
Configuration locationChange these values through the Tutor configuration keys, then regenerate and redeploy the affected servicesConfirm the key names, default values and any memory-related behavior against the Open edX release in use before changing production

How to tune uWSGI workers on one server, step by step

This sequence takes a single Open edX server from a measured baseline to a worker count that improves LMS and Studio latency without exhausting CPU or memory, with a written record of each change.

  1. Capture a baseline under realistic load

    Before touching any setting, the operator records response times for the LMS and Studio, CPU use, and memory use per process group while a representative workload runs against the server. The workload should mirror real traffic, such as course page views for the LMS and course editing for Studio, and run long enough to cover normal peaks. Use your existing monitoring tools, or install an agent such as Prometheus with node metrics if none is in place. The step is done when you have a saved set of numbers for latency at the median and tail, CPU load, and free memory under that load. Record the date, the server size, and the load generator settings so the baseline can be reproduced later.

  2. Confirm the Tutor environment and release

    Check the Tutor version, the Open edX release running on the server, and the current values of OPENEDX_LMS_UWSGI_WORKERS and OPENEDX_CMS_UWSGI_WORKERS in the Tutor configuration. Confirm the server's CPU core count, total memory, and whether other services such as MySQL, MongoDB, Memcached or Redis, and Celery workers share the machine. Open edX supports only the latest named release, so confirm which release your deployment is on before you rely on any behavior described in the release notes. Ask your team or vendor to confirm the exact worker keys for your release in the Tutor documentation. The step is done when a written note lists the release, Tutor version, current worker values, and the resources shared with other services.

  3. Change one worker count in configuration

    Change either the LMS or the CMS worker count in the Tutor configuration, not both at once, so that any change in latency or memory can be attributed to one variable. Make the edit in the Tutor config file on the server, and keep a copy of the previous file so you can revert. A change to the LMS count is usually the first candidate when learner-facing pages are slow, while a change to the CMS count is tested when Studio is slow. Do not raise a count above what the memory measured in the baseline can hold. The step is done when the configuration file differs from the saved copy in exactly one worker key and the change is logged with the reason for it.

  4. Apply the configuration and restart services

    Apply the configuration with Tutor, then restart the affected services so the new worker count takes effect. Watch the service logs for startup errors, and confirm that the LMS or CMS responds to a basic request before running load. If the restart fails or memory climbs sharply at startup, revert to the saved configuration and restart again. The step is done when the service is running with the new worker count, the logs show no startup errors, and a simple page request succeeds.

  5. Re-measure under the same load

    Run the same workload used for the baseline, with the same duration, user pattern and test data, and capture the same measurements of latency, CPU and memory. Compare the results to the baseline at the same points in time. Look for lower tail latency without a rise in error rates, and watch whether memory use gets close to the total available after other services are counted. The step is done when you have a second set of numbers, and you have noted whether latency improved, stayed flat, or worsened.

  6. Record the before and after numbers

    Write down the baseline values and the post-change values side by side for each worker count tested, with the configuration used, the date, and the load pattern. Include latency at the median and tail, CPU load, memory use, and any errors or timeouts seen in the logs. A simple table in your change record is enough. The step is done when every change has a row in the record, so anyone reviewing the server later can see what was tried and what happened.

  7. Stop when CPU or memory headroom closes

    Repeat the single-change cycle for the next worker count only while latency improves and CPU and memory still leave room for the other services on the server. Stop when latency no longer improves, when CPU stays saturated under load, or when memory use leaves too little headroom for the database, cache, Celery workers, or the operating system. If the limit is reached, the remaining options are a larger server, moving services apart, or a multi-node design, which are planning decisions rather than further tuning. The step is done when you have a chosen worker count for each process, the reasoning recorded, and a note of the memory and CPU ceiling observed.

The memory limits that cap how many workers fit

Worker count is capped by memory long before CPU runs out on a single server. Each card covers one limit that decides how many LMS and Studio workers the machine can hold without swapping or starving its data stores.

Total RAM across all services

Start with the full memory budget of the server, not the amount allocated to uWSGI. Count the operating system, the LMS and Studio processes, Celery workers, MySQL, MongoDB, Memcached or Redis, the reverse proxy and any monitoring agents. Whatever remains after these is the ceiling for web workers. Check it under peak load, because a server that fits at idle often does not fit during a course launch.

Per-worker memory footprint

Measure the resident memory of one LMS worker and one Studio worker in your environment before choosing a count. Read RSS from the process list while the service handles realistic traffic, then multiply by the planned worker count. Footprints vary with installed plugins, XBlocks and course size, so a figure from another deployment is only a starting guess. Repeat the measurement after each release or plugin change.

MySQL and MongoDB connection load

Each uWSGI worker holds database connections, and the count multiplies with worker number. Check the connection limit on MySQL and the connection pool settings in your deployment, then confirm MongoDB can absorb the concurrent load without memory pressure of its own. Adding workers can exhaust database connections before the server runs out of RAM, so the database limit may cap the count first.

Cache sizing in Memcached or Redis

Multi-node deployments need a shared Django cache backend, and that cache consumes memory on the same host when it is co-located. Size it for the working set of sessions and cached data, not for the worker count. An undersized cache forces repeated database reads, which raises latency per request, while an oversized one takes memory from the workers.

Swap behavior under load

Swap keeps a server alive but turns memory pressure into request latency that climbs in steps. Watch swap-in and swap-out rates during peaks, not only the total swap used. If workers are paged out, a higher worker count makes responses slower, not faster. Treat sustained swap activity as a sign the count is too high and confirm the swap policy with your platform team.

How latency, CPU and memory decide the next worker change

The path starts with a measured baseline of LMS and Studio latency under realistic load. The reader then asks which resource is the limit: if latency tracks CPU saturation and memory headroom exists, raise one worker count and re-measure. If latency is waiting on the database or a Celery backlog, more uWSGI workers will not help and the work moves to that dependency. Stop when the change no longer improves latency or memory is exhausted, then consider horizontal scaling.

Decision path for changing uWSGI worker counts on one server.

Operational risks of raising worker counts

Raising uWSGI worker counts changes how a single server behaves under failure, during restarts and under memory pressure. The cards below cover the risks to plan for before the change, and the checks that show whether the change helped or only hid a problem.

Out-of-memory kills of workers

Each uWSGI worker is a full Python process with its own memory footprint, so more workers raise the total memory the LMS and Studio can claim. When the host runs out, the kernel may terminate a worker, or a larger process, without warning. Before raising OPENEDX_LMS_UWSGI_WORKERS or OPENEDX_CMS_UWSGI_WORKERS, measure resident memory per worker under real traffic, add the LMS and Studio totals together, and confirm the sum leaves headroom for MySQL, MongoDB, Memcached or Redis, and Celery on the same host. Check kernel logs for OOM events after each change.

Longer restart windows

A higher worker count means uWSGI takes longer to start, reload and drain requests during a deploy, a configuration change or an in-place upgrade. Each worker loads the full application before it can serve requests, so the time to return the site to full capacity grows with the count. Measure how long a restart takes now and after the change, and fold that time into your maintenance window plan. Confirm how long in-flight requests get to finish before the old workers stop.

Masking a database or cache bottleneck

More workers can make a slow MySQL query, a saturated MongoDB instance or a cache miss storm look like an application problem that more processes will solve. In practice, extra workers often open more database connections and send more concurrent queries, which can worsen contention. Before tuning, check database query time, connection counts and cache hit rates. If those are the constraint, fix them first, because raising workers only moves the queue into the data layer.

Wider blast radius of one server

When the LMS and Studio share one server, a single host failure takes down every worker, Celery process and cache on it at once. Raising worker counts does not add redundancy, and it increases the memory and CPU pressure that makes a failure more likely. Decide whether the single server is an acceptable failure domain for your learner base, and document what recovery looks like, including how long restoring from backup takes.

Logging and monitoring gaps

Tuning without measurements hides regressions. Collect per-worker memory, CPU, request latency at the 95th and 99th percentiles, error rates and uWSGI logs for both the LMS and Studio before and after each change. Watch for workers that respawn repeatedly, which signals memory exhaustion or crashes. Confirm your log retention covers the test window, and set alerts on OOM events and on latency thresholds you agree with the business owners.

Unchanged admin and Studio access controls

Tuning should not change who can reach Studio, the LMS admin pages or the Django admin. Keep the existing network rules, SSO settings, staff roles and admin URL restrictions as they are, and do not expose Studio on a new port or path to test capacity. Record the access configuration before the change and compare it afterward, so a tuning session does not quietly widen the attack surface.

Questions teams ask before tuning uWSGI workers

Can our own team tune uWSGI workers without a partner?

Yes, a team with Linux, Tutor and Django operations experience can tune worker counts on a single server, provided it has a staging copy to test against and metrics it trusts. The work is mostly measurement: you change one value, run a repeatable load test, read latency and memory, and repeat. Teams usually struggle less with the setting itself than with building a realistic load profile and deciding which latency numbers matter to their learners. Ask whether your engineers have time for several test cycles and someone who can own the results.

What drives the effort of a uWSGI tuning engagement?

Effort rises with the number of things that interact on the server. The main drivers are how many LMS and Studio workers you run, how much memory each worker uses under real courseware traffic, whether Celery workers share the same host, how the MySQL, MongoDB and cache layers respond under load, and how many course and enrollment patterns you need to reproduce. Existing monitoring that already separates web latency from CPU and memory shortens the work considerably. A quote should name which of these are in scope and how many test cycles are included.

How long does a tuning cycle take with load testing?

The length of a cycle depends mainly on how long a realistic load test takes to run and how many configurations you need to compare. Each cycle includes a baseline run, a change to the worker counts, a repeat run and a review of latency, CPU and memory under the same conditions. Test duration, the number of user journeys modeled and the time needed to restore a clean staging state all add to it. Ask the provider to state the number of cycles in the written scope, and confirm the duration against your own environment rather than relying on a general estimate.

What do we need to provide for the work?

The work needs three things from you: a load profile, metrics access and a staging copy. The load profile describes peak concurrency, the mix of browsing, course player and grading requests, and when peaks happen. Metrics access means read access to CPU, memory, swap, request latency and application logs for the LMS and Studio hosts. A staging copy should match production in Open edX version, server size, database and cache configuration, and course data volume closely enough that test results carry over. Without a staging copy, results describe a different system.

Does adding more uWSGI workers always improve performance?

No. Extra workers help only while the server has spare CPU and memory to run them. Once CPU saturates or the host starts swapping, more workers increase context switching and memory pressure, and latency gets worse. Workers also consume database and cache connections, so a higher count can move the bottleneck to MySQL or MongoDB. The right count is the point where latency stops improving under your load profile without exhausting memory. Confirm this with measurements, because the threshold differs by course content, plugins and hardware.

When should we move from one server to Kubernetes replicas instead?

Move toward Kubernetes replicas when one server cannot meet latency targets even after its memory and CPU limits are tuned, or when you need the ability to add capacity without a maintenance window. Tutor supports Kubernetes deployments, and the Tutor documentation describes how to run them. Before you move, confirm that your shared data stores and cache can serve several web pods, that your team can operate a cluster, and that your monitoring supports scaling decisions. Tuning a single server first often shows whether replicas are the right next step.

What determines the price of a partner quote?

A quote follows from the written scope, so the main price drivers are the environment, the number of test cycles, the number of load scenarios, and the amount of analysis and written recommendations required. Whether the work includes changes to Tutor configuration, memory limit adjustments, monitoring dashboards or a handover session also matters. DeployOpen does not publish a price list. Ask for the scope to list the environments covered, the test cycles, the deliverables, the retest approach and what is one-time versus recurring if you want ongoing tuning support.

How DeployOpen scopes and delivers uWSGI tuning

DeployOpen approaches uWSGI worker tuning for the Open edX LMS and Studio as a measured change to a platform you control, not a guess at a number. We scope the work in writing, make changes on your own server, and hand over the settings, the measurements and the reasoning behind them.

How we scope

  • Review the current Tutor setup, server size, memory and CPU headroom, and the LMS and Studio latency you see today.
  • Agree in writing which settings change, which environment is tested first, and what latency and memory results count as done.
  • Confirm the Tutor and Open edX release in use, since the supported release is the only one Open edX maintains, before any change is made.
  • Engagements are fixed-scope. Ongoing tuning checks and upgrades can be covered by a retainer, and a quote follows from the written scope.

How we build

  • Record a baseline of response times, worker memory use and CPU load under realistic traffic on a copy of your environment.
  • Change OPENEDX_LMS_UWSGI_WORKERS and OPENEDX_CMS_UWSGI_WORKERS in steps, then re-measure after each step against the baseline.
  • Check that container memory limits and the host's total memory still fit the chosen worker counts with room for Celery and databases.
  • Test failure behavior, including what happens when a worker is recycled or a request queue builds up at peak load.

How we hand over

  • Deliver the final configuration values, the Tutor config changes and the exact commands used to apply them.
  • Provide a short document with the baseline, each test result and the reason for the chosen LMS and Studio worker counts.
  • Walk your operations team through how to read latency and memory signals and when to revisit the settings.
  • Record rollback steps so your team can return to the previous values if a later change causes trouble.

How we support

  • Re-test worker settings after Tutor upgrades, plugin changes or a notable rise in enrollments, since those change memory use.
  • Offer optional retainer support for periodic reviews of latency, memory limits and worker counts on your server.
  • Coordinate tuning changes with your maintenance windows and the Celery and scaling work your team runs alongside.
  • Confirm support terms, response expectations and included review cycles in the written scope before work starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.