Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING: /proc/sys/net/core/somaxconn is set to the lower value of 128. #35

Closed
sebicas opened this issue Oct 27, 2015 · 25 comments

Comments

Projects
None yet
@sebicas
Copy link

commented Oct 27, 2015

How can I get rid of this warning?

WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

I am using:

docker-machine version 0.4.1 (e2c88d6)
Boot2Docker version 1.8.2, build master : aba6192 - Thu Sep 10 20:58:17 UTC 2015
Docker version 1.8.2, build 0a8c2e3
@Rooie

This comment has been minimized.

Copy link

commented Nov 30, 2015

Hi,

Came across this today while searching for a solution as I have the same issue. I found a possible solution to this.

From: https://www.en0ch.se/performance-tips-for-redis-cache-server/

To fix this warning you have to set a new config to /etc/rc.local so that the setting will persist upon reboot

$~: sudo nano /etc/rc.local
Add this:

sysctl -w net.core.somaxconn=65535
When you reboot the next time, the new setting will be to allow 65535 connections instead of 128 as before.

Hope this will fix it for you.

Best regards,

Richard

@yosifkit

This comment has been minimized.

Copy link
Member

commented Nov 30, 2015

Yeah that should work (depending on the init system of the docker host); this looks like a host configuration and I do not believe it can be set within a single container.

@tianon

This comment has been minimized.

Copy link
Member

commented Nov 30, 2015

moby/moby#4717 is the upstream Docker issue to keep track 👍

@enoch85

This comment has been minimized.

Copy link

commented Dec 1, 2015

@Rooie, thanks for the link :)

@Rooie

This comment has been minimized.

Copy link

commented Dec 4, 2015

@enoch85 You're welcome! Glad to help :)

@enoch85

This comment has been minimized.

Copy link

commented Dec 4, 2015

@Rooie It's my site, thank you for linking it ;)

@Rooie

This comment has been minimized.

Copy link

commented Dec 4, 2015

@enoch85 Ah, I see. Thank you, for all the useful guides! The one for installing Redis really helped me out :) I also left a comment on your website!

@narikatel

This comment has been minimized.

Copy link

commented Mar 2, 2016

@Rooie thanks for the link :)

@enoch85

This comment has been minimized.

Copy link

commented Mar 2, 2016

@Rooie Can you please update from en0ch.se to techandme.se? I changed the domain. Thank you.

@pataquets

This comment has been minimized.

Copy link

commented Apr 13, 2016

moby/moby#19265 just merged. Can this solve the issue?

@tianon

This comment has been minimized.

Copy link
Member

commented Apr 13, 2016

Very cool -- that won't make it into 1.11 (being released today), but we could document for users of 1.12+ how they can use --sysctl on their docker run invocations in order to accomplish this. 👍

@vingrad

This comment has been minimized.

Copy link

commented Jun 9, 2016

How can I use sysctl option with a compose file?

@billmccord

This comment has been minimized.

Copy link

commented Oct 11, 2016

@titpetric

This comment has been minimized.

Copy link

commented Feb 26, 2017

Unless I'm mistaken, there's currently no way to specify this with docker service create, so swarm mode is out of the question here? Even if somaxconn is larger on the host, it's not transferred to the running container(s). Any ideas?

@yosifkit

This comment has been minimized.

Copy link
Member

commented Feb 27, 2017

@titpetric there is an issue tracking service create parity with run: moby/moby#25303 and it links to moby/moby#25209 for --syscall support (which you already commented on). Without --cap-add there is no other workaround (other than patching and building your own kernel: ./include/linux/socket.h:#define SOMAXCONN 128).

@titpetric

This comment has been minimized.

Copy link

commented Feb 28, 2017

@yosifkit Thanks, suggestion about recompiling the kernel noted. As far as work-arounds go, it's not bad - even if I usually cringe at "recompile your kernel" advice :) thanks.

@Gurpartap

This comment has been minimized.

Copy link

commented Sep 24, 2017

Before:

oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
...
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
...

I used the --sysctl flag in docker:

$ /usr/bin/docker run --name redis \
                      --rm \
                      --sysctl net.core.somaxconn=511 \
                      --publish 127.0.0.1:6379:6379 \
                      redis:4.0-alpine

After:

# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
# Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=1, just started
# Configuration loaded
* Running mode=standalone, port=6379.
# Server initialized
* DB loaded from disk: 0.000 seconds
* Ready to accept connections

No warning. Success.

@tianon

This comment has been minimized.

Copy link
Member

commented Sep 26, 2017

👍 thanks for confirming, @Gurpartap!

@tianon tianon closed this Sep 26, 2017

@askoretskiy

This comment has been minimized.

Copy link

commented Oct 27, 2017

Alternatively, you could force Redis to use TCP backlog for 128 entries:

docker run redis:4-alpine redis-server --tcp-backlog 128
@JohnDavidLarsen

This comment has been minimized.

Copy link

commented Jan 26, 2018

Additionally in your docker-compose.yml you can provide options

sysctls:
  net.core.somaxconn: '511'

https://docs.docker.com/compose/compose-file/#sysctls

//Some versions seem to need the single quotes, other versions don't, your results may vary.

@jmarcos-cano

This comment has been minimized.

Copy link

commented Jan 31, 2018

If somebody is struggling with this in swarm mode (swarm does not support it yet) go check my comment here

@farwish

This comment has been minimized.

Copy link

commented Jul 6, 2018

Anyone knows how to fix error below ?

Error Message:

ubuntu@VM-0-10-ubuntu:~/dk$ docker-compose up redis
Starting redis-con ... error

ERROR: for redis-con  Cannot start service redis: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"open /proc/sys/net/core/somaxcomm: no such file or directory\"": unknown

ERROR: for redis  Cannot start service redis: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"open /proc/sys/net/core/somaxcomm: no such file or directory\"": unknown
ERROR: Encountered errors while bringing up the project.

docker-compose.yml:

version: '3'
services:
  redis:
    image: redis:3.2.12
    container_name: redis-con
    privileged: true
    sysctls:
      net.core.somaxcomm: '511'
@jxltom

This comment has been minimized.

Copy link

commented Jul 6, 2018

@farwish It is net.core.somaxconn, not net.core.somaxcomm

@tianon

This comment was marked as off-topic.

Copy link
Member

commented Apr 11, 2019

@docker-library docker-library locked as resolved and limited conversation to collaborators Apr 11, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.