느린 서버 응답 시간을 디버깅하는 방법은 무엇입니까?

느린 서버 응답 시간을 디버깅하는 방법은 무엇입니까?

설명된 방법을 사용하여여기time_appconnect서버 응답 시간을 측정해 보면 , time_pretransfer, 가 엄청나게 높은 것을 알 수 있는데 time_starttransfer, 이는 HTTPS를 통해 웹사이트에 접속할 때만 해당됩니다.

비교해 보면 Google 연결이 매우 빠릅니다.

curl -w "@curl-format.txt" -o /dev/null -s "https://www.google.com"

보고

time_namelookup:     0.014433
time_connect:        0.117187
time_appconnect:     0.374567
time_pretransfer:    0.374779
time_redirect:       0.000000
time_starttransfer:  0.513398
                     ----------
        time_total:  0.514880

HTTP를 통해 당사 웹사이트에 연결하는 속도도 상당히 빠릅니다.

curl -w "@curl-format.txt" -o /dev/null -s "http://environmentaldashboard.org"

보고

time_namelookup:    0.004136
time_connect:       0.044469
time_appconnect:    0.000000
time_pretransfer:   0.044554
time_redirect:      0.000000
time_starttransfer: 0.166275
                  ----------
      time_total:  0.166404

하지만 HTTPS를 통해 연결하는 것은매우느린:

curl -w "@curl-format.txt" -o /dev/null -s "https://environmentaldashboard.org"

보고

time_namelookup:    0.005211
time_connect:       0.057697
time_appconnect:    11.931837
time_pretransfer:   11.932075
time_redirect:      0.000000
time_starttransfer: 11.972374
                  ----------
     time_total:  12.009711

어떻게 이런 일이 일어날 수 있습니까? 내가 알 수 있는 한, 코드를 변경하지 않고도 문제가 시작되었습니다. 저는 상당히 새로운 시스템 관리자입니다. 이 문제를 디버깅하는 데 어떤 도구를 사용할 수 있습니까? 문제가 SSL과 관련된 것으로 보이는데 실제로는 인증 기관(GoDaddy)에 문제가 있을 가능성이 있습니까? 아니면 서버 구성이 잘못되었기 때문에 문제가 발생할 가능성이 더 높습니까?

이것이 관련이 있는지는 확실하지 않지만, 이것은 Environmentaldashboard.org에 대한 (약간 축약된) 아파치 가상 호스트 파일입니다:

<VirtualHost *:443>
    ServerName environmentaldashboard.org
    ServerAlias www.environmentaldashboard.org
    SSLEngine on
    SSLCertificateFile /etc/ssl/environmentaldashboard.org/environmentaldashboard.org.crt
    SSLCertificateKeyFile /etc/ssl/environmentaldashboard.org/environmentaldashboard.org.key
    SSLCACertificateFile /etc/ssl/environmentaldashboard.org/intermediate.crt
    ServerAdmin [email protected]
    DocumentRoot /var/www/environmentaldashboard.org/
    ErrorDocument 404 /404.php
    RewriteEngine On    
    <Directory /var/www/>
        RewriteCond %{REQUEST_FILENAME}.php -f
        RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerName environmentaldashboard.org
    ServerAlias www.environmentaldashboard.org
    Redirect permanent / https://environmentaldashboard.org/
</VirtualHost>

편집하다

grep -Ev '(rv_cron|15min|PHP Warning)' /var/log/apache2/error.log | tail -n10000

다음을 반환합니다.https://pastebin.com/qZ5e5e1n

그리고

journalctl -xef | grep -Ev '(rv_cron|15min|buildingosd)'

다음을 반환합니다.

https://pastebin.com/DbUGFTmn

top -d 30 | head -n50보고:

top - 19:02:38 up  8:35,  1 user,  load average: 1.71, 1.98, 2.08
Tasks: 281 total,   1 running, 280 sleeping,   0 stopped,   0 zombie
%Cpu(s): 27.9 us,  3.8 sy,  0.0 ni, 55.1 id,  6.5 wa,  0.0 hi,  1.6 si,  5.0 st
KiB Mem :  4046472 total,  1300152 free,  1373280 used,  1373040 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2336100 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                
 8736 www-data  20   0  386056  22976  12248 S  55.6  0.6   0:06.03 apache2                                                                                                                                
15772 root      20   0  256696  81752   7072 S  22.2  2.0   1:34.52 buildingosd                                                                                                                            
14534 root      20   0  279284 104372   7104 S  16.7  2.6   2:04.70 buildingosd                                                                                                                            
19708 root      20   0   40680   3736   3116 R  16.7  0.1   0:00.05 top                                                                                                                                    
 1340 mysql     20   0 1583808 395376  18808 S   5.6  9.8  87:05.74 mysqld                                                                                                                                 
23451 www-data  20   0  384072  20896  12156 S   5.6  0.5   0:18.71 apache2                                                                                                                                
    1 root      20   0   37760   5756   3956 S   0.0  0.1   0:10.64 systemd                                                                                                                                
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.02 kthreadd                                                                                                                               
    3 root      20   0       0      0      0 S   0.0  0.0   0:05.22 ksoftirqd/0                                                                                                                            
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                                                                                                                           
    7 root      20   0       0      0      0 S   0.0  0.0   3:30.70 rcu_sched                                                                                                                              
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh                                                                                                                                 
    9 root      rt   0       0      0      0 S   0.0  0.0   0:00.13 migration/0                                                                                                                            
   10 root      rt   0       0      0      0 S   0.0  0.0   0:00.76 watchdog/0                                                                                                                             
   11 root      rt   0       0      0      0 S   0.0  0.0   0:00.91 watchdog/1                                                                                                                             
   12 root      rt   0       0      0      0 S   0.0  0.0   0:00.14 migration/1                                                                                                                            
   13 root      20   0       0      0      0 S   0.0  0.0   1:13.13 ksoftirqd/1                                                                                                                            
   15 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/1:0H                                                                                                                           
   16 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kdevtmpfs                                                                                                                              
   17 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 netns                                                                                                                                  
   18 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 perf                                                                                                                                   
   19 root      20   0       0      0      0 S   0.0  0.0   0:00.10 khungtaskd                                                                                                                             
   20 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 writeback                                                                                                                              
   21 root      25   5       0      0      0 S   0.0  0.0   0:00.00 ksmd                                                                                                                                   
   22 root      39  19       0      0      0 S   0.0  0.0   0:05.73 khugepaged                                                                                                                             
   23 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 crypto                                                                                                                                 
   24 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kintegrityd                                                                                                                            
   25 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset                                                                                                                                 
   26 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kblockd                                                                                                                                
   27 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 ata_sff                                                                                                                                
   28 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 md                                                                                                                                     
   29 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 devfreq_wq                                                                                                                             
   34 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kswapd0                                                                                                                                
   35 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 vmstat                                                                                                                                 
   36 root      20   0       0      0      0 S   0.0  0.0   0:00.00 fsnotify_mark                                                                                                                          
   37 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ecryptfs-kthrea                                                                                                                        
   53 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kthrotld                                                                                                                               
   54 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 acpi_thermal_pm                                                                                                                        
   55 root      20   0       0      0      0 S   0.0  0.0   0:00.00 vballoon                                                                                                                               
   56 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset                                                                                                                                 
   57 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset                                                                                                                                 
   58 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset                                                                                                                                 
   59 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 bioset

top -d 30다음은 업데이트에 대한 몇 가지 붙여넣기입니다 .

  1. https://pastebin.com/8TNUg2xh
  2. https://pastebin.com/E0CS3bLH
  3. https://pastebin.com/T5J3UHJv
  4. https://pastebin.com/MUPSR7q5
  5. https://pastebin.com/RqTJLQE8

답변1

편집하다:

원시 openssl 연결은 연결하는 데 최대 5초가 걸리고 매우 빠르게 반환되기 때문에 이것이 인증서와 관련이 있다고 생각하지 않습니다.https://hastebin.com/ejipapehux.rb

$ openssl s_client -connect environmentaldashboard.org:443  -CAfile /etc/ssl/certs/ca-bundle.trust.crt   | ts -s "%.S"
depth=0 C = US, ST = Ohio, L = Oberlin, O = Environmental Dashboard, CN = 104.131.103.232
verify error:num=18:self signed certificate
verify return:1
depth=0 C = US, ST = Ohio, L = Oberlin, O = Environmental Dashboard, CN = 104.131.103.232
verify return:1
05.800695 CONNECTED(00000003)
05.800967 ---
05.801019 Certificate chain
05.801060  0 s:/C=US/ST=Ohio/L=Oberlin/O=Environmental Dashboard/CN=104.131.103.232

초기에 응답하는 데 5초 이상이 걸리므 Hello로 서버를 검사하고 무슨 일이 일어나고 있는지 확인하겠습니다.

여기에 이미지 설명을 입력하세요

머신에 대한 콘솔 액세스 권한이 있습니까?

관련 정보