Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    2

    Default Is it possible to use keep-alive http connection with XMLAPI?

    Hi all,

    I have tried to use keep-alive http header with XML-API:

    Client->Server:


    GET /xml-api/version HTTP/1.1
    Host: myhost.com:2086
    User-Agent: AutomationScript 1.0
    Authorization: WHM root:0123456789abcdefgh<access hash goes here>
    Keep-Alive: 300
    Connection: keep-alive


    Server->Client:

    HTTP/1.1 200 OK
    Server: cpsrvd/11.25
    Connection: close
    Transfer-Encoding: chunked
    Content-type: text/xml

    <version>
    <version>11.26.8</version>
    </version>

    As you can see cPanel server closes the connection (Connection:close).
    Is it possible to use keep-alive http connection with XMLAPI?

  2. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    Hi Pavel,

    If I recall correctly, the 'Connection' header is determined by cpsrvd. And from practice, it can vary slightly between functions or WHM/cPanel version. Most of the time though I see my responses come back 'Connection:close'.

    I'm not sure if this header is flexible in it's current implementation. What exactly is your issue? Maybe there's another solution? Or maybe there's something that is affecting the response that we can improve/investigate?

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    2

    Default

    Hi David,

    Thank you for you response! I am trying to speed up the client-server conversation. It takes about 0.3 sec to open a new connection.

  4. #4
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    It might be worth digging around in the Feature Request forum for a thread I recall. Someone requested that the XML-API could receive multiple API queries/actions within one request session. i.e., a call stack or job queue. The implementation of such a feature might use a keep-alive connection. Regardless, one of the primary objectives of such a feature is to make XML-API requests less expensive, and that is also one of your goals.

    I know it doesn't solve your current situation, but it's something that might be available in the near future. You should try and hunt the Developer Discussion and Feature Request forums for that feature request, and throw in your vote of interest!

    It may seem like a silly question, but are you connecting remotely or to the localhost? This is just a wild idea if you're remotely making your queries: if you can execute your XML-API queries faster on the local machine, you might investigate other means of triggering your script (on the localhost), say, a persistent SSH tunnel? I think there will be some trade-offs, but you might be able to squeeze something faster...again, it kinda depends.

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

Similar Threads & Tags
Similar threads

  1. Keep alive or death
    By Massoud in forum Optimization
    Replies: 0
    Last Post: 03-07-2011, 06:54 AM
  2. Server memory being eaten alive..
    By Tonic-_- in forum Optimization
    Replies: 2
    Last Post: 11-02-2010, 02:16 PM
  3. keep-alive ignored by WHM/
    By freakin'me in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-29-2006, 06:01 AM
  4. Server rejects http/https/ssh/ftp connection. Linux/Apache.
    By gk4p in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 11-14-2005, 07:49 PM
  5. Apache dead or alive?
    By casey in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 03-16-2003, 01:27 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube