-2

Using this docker-compose.yml I have created a container:

version: "3.9"
services:
    database:
        image: mcr.microsoft.com/mssql/server
        user: root
        restart: always
        container_name: ContainerNameHere
        volumes:
            - /Organization/Databases:/var/opt/mssql/data
        environment:
            - ACCEPT_EULA=Y
            - SA_PASSWORD=password_here
            - MSSQL_PID=Express
        ports:
            - 1433:1433
        logging:
            driver: none
        networks:
            - NetworkNameHere
networks:
    NetworkNameHere:
        name: NetworkNameHere
        driver: bridge

And it has ZERO user databases in it. It's just a simple empty SQL Server docker container with no database and no data in it.

But here's my top command's results:

top command results

As you can see, it's totally destroying my VPS.

This is so frustrating and the Microsoft team has not answered me yet.

Why SQL Server's docker container acts this way and what should I do to fix this?


I have 10 GB of free space:

df -h /

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 20G 8.9G 10G 47% /

My SQL Server build version is 15.0.4153.1, which means it's SQL Server 2019 CU13.

My host OS (that runs the docker demon) is Debian GNU/Linux 10 (buster).

2
  • @SaeedNeamati Your first process in TOP indicates 13.0g of VIRT ram required for sqlserver. Where will this come from when you have NO SWAP space available? A 4G server would seem to be too small for the configuration you are trying to support. Oct 21 '21 at 14:17
  • 1
    Please post results of HTOP so we can see your CPU/Cores capacity and usage. Thanks Nov 10 '21 at 1:42
5

From the top output:

load average: 0.94, 0.55, 0.51

Those are the average CPU utilization over the last 1, 5, and 15 minutes. So...it doesn't seem like SQL Server is using a huge amount of resources based on your screenshot (assuming two CPUs).

The 3rd line also shows 87.9 % idle time on the CPU.

You commented:

the point is that when no load exists for SQL Server, why does it consume the resources? We have 10 mariadb containers on one VPS and they don't use even 1% of the CPU when there is no load.

MySQL is a very different database engine from SQL Server. That's comparing apples and oranges, I think.

SQL Server has many background processes and tasks that fire periodically to maintain the state of the system. Some examples include:

  • the deadlock monitor, which periodically checks for queries involved in an unresolvable deadlock
  • ghost cleanup, which runs at intervals to delete rows that have been marked for deletion
  • the scheduler monitor, which verifies that workers are properly cooperatively yielding time on the CPUs to other tasks (and creates error log entries and crash dumps if they are not)
  • the default system_health extended events session, which writes diagnostic information pretty regularly

There are many other items like that. So, from time to time you will see an otherwise idle SQL Server instance use some CPU. On a small two core system, it may even look like a high percentage of the overall capacity. But I wouldn't expect it to be a problem per se for the intended workload on the system. Nor does it seem like a bug or overall problem with SQL Server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.