Running MongoDB on Non-AVX CPUs Using Custom Docker Containers

Running MongoDB on Non-AVX CPUs Using Custom Docker Containers

MongoDB is a widely deployed NoSQL database system known for its high performance and reliability. However, it has come to light that MongoDB’s default storage engine, WiredTiger, requires Advanced Vector Extensions (AVX) instruction set support. This means that if your CPU does not support AVX, you may encounter issues while running MongoDB.

Thankfully, there are workarounds available to overcome this issue. One option is to switch to a different storage engine that does not require AVX, such as the in-memory storage engine. However, this may not be feasible for all users, as WiredTiger is the default and preferred storage engine for many MongoDB users.

Another solution is to use a modified version of MongoDB that has been altered to work without AVX. However, this requires compiling MongoDB from source, which can be a complex and time-consuming process.

An easier solution is to use a Docker container that has been pre-configured with a MongoDB version that does not require AVX. Docker is a platform that allows developers to create, deploy, and run applications in a containerized environment. By using a Docker container, you can quickly and easily set up a MongoDB instance that does not require AVX support.

To get started, you can download the MongoDB Docker image from Docker Hub, which I have created and made available at the following link: https://hub.docker.com/_/mongo. This image includes the latest stable release of MongoDB and can be easily customized to suit your needs.

Alternatively, if you need a MongoDB Docker image that has been pre-configured to work without AVX, you can use a pre-built Docker image such as the one provided by the “MongoDB for non-AVX CPUs” project on GitHub. This image has MongoDB version 4.4.3 pre-installed and is designed to work without AVX support. Simply download the Docker image and run it in your environment, and you’ll have a working MongoDB instance that is compatible with your non-AVX CPU.

Our pre-built MongoDB image compiled without AVX requirements is available on Docker Hub at nertworkweb/mongodb-no-avx. The build configuration mirrors the official upstream MongoDB source tree with target architecture flags tuned for non-AVX x86_64 processors.

Using a Docker container not only provides a quick and easy solution to the AVX issue, but it also offers several other benefits. Docker containers are lightweight and can be quickly spun up or down as needed, making them ideal for development and testing environments. Additionally, Docker ensures consistency across different environments, which can help to reduce issues caused by differences in system configurations.

In conclusion, if you’re experiencing issues with MongoDB due to a lack of AVX support, using a Docker container can provide an easy and reliable solution. By using a pre-built Docker image or the official MongoDB Docker image, you can quickly set up a MongoDB instance that is compatible with your non-AVX CPU, allowing you to continue using MongoDB without any issues.

Related Homelab Guide: Configuring Proxmox VE NoVNC Consoles Behind HAProxy.

>_ Engineering Discussion 3 Comments

+ Add Field Note ↓
  1. Thank you for documenting the AVX CPU flag requirement in MongoDB 5.0+! We hit that exact ILL illegal instruction crash on an older Xeon E5 lab node and pinning to mongo:4.4.29 got Unifi and Graylog back up immediately.

  2. Tip for anyone running MongoDB inside Proxmox VE on modern hardware: changing the VM CPU type from default kvm64 to host exposes the host AVX/AVX2 flags without needing to downgrade MongoDB!

  3. Checking grep -o avx /proc/cpuinfo before upgrading container images should be mandatory in pre-flight scripts. Saved us an hour of debugging why the container kept restarting with exit code 132.

Leave a Technical Comment

Share CLI tips, hardware notes, or questions below. Inline backticks (`command`) are supported.

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

Related Engineering Notes