New API vs Old speed test

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Muqbil
    Junior Member
    • Jan 2009
    • 4

    #1

    New API vs Old speed test

    I have done a few tests and the new API seems massively slower than the old API.

    Is this the general rule of thumb?

    The new API seems snail like in comparison to the old api. I used the sample c# code available on github and removed the console writelines etc.
  • just_browsing
    Junior Member
    • Mar 2013
    • 2

    #2
    The sample code doesn't compress requests/responses and doesn't keep http connections alive, which will incur a huge overhead.

    Comment

    • AlgoTrader
      Junior Member
      • Mar 2012
      • 243

      #3
      First, when we talk about performance testing, we need numbers. If there are no numbers, then that's useless subjective discussion.

      Second, we need to test API in equal environments:
      - Both APIs work with persistent connections, otherwise you test SSL handshake, not API
      - Both APIs use GZIP compression, that's very important factor

      My opinion is both APIs are comparable. listMarketCatalogues shows 20-25ms in average, that is slightly worse than the old API that showed 15-20ms in average
      Betfair Bots Made Easy

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #4
        AlgoTrader - have you managed to successfully implement GZip compression? I tried but it just seemed to muck everything up.

        If you have it working, then I'll try again.

        Comment

        • AlgoTrader
          Junior Member
          • Mar 2012
          • 243

          #5
          GZIP compression is usual:

          Request should contain
          Accept-Encoding: gzip

          If response has
          Content-eEncoding: gzip

          Then, we need to ungzip the response body
          Betfair Bots Made Easy

          Comment

          • AlgoTrader
            Junior Member
            • Mar 2012
            • 243

            #6
            New release made performance better. I see most of simple calls are in 18-30ms from my Linode. In previous release 18ms was impossible, now it's very common
            Betfair Bots Made Easy

            Comment

            • tkw141
              Junior Member
              • Nov 2013
              • 18

              #7
              Does gzip encoding work for API-NG JSON RPC calls?

              I can retrieve data successfully without gzip, but when I add it to the header it fails to return any data. The header I'm trying is:

              $client->ua->default_header(
              'Accept'=>"application/json",
              'Accept-Encoding'=>"gzip",
              'Content-type'=>"application/json",
              'X-Application'=>"$appkey",
              'X-Authentication'=>"$ssid"
              );


              And this is the call response I'm getting back:

              JSON::RPC::Client {
              public methods (13) : allow_call, AUTOLOAD, call, content_type, create_json_coder, id, json, new, prepare, status_line, ua, uri, version
              private methods (2) : _get, _post
              internals: {
              content_type "application/json",
              id 1,
              json JSON,
              status_line "200 OK",
              ua LWP::UserAgent,
              version 1.0
              }
              }


              But there is no content. This seems to suggest that the call is communicating correctly with the server, but doesn't like gzip encoding. Has anyone got this working with API-NG and RPC ?

              Comment

              • AlgoTrader
                Junior Member
                • Mar 2012
                • 243

                #8
                It certainly works
                Check the "Content-Encoding:gzip" in the server response. Many HTTP clients just ignore the header and fail to parse binary data in HTTP response

                Code:
                headers:  { 
                  date: 'Mon, 27 Jan 2014 13:45:09 GMT',
                  'cache-control': 'no-cache',
                  'content-type': 'application/json',
                  'content-encoding': 'gzip',
                  'content-length': '252',
                  'set-cookie': [ 'NSC_mc-80-cfub-bqj-bo.efgbvmu=[skipped];expires=Tue, 28-Jan-2014 0
                1:45:09 GMT;path=/;httponly' ] 
                }
                Betfair Bots Made Easy

                Comment

                Working...
                X