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:inetpubwwwrootApp_Datalogs - ${HOST_LICENSE_FOLDER}:c:license - ${LOCAL_ITEM_PATH}:c:items-mounted
How to Apply the Changes
- Open
docker-compose.override.yml
. - Locate the mssql and cm services.
- Update or add the mem_limit property:
mssql → 4GB
cm → 8GB
- Rebuild containers:
docker compose down docker compose up --build -d
- 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.
Source: Read MoreÂ