Forum Discussion

BaltoStar_12467's avatar
Mar 07, 2015

BIG-IP : simplest way to ensure request is made on new tcp connection

F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi

 

When testing from client browser or shell ( curl ) , what is simplest way to ensure a request initiates a new tcp connection with the virtual-server ( is not sent on any pre-existing connection ) ?

 

I want to ensure my tests are on a fresh connection and irule stack processing starts fresh.

 

4 Replies

  • Hi Baltostar,

    make sure you turn off http KeepAlive on the server and do not use OneConnect (as it does KeepAlive conversion).

    Alternatively you can also tell cURL to use HTTP/1.0 (switch "-0") and add the "Connection: close" header:
    curl -0 -H "Connection: close"   
    

    Thanks, Stephan

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    If you're using curl, then each request will be a new connection anyway.

     

    From a browser, you can configure most browsers to not perform keep alives... or you could simply drop in a small iRule on the VS that does an HTTP::close at the end of the response.

     

    If you log the client IP and port and http::request_num via your Rule you can prove it in a log too.

     

    H

     

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Well... You can tell curl to keep connection open if you like. Or tell it to close...

     

    But since you're only requesting 1 URL, and the curl process starts, gets the content and exits, the connection closes anyway...

     

    H

     

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    In order to talk to the big, curl opens a socket, binds it to a local tcp port and IP, and makes a connection to the bigIP.

     

    Before curl exits, it closes its end of the connection, which then causes the other end of the TCP connection to close also as part of the FIN/FIN-ACK/ACK sequence). If curl doesn't close the connection before it exits (i.e. it dies for some reason, core dump, killed, etc), then the OS cleans up everything that the application opened or allocated (There's exceptions, but the important thing is that sockets aren't one of them. The OS (And it's a bit dependent on OS) does this by either sending a RST, or running through the FIN sequence itself to the BigIP. That causes the BigIP to close the client connection.

     

    Now as for the server side connection, that depends on whether one-connect it enabled or not. If you don't have one-connect enabled, then the server side connection will also be closed. if you have one-connect enabled on the OS, then it's likely the server side connection will stay open... But you can affect that with an iRule as well... Short answer there is don't put one-connect on the VS of course...

     

    H