You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/09 09:47:38 UTC
[GitHub] [arrow] elignb opened a new issue #11649: DoGet prefetch
elignb opened a new issue #11649:
URL: https://github.com/apache/arrow/issues/11649
Hi,
I am wondering whether prefetch is implemented during exhaustion of the record batches stream created by the server.
Meaning, invoking Next actually happens in "zero time".
Kindly appreciate your response.
Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] elignb commented on issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
elignb commented on issue #11649:
URL: https://github.com/apache/arrow/issues/11649#issuecomment-964256271
Thank you!
But where does the buffering occur, on the server side or on the client side? I mean if the communication is between two remote machines will each `read_chunk` call by the client incur a network transmission delay?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm closed issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
lidavidm closed issue #11649:
URL: https://github.com/apache/arrow/issues/11649
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #11649:
URL: https://github.com/apache/arrow/issues/11649#issuecomment-964237889
Flight itself does not implement any readahead. However, that's fine, as gRPC itself effectively does this by buffering data. See this [StackOverflow question](https://stackoverflow.com/questions/64828787/stream-window-size-with-regards-to-http-2-and-stream-performance), for instance.
You can observe this with a short demo:
<details>
<summary>Code</summary>
server.py:
```python
import time
import numpy as np
import pyarrow as pa
import pyarrow.flight as flight
class ExampleServer(flight.FlightServerBase):
def do_get(self, context, ticket):
num_batches = 5
delay = 2
if ticket.ticket:
num_batches = int(ticket.ticket)
print("Serving", num_batches, "batches at a", delay, "second interval")
batch = pa.RecordBatch.from_arrays([
np.random.rand(4096)
for _ in range(4)
], names=["a", "b", "c", "d"])
def _gen():
for i in range(num_batches):
time.sleep(delay)
print("Sending batch at:", time.time())
yield batch
return flight.GeneratorStream(batch.schema, _gen())
def main():
print("PyArrow:", pa.__version__)
server = ExampleServer("grpc+tcp://localhost:3000")
print("Serving on port", server.port)
server.serve()
if __name__ == "__main__":
main()
```
client.py:
```python
import time
import pyarrow as pa
import pyarrow.flight as flight
def main():
client = flight.connect("grpc+tcp://localhost:3000")
stream = client.do_get(flight.Ticket(b""))
# Do some other work...
print("Doing some work for 10 seconds at:", time.time())
time.sleep(10)
for _ in range(5):
stream.read_chunk()
print("Got batch at:", time.time())
if __name__ == "__main__":
main()
```
</details>
<details>
<summary>Results</summary>
```
# Server side
> python server.py
PyArrow: 5.0.0
Serving on port 3000
Serving 5 batches at a 2 second interval
Sending batch at: 1636470268.1261907
Sending batch at: 1636470270.1284654
Sending batch at: 1636470272.1303897
Sending batch at: 1636470274.1331174
Sending batch at: 1636470276.1359076
# Client side
> python client.py
Doing some work for 10 seconds at: 1636470266.1256127
Got batch at: 1636470276.1363451
Got batch at: 1636470276.1364918
Got batch at: 1636470276.1365817
Got batch at: 1636470276.1366274
Got batch at: 1636470276.1369655
```
</details>
Observe how from the client's perspective, it got all the batches at once.
Is this what you were looking for?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #11649:
URL: https://github.com/apache/arrow/issues/11649#issuecomment-964258925
The linked question goes into detail, so I suggest reading that. It is up to gRPC and its HTTP/2 implementation, however, the buffering should generally occur on the client. The server will be blocked once it sends more data than the client is willing to buffer. (This can vary by implementation, e.g. Java will not block the server side but instead start buffering data on the server.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #11649:
URL: https://github.com/apache/arrow/issues/11649#issuecomment-964259928
If you absolutely need readahead than I suggest your application implement that explicitly, however the point here is that gRPC and HTTP/2 already buffer data on the client so likely there is no need to do so explicitly unless you find there is a performance problem that could be solved by readahead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] elignb commented on issue #11649: DoGet prefetch
Posted by GitBox <gi...@apache.org>.
elignb commented on issue #11649:
URL: https://github.com/apache/arrow/issues/11649#issuecomment-964264473
Thank you very much!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org