Apache 2服务器延迟5秒

I have a problem, that I can not solve. Some of the communication (~10-20%) between the frontend and the backend server has stuck. Can anyone give me an advice?

Frontend PHP --------- curl --------> Backend PHP

  • The frontend sends the request and it is arriving immediately to the Apache
  • In the backend log there is a 5 sec delay for the start of the operation
  • The backend log says that the operation was fast

Example:

  • frontend curl log:

    16:30:00.00 - Runtime: 5.2454 
    
  • backend apache access log:

    16:30:00.01 - /backend/.... 
    
  • backend log:

    16:30:05.01 - Runtime: 0.2254
    

The way that I am logging:

  • Frontend log:

    <?php
    ....
    startTime
    send curl request to Backend IP
    write to the log: currentTime, currentTime-startTime
    ...
    ?>
    
  • Backend log:

    <?php
    startTime
    PHP/MySQL/Redis/etc
    write to the log: currentTime, currentTime-startTime
    ?>
    

Server

  • Debian 6.0.3
  • Apache/2.2.16
  • PHP 5.3.3
  • MySQL Ver 14.14 Distrib 5.1.49
  • Redis server 2.4.2