【问题标题】:First REST call slow on Apache serverApache 服务器上的第一个 REST 调用很慢
【发布时间】:2018-05-22 21:37:18
【问题描述】:

我在某些请求中遇到了这个问题。用户的所有第一次调用(或经过一段时间后)最多需要 60 秒才能完成。之后需要几毫秒。不管我是在 Internet 浏览器上还是使用 SOAP UI 调用它,它总是一样的。我在 Apache 上运行一个 java 应用程序。 我用 fiddler 运行它以查看调用花费最多时间的位置,看起来它介于服务器收到请求和开始应答之间,每次需要 61 秒。 Fiddler 还显示 SSL 握手在这两种情况下都需要毫秒

我不知道还能去哪里看。如果有人能提供一些启示,将不胜感激。

第一个请求(需要 1:01 分钟)

Request Count:   1
Bytes Sent:      683        (headers:683; body:0)
Bytes Received:  846        (headers:347; body:499)

ACTUAL PERFORMANCE
--------------

This traffic was captured on Friday, May 18, 2018.

ClientConnected:    16:21:17.244
ClientBeginRequest: 16:21:17.465
GotRequestHeaders:  16:21:17.465
ClientDoneRequest:  16:21:17.465
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect: 0ms
HTTPS Handshake:    0ms
ServerConnected:    16:21:17.275
FiddlerBeginRequest:    16:21:17.466
ServerGotRequest:   16:21:17.466
ServerBeginResponse:    16:22:18.597
GotResponseHeaders: 16:22:18.597
ServerDoneResponse: 16:22:18.599
ClientBeginResponse:    16:22:18.599
ClientDoneResponse: 16:22:18.599

    Overall Elapsed:    0:01:01.133

RESPONSE BYTES (by Content-Type)
--------------
application/json: 499
       ~headers~: 347

后续请求(耗时 0.120 分钟)

Request Count:   1
Bytes Sent:      683        (headers:683; body:0)
Bytes Received:  846        (headers:347; body:499)

ACTUAL PERFORMANCE
--------------

This traffic was captured on Friday, May 18, 2018.

ClientConnected:    16:22:38.582
ClientBeginRequest: 16:22:38.607
GotRequestHeaders:  16:22:38.607
ClientDoneRequest:  16:22:38.607
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect: 0ms
HTTPS Handshake:    0ms
ServerConnected:    16:22:38.589
FiddlerBeginRequest:    16:22:38.607
ServerGotRequest:   16:22:38.607
ServerBeginResponse:    16:22:38.726
GotResponseHeaders: 16:22:38.726
ServerDoneResponse: 16:22:38.727
ClientBeginResponse:    16:22:38.727
ClientDoneResponse: 16:22:38.727

    Overall Elapsed:    0:00:00.120

RESPONSE BYTES (by Content-Type)
--------------
application/json: 499
       ~headers~: 347

这是使用浏览器进行的另一个第一次调用的外观 Chrome Network Analysis

谢谢!!

【问题讨论】:

标签: java apache rest web-services


【解决方案1】:

所以,我终于有了这篇关于 LDAP 的帖子 -> Debugging a timeout with ldap auth on apache

这恰好是我的情况。 将LDAPConnectionPoolTTL 0 添加到我的 httpd.config 解决了我的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 2017-07-24
    • 2020-11-11
    • 1970-01-01
    相关资源
    最近更新 更多