Are JSON requests serialised?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hamlet6
    Junior Member
    • Jan 2014
    • 9

    #1

    Are JSON requests serialised?

    Hi, bit of a novice question...

    If I have two threads and each uses the same login session token to make a separate query (say, listMarketBook() ) on separate markets at approximately the same time, are the requests serialised by the exchange - i.e. the processing of the second won't start until the first is completed - or can they in theory be processed simultaneously?

    It's highly possible that it's my algorithm that is at fault and its (mal)use of libcurl, but I am seeing this behaviour and I wanted to rule this out.

    Cheers
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    I don't know the definitive answer - for that you would have to wait for BDP to respond or email them directly.

    However, if you are requesting details for separate markets, then why does it matter? (I am genuinely interested)

    Even if the exchange processed your requests in order, there is nothing to dictate that your application will receive responses in the same order (i.e. the second response may make it back to your application before the first due to network latencies, etc).

    Comment

    • Hamlet6
      Junior Member
      • Jan 2014
      • 9

      #3
      Thanks for the reply.

      I ask as I am noticing quite a delay in my market update logic. I have a pool of several threads, each one refreshing the books of an indivitual football game, and afterwards the thread is returned to the pool. I'm doing this in the hope of performance over single-threaded.

      Each thread starts at approximately the same time, but the response time looks very sequential - no matter how many threads I have in the pool (2, or 20), the time taken to process all games is about the same (but still faster than single threaded though).

      As I say, I am pretty sure I'm not using libcurl as efficiently as I could so am investigating that as a cause too.

      Comment

      • Joseph Paterson
        Junior Member
        • Feb 2015
        • 2

        #4
        They are definitely not serialised, I'd suggest something is wrong on your end. I am able to make multiple queries in parallel on different threads.

        Something to look for, what client are you actually using to make your API calls? It's possible that both your threads are using the same http client which might only allow one simultaneous query.

        Comment

        Working...
        X