Forum Discussion

Micha__Iwaszko_'s avatar
Icon for Nimbostratus rankNimbostratus
Aug 24, 2011

pycontrol.pycontrol.BIGIP() timeout/keepalive?

Where I can find, what's my BIGIP() keepalive or timeout value? I'm asking because I don't know (while looping some with time.wait()) if I am to run BIGIP() every loop cycle or just once at a start.


4 Replies

  • timeout/keepalive for what? There are many sprinkled through the configuration. For example, for tcp traffic, the idle timeout is defined in the LocalLB.ProfileTCP interface in the get_idle_timeout method:

    >>> b.LocalLB.ProfileTCP.get_idle_timeout(profile_names = ['tcp'])
       value = 300
       default_flag = False
  • I meant the timeout for the connection from the iControl client (pyControl script in my case) to the BIG-IPs https port - like, is there any (tomcat based? SO_KEEPALIVE?, not an LTM profile configuration value or anything) http keepalive for this connection initiated by BIGIP() function? As I've mentioned earlier, let's look at a simple example of a while loop:



    b = pycontrol.pycontrol.BIGIP(credentials, wsdls...)


    While True:







    If there is some http connection reuse (keepalive of some sort), the BIGIP() can be outside the loop, but if the there's in no keepalive or the timeout value is lower than the time.sleep() interval, one should put BIGIP() inside the loop.


    The question is, is there any (keepalive/timeout etc)?
  • IIRC there's no keep-alive - each socket is independent of the next, which is consistent with RPC style calls. But note that you don't need to create another object inside the loop. Since each socket is independent, a new one will be used on subsequent calls.



    Now all that said, the transport for Suds is based on urllib2 and you can override this and build in keep-alives if you're really interested in doing so. In pycontrol2 all of the suds client specifics are exposed and you can call set_options() against it for various (read: all) of the suds client options. Have a look at the suds attribute (b.LocalLB.Foo.suds) to see what I mean.



    Here's a post that implements a custom transport class that will allow you to do this. Personally, I've not come across a real need though...