试图理解为什么codeigniter应用程序上的curl调用很慢

试图理解为什么codeigniter应用程序上的curl调用很慢,codeigniter,ubuntu,curl,tcp,wireshark,Codeigniter,Ubuntu,Curl,Tcp,Wireshark,前面的说明:我是一名Windows开发人员,请容忍我,因为这似乎是一个Linux问题 我们在PHP应用程序(我相信是用codeigniter构建的)方面遇到了一些问题。该应用程序托管在Ubuntun 16.04服务器(Apache)上,我认为它使用的是PHP7.4 问题:返回浏览器显示的html的控制器调用了两个web服务(托管在同一网络上的服务器上),这些调用速度很慢(每个调用都需要超过1秒的时间完成) 我们注意到了这一点,因为我们在两台服务器上都安装并启用了XDebug。对于我们的测试场景(

前面的说明:我是一名Windows开发人员,请容忍我,因为这似乎是一个Linux问题

我们在PHP应用程序(我相信是用codeigniter构建的)方面遇到了一些问题。该应用程序托管在Ubuntun 16.04服务器(Apache)上,我认为它使用的是PHP7.4

问题:返回浏览器显示的html的控制器调用了两个web服务(托管在同一网络上的服务器上),这些调用速度很慢(每个调用都需要超过1秒的时间完成)

我们注意到了这一点,因为我们在两台服务器上都安装并启用了XDebug。对于我们的测试场景(需要加载2或3页),我们最终得到以下结果:

  • 主门户日志文件显示,curl_exec大约需要32秒来执行大约25个调用
  • 服务日志文件显示它只运行了大约2秒钟(用于加载和返回curl调用使用的数据)
  • 由于看起来网络堆栈出现了一些问题,我们已经激活了wireshark,而且每个web服务调用似乎都需要一秒钟以上的时间才能完成(因此,它似乎确认了指向通信问题的xdebug日志)。例如,下面是其中一个呼叫的屏幕截图:

    第一个应用程序数据的确认时间似乎超过1秒(RTT时间超过1秒)。以下ack不会发生这种情况(例如,122条目是121的ack,在这种情况下rtt约为0.0002秒)。顺便说一句,这里显示了1秒后确认的应用程序数据条目的信息:

    Frame 116: 470 bytes on wire (3760 bits), 470 bytes captured (3760 bits)
        Encapsulation type: Ethernet (1)
        Arrival Time: Jul  7, 2020 15:46:23.036999000 GMT Daylight Time
        [Time shift for this packet: 0.000000000 seconds]
        Epoch Time: 1594133183.036999000 seconds
        [Time delta from previous captured frame: 0.000405000 seconds]
        [Time delta from previous displayed frame: 0.000405000 seconds]
        [Time since reference or first frame: 3.854565000 seconds]
        Frame Number: 116
        Frame Length: 470 bytes (3760 bits)
        Capture Length: 470 bytes (3760 bits)
        [Frame is marked: False]
        [Frame is ignored: False]
        [Protocols in frame: eth:ethertype:ip:tcp:tls]
        [Coloring Rule Name: TCP]
        [Coloring Rule String: tcp]
    Ethernet II, Src: Microsof_15:5a:5e (00:15:5d:15:5a:5e), Dst: Fortinet_09:03:22 (00:09:0f:09:03:22)
        Destination: Fortinet_09:03:22 (00:09:0f:09:03:22)
            Address: Fortinet_09:03:22 (00:09:0f:09:03:22)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Source: Microsof_15:5a:5e (00:15:5d:15:5a:5e)
            Address: Microsof_15:5a:5e (00:15:5d:15:5a:5e)
            .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
            .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        Type: IPv4 (0x0800)
    Internet Protocol Version 4, Src: 10.50.100.28, Dst: 10.50.110.100
        0100 .... = Version: 4
        .... 0101 = Header Length: 20 bytes (5)
        Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
            0000 00.. = Differentiated Services Codepoint: Default (0)
            .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
        Total Length: 456
        Identification: 0x459c (17820)
        Flags: 0x4000, Don't fragment
            0... .... .... .... = Reserved bit: Not set
            .1.. .... .... .... = Don't fragment: Set
            ..0. .... .... .... = More fragments: Not set
            ...0 0000 0000 0000 = Fragment offset: 0
        Time to live: 64
        Protocol: TCP (6)
        Header checksum: 0x0cb0 [validation disabled]
        [Header checksum status: Unverified]
        Source: 10.50.100.28
        Destination: 10.50.110.100
    Transmission Control Protocol, Src Port: 34588, Dst Port: 443, Seq: 644, Ack: 5359, Len: 404
        Source Port: 34588
        Destination Port: 443
        [Stream index: 5]
        [TCP Segment Len: 404]
        Sequence number: 644    (relative sequence number)
        [Next sequence number: 1048    (relative sequence number)]
        Acknowledgment number: 5359    (relative ack number)
        1000 .... = Header Length: 32 bytes (8)
        Flags: 0x018 (PSH, ACK)
            000. .... .... = Reserved: Not set
            ...0 .... .... = Nonce: Not set
            .... 0... .... = Congestion Window Reduced (CWR): Not set
            .... .0.. .... = ECN-Echo: Not set
            .... ..0. .... = Urgent: Not set
            .... ...1 .... = Acknowledgment: Set
            .... .... 1... = Push: Set
            .... .... .0.. = Reset: Not set
            .... .... ..0. = Syn: Not set
            .... .... ...0 = Fin: Not set
            [TCP Flags: ·······AP···]
        Window size value: 319
        [Calculated window size: 40832]
        [Window size scaling factor: 128]
        Checksum: 0x8850 [unverified]
        [Checksum Status: Unverified]
        Urgent pointer: 0
        Options: (12 bytes), No-Operation (NOP), No-Operation (NOP), Timestamps
            TCP Option - No-Operation (NOP)
                Kind: No-Operation (1)
            TCP Option - No-Operation (NOP)
                Kind: No-Operation (1)
            TCP Option - Timestamps: TSval 1446266633, TSecr 1807771224
                Kind: Time Stamp Option (8)
                Length: 10
                Timestamp value: 1446266633
                Timestamp echo reply: 1807771224
        [SEQ/ACK analysis]
            [This is an ACK to the segment in frame: 115]
            [The RTT to ACK the segment was: 0.000405000 seconds]
            [iRTT: 0.000474000 seconds]
            [Bytes in flight: 404]
            [Bytes sent since last PSH flag: 404]
        [Timestamps]
            [Time since first frame in this TCP stream: 0.010560000 seconds]
            [Time since previous frame in this TCP stream: 0.000405000 seconds]
        TCP payload (404 bytes)
    Transport Layer Security
        TLSv1.2 Record Layer: Application Data Protocol: http-over-tls
            Content Type: Application Data (23)
            Version: TLS 1.2 (0x0303)
            Length: 399
            Encrypted Application Data: 6611c266b7d32e17367b99607d0a0607f61149d15bcb135d…
    
    有什么建议吗

    谢谢