GAE/J Low-level API: FetchOptions usage

2019-05-24 06:55发布

What should I know about FetchOptions withLimit, prefetchSize and chunkSize? The docs say the following:

prefetchSize is the number of results retrieved on the first call to the datastore.

chunkSize determines the internal chunking strategy of the Iterator returned by PreparedQuery.asIterator(FetchOptions)

...

prefetchSize and chunkSize have no impact on the result of the PreparedQuery, but rather only the performance of the PreparedQuery.

I'm not too sure how to use that in anger. What are the performance implications of different options? Any examples of how changes you've made have improved performance?

1条回答
混吃等死
2楼-- · 2019-05-24 07:03

Setting bigger chunkSize/prefetchSize will improve performance of iteration over big result sets, but it also will increase latency. So bigger values should work better when you know that you are going to iterate over big result set.

查看更多
登录 后发表回答