Forum Discussion

Landono's avatar
Landono
Icon for Nimbostratus rankNimbostratus
Sep 30, 2013

How to extend network timeout for specific PHP call

I'm new to F5, so please excuse me if this is a very basic question.

 

We're currently transitioning from Nginx to Big-IP LTMs (2000 and 4000 series). Currently in Nginx we have our keep alive timeout set to 5 minutes. We realize this is high, so we'd like to set it down to 2 minutes. First off, is there a specific setting for this? We'd also like to create an exception for a single php call, let's call it longCall.php, so that the keep alive timeout is 5 minutes just for that call. We'd also like to set it so that there are no retries on this particular call. What would be a good way to do that with iRules?

 

Thank you for your help, and I can give further clarification if needed.

 

5 Replies

  • I'm not sure to be honest. In Nginx it's referred to as the keep alive timeout. However, after further research, this seems to translate to the idle tcp timeout, as that seems to be at 300 seconds.

     

  • Landono, whilst the TCP idle timeout can play a part if it's shorter than the HTTP keepalive idle timeout, there isn't a direct relationship between it and the HTTP keepalive. If you drop the TCP keepalive to 2m and increase the HTTP keepalive to 5m, the lower of the two figures will apply.

     

    You'll need to keep the TCP timeout to 5m/300s if you will use a 5m HTTP keepalive anywhere. I don't think the TCP value can be changed in an iRule unfortunately.

     

    As the HTTP keepalive timeout is not negotiated between client and server, there's nothing an iRule can do to change this for a specific URL, this is something you need to configure on nginx. I'm only familiar with Apache but with that, you could globally increase the PHP specific timeout value.

     

  • I believe you should be able to use the IP::idle_timeout command:

    https://devcentral.f5.com/articles/investigating-the-ltm-tcp-profile-max-syn-retransmissions-amp-idle-timeout.UkqwLT-K7wQ

    https://devcentral.f5.com/wiki/iRules.IP__idle_timeout.ashx

    So something like this:

    when HTTP_REQUEST {
        if { [string tolower [HTTP::uri]] starts_with "/longcall.php" } {
            IP::idle_timeout 300
            set update_server_idle 1
        }
    }
    when SERVER_CONNECTED {
        if { [info exists update_server_idle] } {
            IP::idle_timeout 300
        }
    }
    
  • For web servers, we actually use Apache. We used Nginx just as loadbalancers, to front the traffic to the Apache webservers. There currently isn't any configuration on the webservers about keep alives, this has always been handled by the load balancers. Thank you Kevin for the script, I'll try that out and let you know how it goes.