Welcome to Centmin Mod Community
Become a Member

Insight Guide Troubleshoot Slow SSH Logins

Discussion in 'Centmin Mod Insights' started by eva2000, Jun 29, 2017.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,672
    Local Time:
    12:33 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Centmin Mod on initial login has a few checks it does for the following
    • yum update checks
    • nginx version checks
    If you have slow SSH logins, it could be related to one of these checks. So to troubleshoot you can post a new thread in System Admin forums with info asked below:
    1. Who's the web host ?
    2. Which plan ?
    3. location of VPS ?
    4. Was it fast when you did initial install or was it always slow ?
    what is output for these commands
    Code (Text):
    yum clean all
    time yum repolist all
    

    Code (Text):
    time yum -v -d 9 list updates
    

    Code (Text):
    time yum -v -d 9 list updates --disableplugin=fastestmirror
    

    Code (Text):
    cat /root/centminlogs/yum-timedhosts.txt
    

    Code (Text):
    sort -k2 /var/cache/yum/x86_64/7/timedhosts.txt
    

    Code (Text):
    cat /etc/resolv.conf
    

    Code (Text):
    tail -1 $(ls -rt /root/centminlogs/cmm-login-git-checks* | tail -1)
    

    Code (Text):
    find /root/centminlogs/ -type f -name "cmm-login-git-checks_*.log" -exec tail -1 {} \;  | tail -10
    

    Code (Text):
    curl -Iv https://nginx.org/en/download.html
    

    For posting code you might want to use CODE tags for code How to use forum BBCODE code tags :)

    On a few of my slower login servers with 123.09beta01, I am seeing it hang around nginx version check

    process listing output command
    Code (Text):
    ps aufxw
    

    shows at hang time
    Code (Text):
    root     22322  0.0  0.0   9516  1728 pts/1    S+   17:07   0:00              |   \_ /bin/bash /usr/local/bin/dmotd
    root     22323  0.0  0.1 152536  4504 pts/1    S+   17:07   0:00              |       \_ curl -sL https://nginx.org/en/download.html
    root     22324  0.0  0.0   9096   892 pts/1    S+   17:07   0:00              |       \_ grep -E -o nginx\-[0-9.]+\.tar[.a-z]*
    root     22325  0.0  0.0   9876   964 pts/1    S+   17:07   0:00              |       \_ awk -F nginx- /.tar.gz$/ {print $2}
    root     22326  0.0  0.0  13324  1592 pts/1    S+   17:07   0:00              |       \_ sed -e s|.tar.gz||g
    root     22327  0.0  0.0   4324   644 pts/1    S+   17:07   0:00              |       \_ head -n 1
    root     22319  0.0  0.0   4316   704 pts/1    S+   17:07   0:00              \_ tee /root/centminlogs/cmm-login-git-checks_280617-170709.log
    

    so will check that too for me it was IPv6 networking related which I should of disabled but it was enabled
    Code (Text):
    curl -Iv https://nginx.org/en/download.html
    * About to connect() to nginx.org port 443 (#0)
    *   Trying 2606:7100:1:69::3f...
    * Connection timed out
    *   Trying 2001:1af8:4060:a004:21::e3...
    * Connection timed out
    *   Trying 206.251.255.63...
    * Connected to nginx.org (206.251.255.63) port 443 (#0)
    

    to disable IPv6 add to the bottom of /etc/sysctl.conf these 2 lines
    Code (Text):
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    

    then update via
    Code (Text):
    sysctl -p
    

    also set in persistent config file /etc/centminmod/custom_config.inc the variable
    Code (Text):
    DISABLE_IPVSIX='y'
    

    recheck and fast now connecting via IPv4 ip for nginx.org
    Code (Text):
     curl -Iv https://nginx.org/en/download.html
    * About to connect() to nginx.org port 443 (#0)
    *   Trying 95.211.80.227...
    * Connected to nginx.org (95.211.80.227) port 443 (#0)
    

    I tried re-enabling IPv6 removing the 2 added /etc/sysctl.conf and rebooted my server to see if it was network related and that fixed it for IPv6 connection to nginx.org and allowed fast ssh login to Centmin Mod 123.09beta01 based server as for me it was related to IPv6 issues
    Code (Text):
    curl -Iv https://nginx.org/en/download.html
    * About to connect() to nginx.org port 443 (#0)
    *   Trying 2606:7100:1:69::3f...
    * Connected to nginx.org (2606:7100:1:69::3f) port 443 (#0)
    


     
    Last edited: Jun 29, 2017
  2. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,672
    Local Time:
    12:33 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Another reason for slow SSH logins is due to the login Centmin Mod Git repo update check to alert you to updates available for Centmin Mod code at /usr/local/src/centminmod. SSH logins will be slower if there are actually Git updates available. You can thus speed up SSH logins if you setup Centmin Mod code at /usr/local/src/centminmod to auto update via cronjob outlined at https://community.centminmod.com/threads/cronjob-auto-updating-centmin-mod-code-guide.3398/. If cronjob auto updates the code, SSH login check for updates will go faster as there is no updates to check for.

    Example cmupdate cronjob
    Code (Text):
    41 3 * * * /usr/bin/cmupdate >/dev/null 2>&1


    An example of how having Centmin Mod Github updates available will slow SSH login due to Centmin Mod code update check

    SSH login shows Centmin Mod cod updates are available
    Code (Text):
    ===============================================================================
     Centmin Mod code updates available for /usr/local/src/centminmod
     to update, run cmupdate command in SSH & re-run centmin.sh once & exit
    ===============================================================================
    

    Checking the Git/Nginx check time for this SSH login shows 33.0569 seconds.
    Code (Text):
    find /root/centminlogs/ -type f -name "cmm-login-git-checks_*.log" -exec tail -1 {} \;
    Total Git & Nginx Check Time: 17.064325247 seconds
    Total Git & Nginx Check Time: 18.788097993 seconds
    Total Git & Nginx Check Time: 1.928730724 seconds
    Total Git & Nginx Check Time: 16.911994785 seconds
    Total Git & Nginx Check Time: 24.150637742 seconds
    Total Git & Nginx Check Time: 26.023300208 seconds
    Total Git & Nginx Check Time: 33.056937890 seconds
    

    Now if you run cmupdate to update Centmin Mod code
    Code (Text):
    cmupdate
    No local changes to save
    Updating da5daa1..11242b2
    Fast-forward
     addons/ffmpeg.sh          | 32 ++++++++++++++++++++++++++++----
     centmin-cli.sh            |  6 +++---
     centmin.sh                |  6 +++---
     example/custom_config.inc |  4 ++--
     inc/nginx_configure.inc   | 35 ++++++++++++++++++++---------------
     inc/openssl_install.inc   |  2 +-
     inc/php_configure.inc     | 10 ++++++++--
     inc/php_upgrade.inc       |  7 +++++++
     inc/phpsededit.inc        |  2 +-
     9 files changed, 73 insertions(+), 31 deletions(-)
    

    Relogin via SSH, check Git check time is now 1.6944s instead.
    Code (Text):
    find /root/centminlogs/ -type f -name "cmm-login-git-checks_*.log" -exec tail -1 {} \;
    Total Git & Nginx Check Time: 17.064325247 seconds
    Total Git & Nginx Check Time: 18.788097993 seconds
    Total Git & Nginx Check Time: 1.928730724 seconds
    Total Git & Nginx Check Time: 16.911994785 seconds
    Total Git & Nginx Check Time: 24.150637742 seconds
    Total Git & Nginx Check Time: 26.023300208 seconds
    Total Git & Nginx Check Time: 33.056937890 seconds
    Total Git & Nginx Check Time: 1.694455829 seconds
    
     
Thread Status:
Not open for further replies.