The documentation for OTConnectionFactory.java states that it's possible to make simultaneous requests using one connection. However, when I try make several "IRequest request = connection.prepareRequest( )" on HistTicksCommand's, then submit() each of the requests, and wait for all of them to return true for isClompleted, inevitably I get all the results of each command in serial order, as if I had requested each, waited for it to complete, then requested the next, etc.
Any suggestions?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Requests are indeed sent simultaneously. This does not say anything about the order in which OT server will process them.
What you discovered is that (apparently) OT server processes requests sequentially. I am not sure if this is a true observation or just a property of the particular requests you are sending.
For example, I believe I've seen the following behavior:
- request1 sent for fairly large dataset (a lot of data, like 1 min OHLC for a month)
- request2 sent for small dataset (1 hour OHLC for a month)
- request2 answered
- request1 answered
And also, I believe, I've seen interleaving data (could be wrong, was never too interested in relative sequence of things).
If you are after the download speed, try running simultaneous downloads within one connection versus one connection per download, and see what is faster. The result depends on how OT servers throttle the data speed (per userid or per connection). If its per connection, you may gain some speed by using multiple connections...
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1) Does otfeed's API allow submitting multiple requests to OTServer at the same time?
2) Do OpenTick Servers know how to handle multiple requests simultaneously?
If i use OTPooledConnectionFactory as opposed to OTConnectionFactory, can i submit concurrent requests for historical data and have them being processed not sequentially but concurrently?
Thank you for your help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can submit as many requests as you wish using one connection. How opentick processes them depends on the opentick server. I've seen somewhere on opentick.com forums an explanation that claims that server processes requests sequentially. However, this is not what I actually see. For example, after submitting historic requests for 10 symbols I see replies coming interleaved for different requests, which implies that opentick servers do parallelize the work...
I am not sure what is opentick.com policy regarding the multiple connections to one userid. They do allow multiple connects, but the question is whether they throttle data rate basing on connection instance or on the userid. In the former case, opening multiple connections may help to get higher download rate..., in the latter - will not.
-Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The documentation for OTConnectionFactory.java states that it's possible to make simultaneous requests using one connection. However, when I try make several "IRequest request = connection.prepareRequest( )" on HistTicksCommand's, then submit() each of the requests, and wait for all of them to return true for isClompleted, inevitably I get all the results of each command in serial order, as if I had requested each, waited for it to complete, then requested the next, etc.
Any suggestions?
Thank you.
Requests are indeed sent simultaneously. This does not say anything about the order in which OT server will process them.
What you discovered is that (apparently) OT server processes requests sequentially. I am not sure if this is a true observation or just a property of the particular requests you are sending.
For example, I believe I've seen the following behavior:
- request1 sent for fairly large dataset (a lot of data, like 1 min OHLC for a month)
- request2 sent for small dataset (1 hour OHLC for a month)
- request2 answered
- request1 answered
And also, I believe, I've seen interleaving data (could be wrong, was never too interested in relative sequence of things).
If you are after the download speed, try running simultaneous downloads within one connection versus one connection per download, and see what is faster. The result depends on how OT servers throttle the data speed (per userid or per connection). If its per connection, you may gain some speed by using multiple connections...
-Mike
Is the correct method of sending simultaneous requests (as far as this API is concerned) the following:
loop:
1. create HistTicksCommand
2. create IRequest from (1)
3. run submit() on (2)
--
4. run waitForCompletion() on the first IRequest
5. after (4) completes, run (4) again on the next IRequest
Thank you.
I think you mean this:
loop1:
create HistTick command
create request
submit request
add request to the list of submitted requests
end loop1
loop2:
for all submitted requests {
request.waitForCompletion();
}
end loop2
Yes, the above is the correct way (assuming you want to run them "simultaneously").
-Mike
Yeah, that's what I meant by my pseudocode. Thanks for the confirmation.
Btw, it looks like multiple requests are processed serially:
http://www.opentick.com/forum/viewtopic.php?t=2120
"They will be accepted and processed serially"
Hi
May i ask more information on this topic?
1) Does otfeed's API allow submitting multiple requests to OTServer at the same time?
2) Do OpenTick Servers know how to handle multiple requests simultaneously?
If i use OTPooledConnectionFactory as opposed to OTConnectionFactory, can i submit concurrent requests for historical data and have them being processed not sequentially but concurrently?
Thank you for your help
You can submit as many requests as you wish using one connection. How opentick processes them depends on the opentick server. I've seen somewhere on opentick.com forums an explanation that claims that server processes requests sequentially. However, this is not what I actually see. For example, after submitting historic requests for 10 symbols I see replies coming interleaved for different requests, which implies that opentick servers do parallelize the work...
I am not sure what is opentick.com policy regarding the multiple connections to one userid. They do allow multiple connects, but the question is whether they throttle data rate basing on connection instance or on the userid. In the former case, opening multiple connections may help to get higher download rate..., in the latter - will not.
-Mike