[GH-ISSUE #367] Nginx high memory consumption #186

Closed
opened 2026-02-26 10:30:43 +03:00 by kerem · 12 comments
Owner

Originally created by @witchent on GitHub (Jul 7, 2021).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/367

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
The started Nginx instance of the DocumentServer is using a lot of memory (12% from my 4gb system).

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Just start the docker image.

What is the expected behavior?
I don't know why OnlyOffice has to start nginx at all (I am running another instance in front of it all, which is using less then 1% of memory), but at least it should not use that much memory.

Did this work in previous versions of DocumentServer?
No idea, just started using it

DocumentServer Docker tag:
6.3

Host Operating System:
Arch linux x64

Originally created by @witchent on GitHub (Jul 7, 2021). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/367 **Do you want to request a *feature* or report a *bug*?** Bug **What is the current behavior?** The started Nginx instance of the DocumentServer is using a lot of memory (12% from my 4gb system). **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.** Just start the docker image. **What is the expected behavior?** I don't know why OnlyOffice has to start nginx at all (I am running another instance in front of it all, which is using less then 1% of memory), but at least it should not use that much memory. **Did this work in previous versions of DocumentServer?** No idea, just started using it **DocumentServer Docker tag:** 6.3 **Host Operating System:** Arch linux x64
kerem closed this issue 2026-02-26 10:30:44 +03:00
Author
Owner

@ShockwaveNN commented on GitHub (Jul 7, 2021):

Are you sure it's nginx memory? We generate font data on container start and this is rather CPU and memory intensive operation

<!-- gh-comment-id:875340469 --> @ShockwaveNN commented on GitHub (Jul 7, 2021): Are you sure it's nginx memory? We generate font data on container start and this is rather CPU and memory intensive operation
Author
Owner

@witchent commented on GitHub (Jul 7, 2021):

Well the process is called nginx and it's not going away even after 8 hours idling. But yea, it seems rather strange to me as well. I will experiment with the nginx settings this afternoon, maybe they can help

<!-- gh-comment-id:875341951 --> @witchent commented on GitHub (Jul 7, 2021): Well the process is called nginx and it's not going away even after 8 hours idling. But yea, it seems rather strange to me as well. I will experiment with the nginx settings this afternoon, maybe they can help
Author
Owner

@ShockwaveNN commented on GitHub (Jul 7, 2021):

This is that I get on one of my servers, which no one used now

image

So look like your non-zero CPU somehow related to custom configs maybe? Which command you used to run docker image?

<!-- gh-comment-id:875344103 --> @ShockwaveNN commented on GitHub (Jul 7, 2021): This is that I get on one of my servers, which no one used now ![image](https://user-images.githubusercontent.com/668524/124714564-9789f580-df0a-11eb-95d0-24ee92808f0b.png) So look like your non-zero CPU somehow related to custom configs maybe? Which command you used to run docker image?
Author
Owner

@witchent commented on GitHub (Jul 7, 2021):

Well no I am talking about the memory consumption, not the CPU usage. CPU was fine for me as well.
I am using docker-compose, I can paste my config here later this afternoon when I am back at my server.

<!-- gh-comment-id:875345461 --> @witchent commented on GitHub (Jul 7, 2021): Well no I am talking about the memory consumption, not the CPU usage. CPU was fine for me as well. I am using docker-compose, I can paste my config here later this afternoon when I am back at my server.
Author
Owner

@ShockwaveNN commented on GitHub (Jul 7, 2021):

Oh, sorry, confused CPU and memory, but on my screen there is 106M memory - I think it's good value too

Waiting for you config also please take a look at log files at /var/log/onlyoffice- maybe it's spamming errors and that cause higher than usual load

<!-- gh-comment-id:875349523 --> @ShockwaveNN commented on GitHub (Jul 7, 2021): Oh, sorry, confused CPU and memory, but on my screen there is 106M memory - I think it's good value too Waiting for you config also please take a look at log files at `/var/log/onlyoffice`- maybe it's spamming errors and that cause higher than usual load
Author
Owner

@witchent commented on GitHub (Jul 7, 2021):

onlyoffice:
    container_name: onlyoffice
    image: onlyoffice/documentserver
    restart: on-failure
    depends_on:
      onlyoffice-postgres:
        condition: service_healthy
      onlyoffice-rabbitmq:
        condition: service_healthy
    environment:
      DB_TYPE: postgres
      DB_HOST: onlyoffice-postgres
      DB_PORT: 5432
      DB_NAME: onlyoffice
      DB_USER: postgres
      DB_PWD: gXQqyG7elFVP02Uvhz9A
      AMQP_URI: amqp://guest:guest@onlyoffice-rabbitmq
    ports:
      - '8523:80'

With this the nginx process is using 12% of my 4GB memory.
Adding

      NGINX_WORKER_PROCESSES: 1
      NGINX_WORKER_CONNECTIONS: 512

to the environment variables actually fixes it without any noticeable differences. Do I have to expect a downside from this or should this be fine?

<!-- gh-comment-id:875788334 --> @witchent commented on GitHub (Jul 7, 2021): ``` onlyoffice: container_name: onlyoffice image: onlyoffice/documentserver restart: on-failure depends_on: onlyoffice-postgres: condition: service_healthy onlyoffice-rabbitmq: condition: service_healthy environment: DB_TYPE: postgres DB_HOST: onlyoffice-postgres DB_PORT: 5432 DB_NAME: onlyoffice DB_USER: postgres DB_PWD: gXQqyG7elFVP02Uvhz9A AMQP_URI: amqp://guest:guest@onlyoffice-rabbitmq ports: - '8523:80' ``` With this the nginx process is using 12% of my 4GB memory. Adding ``` NGINX_WORKER_PROCESSES: 1 NGINX_WORKER_CONNECTIONS: 512 ``` to the environment variables actually fixes it without any noticeable differences. Do I have to expect a downside from this or should this be fine?
Author
Owner

@rugk commented on GitHub (Jul 7, 2021):

@witchent If that is your real DB password you've just posted there, let's better change that…

Also, next time, consider using .env files or similar, so this does not happen again. Just as a tip. 🙂

<!-- gh-comment-id:875829923 --> @rugk commented on GitHub (Jul 7, 2021): @witchent If that is your real DB password you've just posted there, let's better change that… Also, next time, consider using `.env` files or similar, so this does not happen again. Just as a tip. :slightly_smiling_face:
Author
Owner

@witchent commented on GitHub (Jul 7, 2021):

No don't worry about that :D Was a random generated password. Thanks anyway for the tip (in fact it happened to me a long time back, not doing the same mistake anymore^^)

<!-- gh-comment-id:875831999 --> @witchent commented on GitHub (Jul 7, 2021): No don't worry about that :D Was a random generated password. Thanks anyway for the tip (in fact it happened to me a long time back, not doing the same mistake anymore^^)
Author
Owner

@ShockwaveNN commented on GitHub (Jul 8, 2021):

@witchent Could you start no docker-compose but simpled docker instance via

docker run -it -p 80:80 onlyoffice/documentserver

without any customization and compare memory load after it successfulyy started?

I want to rule out that did docker-compose customization do high memory usage, or plain docker on you server do have same?

<!-- gh-comment-id:876206463 --> @ShockwaveNN commented on GitHub (Jul 8, 2021): @witchent Could you start no docker-compose but simpled docker instance via ``` docker run -it -p 80:80 onlyoffice/documentserver ``` without any customization and compare memory load after it successfulyy started? I want to rule out that did docker-compose customization do high memory usage, or plain docker on you server do have same?
Author
Owner

@witchent commented on GitHub (Jul 8, 2021):

I can confirm that the same happens with the simple docker case.

<!-- gh-comment-id:876217129 --> @witchent commented on GitHub (Jul 8, 2021): I can confirm that the same happens with the simple docker case.
Author
Owner

@ShockwaveNN commented on GitHub (Jul 8, 2021):

Yeah, on fresh started docker I see similar number:
image

I think it's how nginx works, it hog memory on startup but lover consumption after some time, because in screenshot I showed earlier here https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/367#issuecomment-875344103 - container run for weeks

If this a problem for you you can use NGINX_WORKER_PROCESSES and NGINX_WORKER_CONNECTIONS, if you I think have less that 100 concurrent users (I may be wrong, but there is around 4 connection for user requred)

<!-- gh-comment-id:876227195 --> @ShockwaveNN commented on GitHub (Jul 8, 2021): Yeah, on fresh started docker I see similar number: ![image](https://user-images.githubusercontent.com/668524/124885914-6f6ac700-dfdc-11eb-96a6-e77b68cc2be7.png) I think it's how nginx works, it hog memory on startup but lover consumption after some time, because in screenshot I showed earlier here https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/367#issuecomment-875344103 - container run for weeks If this a problem for you you can use NGINX_WORKER_PROCESSES and NGINX_WORKER_CONNECTIONS, if you I think have less that 100 concurrent users (I may be wrong, but there is around 4 connection for user requred)
Author
Owner

@witchent commented on GitHub (Jul 8, 2021):

Okay thanks for confirming that the workaround is no problem (there's only two users on my instance).
For me, the memory never went down, but with the settings it is fine for me. Thanks for helping me out.

<!-- gh-comment-id:876742746 --> @witchent commented on GitHub (Jul 8, 2021): Okay thanks for confirming that the workaround is no problem (there's only two users on my instance). For me, the memory never went down, but with the settings it is fine for me. Thanks for helping me out.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-DocumentServer-ONLYOFFICE#186
No description provided.