Forked from shinebayar-g/Fix redis server startup warnings, redis tuning performance on Ubuntu 16.04.md
Created
August 2, 2019 11:09
-
-
Save jamesbjackson/b9800f25bb0aa7244ba7ad403d178f1c to your computer and use it in GitHub Desktop.
Revisions
-
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -93,4 +93,4 @@ This require you to **reboot**, backup your data or do anything you need before Now check you redis log again, you should have a redis server without any errors or warnings.  -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -93,6 +93,4 @@ This require you to **reboot**, backup your data or do anything you need before Now check you redis log again, you should have a redis server without any errors or warnings.  -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -91,4 +91,8 @@ This require you to **reboot**, backup your data or do anything you need before `sudo reboot` Now check you redis log again, you should have a redis server without any errors or warnings. [](https://gist.github.com/shinebayar-g/3145e0c6ace8aabb70cf756924c6463a)  -
shinebayar-g renamed this gist
Jun 29, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,6 +75,8 @@ Now for these configs to work, you need to reload the config WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. ``` *Solution:* To permanently solve this, follow the log's suggestion, and modify rc.local `sudo vi /etc/rc.local` -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,9 @@ and you will see Max open files 65536 65536 files Max locked memory 65536 65536 bytes ``` *** - **Socket Maximum Connection** ```Shell @@ -65,6 +67,8 @@ Now for these configs to work, you need to reload the config `sudo sysctl -p` *** - **Transparent Huge Pages** ```Shell -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 24 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -62,4 +62,27 @@ net.core.somaxconn=1024 ``` Now for these configs to work, you need to reload the config `sudo sysctl -p` - **Transparent Huge Pages** ```Shell WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. ``` To permanently solve this, follow the log's suggestion, and modify rc.local `sudo vi /etc/rc.local` ```Shell if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi ``` This require you to **reboot**, backup your data or do anything you need before you actually do it!! `sudo reboot` Now check you redis log again, you should have a redis server without any errors or warnings. -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,17 +32,18 @@ To check if it works, try to cat proc limits `cat /proc/PID/limits` and you will see ``` Max open files 65536 65536 files Max locked memory 65536 65536 bytes ``` - **Socket Maximum Connection** ```Shell WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. ``` - **Memory Overcommit** ```Shell WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,13 +24,17 @@ LimitNOFILE=65536 Then you must daemon reload and restart the service `sudo systemctl daemon-reload` `sudo systemctl restart redis.service` To check if it works, try to cat proc limits `cat /proc/PID/limits` and you will see `Max open files 65536 65536 files` `Max locked memory 65536 65536 bytes` **Socket Maximum Connection** @@ -55,5 +59,6 @@ Since these two are related, we will solve it at once. vm.overcommit_memory = 1 net.core.somaxconn=1024 ``` Now for these configs to work, you need to reload the config `sudo sysctl -p` -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ - **Maximum Open Files** ```Shell -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,19 +32,19 @@ and you will see `Max open files 65536 65536 files Max locked memory 65536 65536 bytes` **Socket Maximum Connection** ```Shell WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. ``` **Memory Overcommit** ```Shell WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. ``` *Solution:* Since these two are related, we will solve it at once. @@ -55,6 +55,5 @@ Since these two are related, we will solve it at once. vm.overcommit_memory = 1 net.core.somaxconn=1024 ``` Now for these configs to work, you need to reload the config `sudo sysctl -p` -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ **Maximum Open Files** ```Shell @@ -8,7 +8,7 @@ Server can't set maximum open files to 10032 because of OS error: Operation not Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. ``` *Solution:* Edit systemd service file `sudo vim /etc/systemd/system/redis.service` -
shinebayar-g renamed this gist
Jun 29, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ **Maximum Open Files ```Shell You requested maxclients of 10000 requiring at least 10032 max file descriptors. Server can't set maximum open files to 10032 because of OS error: Operation not permitted. -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ **Maximum Open Files ```Shell -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 44 additions and 44 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,58 +1,58 @@ **Maximum Open Files ```Shell You requested maxclients of 10000 requiring at least 10032 max file descriptors. Server can't set maximum open files to 10032 because of OS error: Operation not permitted. Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. ``` *Solution: Edit systemd service file `sudo vim /etc/systemd/system/redis.service` ``` [Service] ... User=redis Group=redis # should be fine as long as you add it under [Service] block LimitNOFILE=65536 ``` Then you must daemon reload and restart the service `sudo systemctl daemon-reload` `sudo systemctl restart redis.service` To check if it works, try to cat proc limits `cat /proc/PID/limits` and you will see `Max open files 65536 65536 files Max locked memory 65536 65536 bytes` **Socket Maximum Connection ```Shell WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. ``` **Memory Overcommit ```Shell WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. ``` **Solution: Since these two are related, we will solve it at once. `sudo vim /etc/sysctl.conf` ```Shell # Add at the bottom of file vm.overcommit_memory = 1 net.core.somaxconn=1024 ``` -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 40 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ - **Maximum Open Files ```Shell You requested maxclients of 10000 requiring at least 10032 max file descriptors. @@ -7,19 +7,52 @@ ``` **Solution: Edit systemd service file `sudo vim /etc/systemd/system/redis.service` ``` [Service] ... User=redis Group=redis # should be fine as long as you add it under [Service] block LimitNOFILE=65536 ``` Then you must daemon reload and restart the service `sudo systemctl daemon-reload` `sudo systemctl restart redis.service` To check if it works, try to cat proc limits `cat /proc/PID/limits` and you will see `Max open files 65536 65536 files Max locked memory 65536 65536 bytes` - **Socket Maximum Connection ```Shell WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. ``` **Memory Overcommit ```Shell WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. ``` **Solution: Since these two are related, we will solve it at once. `sudo vim /etc/sysctl.conf` ``` # Add at the bottom of file vm.overcommit_memory = 1 net.core.somaxconn=1024 ``` -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 21 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,25 @@ - Warning #1 ```Shell You requested maxclients of 10000 requiring at least 10032 max file descriptors. Server can't set maximum open files to 10032 because of OS error: Operation not permitted. Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. ``` **Solution: `sudo vim /etc/systemd/system/redis.service` ``` [Service] ... User=redis Group=redis #*should be fine as long as you add it under [Service] block LimitNOFILE=65536 ``` sudo systemctl daemon-reload sudo systemctl restart redis.service Then you must daemon reload and restart the service -
shinebayar-g revised this gist
Jun 29, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,14 +6,14 @@ Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. ``` **Solution: sudo vim /etc/systemd/system/redis.service [Service] ... User=redis Group=redis #*should be fine as long as you add it under [Service] block LimitNOFILE=65536 sudo systemctl daemon-reload -
shinebayar-g renamed this gist
Jun 29, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shinebayar-g created this gist
Jun 29, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ - Warning #1 ```Shell You requested maxclients of 10000 requiring at least 10032 max file descriptors. Server can't set maximum open files to 10032 because of OS error: Operation not permitted. Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'. ``` *Solution:* sudo vim /etc/systemd/system/redis.service [Service] ... User=redis Group=redis # should be fine as long as you add it under [Service] block LimitNOFILE=65536 sudo systemctl daemon-reload sudo systemctl restart redis.service Then you must daemon reload and restart the service