{"action":"opened","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4795","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4795/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4795/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/4795/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/4795","id":104814442,"number":4795,"title":"Prefetch batches earlier in Ruby and JS drivers","user":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/Java","name":"Java","color":"fef2c0"},{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/JavaScript%20/%20Coffee","name":"JavaScript / Coffee","color":"fef2c0"},{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/Ruby","name":"Ruby","color":"fef2c0"},{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/tp:performance","name":"tp:performance","color":"444444"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/98","html_url":"https://github.com/rethinkdb/rethinkdb/milestones/2.2-polish","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/98/labels","id":1040593,"number":98,"title":"2.2-polish","description":"","creator":{"login":"danielmewes","id":505365,"avatar_url":"https://avatars.githubusercontent.com/u/505365?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmewes","html_url":"https://github.com/danielmewes","followers_url":"https://api.github.com/users/danielmewes/followers","following_url":"https://api.github.com/users/danielmewes/following{/other_user}","gists_url":"https://api.github.com/users/danielmewes/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmewes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmewes/subscriptions","organizations_url":"https://api.github.com/users/danielmewes/orgs","repos_url":"https://api.github.com/users/danielmewes/repos","events_url":"https://api.github.com/users/danielmewes/events{/privacy}","received_events_url":"https://api.github.com/users/danielmewes/received_events","type":"User","site_admin":false},"open_issues":76,"closed_issues":5,"state":"open","created_at":"2015-03-26T19:14:40Z","updated_at":"2015-09-04T01:52:33Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-09-04T01:52:33Z","updated_at":"2015-09-04T01:52:33Z","closed_at":null,"body":"As of RethinkDB 2.1.2, our drivers send a CONTINUE on a cursor, then wait for the response, parse it, and send up to one additional CONTINUE request immediately for prefetching purposes.\r\n\r\nThis works fine as long as the bottleneck on the client is in the application consuming the data from the cursor. However if the bottleneck is in the parsing step, then prefetching the next batch only after parsing the previous response doesn't do much.\r\n\r\nThis can have a significant impact on the throughput at which one can read from a cursor for workloads such as the one described in https://github.com/rethinkdb/rethinkdb/issues/4569 .\r\n\r\nFor the Python driver, this was fixed in https://github.com/rethinkdb/rethinkdb/commit/e94e1656cb12e9f2793a14361dd71afbf7849983 and will ship together with RethinkDB 2.1.3.\r\nThe new driver now sends the next CONTINUE request as soon as the previous reply has arrived, *before* parsing the response (this means that we sometimes send another CONTINUE after the cursor has been exhausted, but that's fine).\r\n\r\nWe should also optimize the Ruby and JavaScript drivers in this respect (and in the Java driver too! :-) )."}}