Skip to main content

Sitecore

Optimize Sitecore Docker Instance: Increase Memory Limits

Business Performance Checklist Concept, Businessman Using Laptop Doing Online Checklist Survey, Filling Out Digital Form Checklist.

Running a Sitecore Docker instance is a game-changer for developers. It streamlines deployments, accelerates local setup, and ensures consistency across environments. However, performance can suffer – even on high-end laptops – if Docker resources aren’t properly optimized, especially after a hardware upgrade.

I recently faced this exact issue. My Sitecore XP0 instance, running on Docker, became noticeably sluggish after I upgraded my laptop. Pages loaded slowly, publishing dragged on forever, and SQL queries timed out.

The good news? The fix was surprisingly simple: allocate more memory to the proper containers using docker-compose.override.yml

What Went Wrong?

After the upgrade, I noticed:

  • The Content Management (CM) UI was lagging.
  • Publishing and indexing took ages.
  • SQL queries and Sitecore services kept timing out.

At first, this was puzzling because my new laptop had better specs. However, I then realized that Docker was still running with outdated memory limits for containers. By default, these limits are often too low for heavy workloads, such as Sitecore.

Root Cause

Docker containers run with memory constraints either from:

  • docker-compose.override.yml
  • Docker Desktop global settings

When memory is too low, Sitecore roles such as CM and MSSQL can’t perform optimally. They need significant RAM for caching, pipelines, and database operations.

The Solution: Increase Memory in docker-compose.override.yml

To fix the issue, I updated the memory allocation for key containers (mssql and cm) in the docker-compose.override.yml file.

Here’s what I did:

Before

mssql: 
 mem_limit: 2G

After

mssql:
  mem_limit: 4GB

cm:
  image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-xp0-cm:${VERSION:-latest}
  build:
    context: ./build/cm
    args:
      BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
      SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION}
      SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-sxa-xp1-assets:${SXA_VERSION}
      TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION}
      SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest}
      HORIZON_RESOURCES_IMAGE: ${SITECORE_MODULE_REGISTRY}horizon-integration-xp0-assets:${HORIZON_ASSET_VERSION}
  depends_on:
    - solution
  mem_limit: 8GB
  volumes:
    - ${LOCAL_DEPLOY_PATH}\platform:C:\deploy
    - ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
    - ${HOST_LICENSE_FOLDER}:c:\license
    - ${LOCAL_ITEM_PATH}:c:\items-mounted

How to Apply the Changes

  1. Open docker-compose.override.yml.
  2. Locate the mssql and cm services.
  3. Update or add the mem_limit property:
    • mssql → 4GB
    • cm → 8GB
  4. Rebuild containers:
    
    docker compose down
    docker compose up --build -d
  1. Check updated limits:
  docker stats

Impact After Change

After increasing memory:

  • CM dashboard loaded significantly faster.
  • Publishing operations completed in less time.
  • SQL queries executed smoothly without timeouts.

Why It Works

Sitecore roles (especially CM) and SQL Server are memory-hungry. If Docker allocates too little memory:

  • Containers start swapping.
  • Performance tanks.
  • Operations fail under load.

By increasing memory:

  • CM handles ASP.NET, Sitecore pipelines, and caching more efficiently.
  • SQL Server caches queries better and reduces disk I/O.

Pro Tips

  • Ensure Docker Desktop or Docker Engine is configured with enough memory globally.
  • Avoid setting memory limits too high if your laptop has limited RAM.
  • If using multiple Sitecore roles, adjust memory allocation proportionally.

Final Thoughts

A simple tweak in docker-compose.override.yml can drastically improve your Sitecore Docker instance performance. If your Sitecore CM is sluggish or SQL queries are slow, try increasing the memory limit for critical containers.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Saket Singh, Senior Technical Consultant

Saket Singh is a Senior Technical Consultant at Perficient GDC, Nagpur, specializing in Sitecore development with a focus on SXA, Sitecore Headless, and composable DXP architectures. With over 9 years of experience in enterprise web development, Saket brings deep expertise in ASP.NET, C#, MVC, Web API, MSSQL, and JavaScript. He is passionate about exploring emerging technologies, optimizing digital experiences, and building scalable solutions that bridge marketing and technology. Outside of project delivery, Saket actively shares insights through blogs and tutorials, aiming to simplify complex concepts for developers and digital teams.

More from this Author

Follow Us