Title: BigTable: Memory usage abnormally increasing when using table.read_rows method · Issue #4586 · googleapis/google-cloud-python · GitHub
Open Graph Title: BigTable: Memory usage abnormally increasing when using table.read_rows method · Issue #4586 · googleapis/google-cloud-python
X Title: BigTable: Memory usage abnormally increasing when using table.read_rows method · Issue #4586 · googleapis/google-cloud-python
Description: Hi, While using the python google-cloud-bigtable to read a large collection of data (10M to 90M rows of at least 4MB to 5MB per row), I noticed a strange behavior: The used RAM was at lease twice the size of the data I was reading from t...
Open Graph Description: Hi, While using the python google-cloud-bigtable to read a large collection of data (10M to 90M rows of at least 4MB to 5MB per row), I noticed a strange behavior: The used RAM was at lease twice t...
X Description: Hi, While using the python google-cloud-bigtable to read a large collection of data (10M to 90M rows of at least 4MB to 5MB per row), I noticed a strange behavior: The used RAM was at lease twice t...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/4586
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BigTable: Memory usage abnormally increasing when using table.read_rows method","articleBody":"Hi,\r\n\r\nWhile using the python google-cloud-bigtable to read a large collection of data (10M to 90M rows of at least 4MB to 5MB per row), I noticed a strange behavior: The used RAM was at lease twice the size of the data I was reading from the table.\r\n\r\nHere is the code I did to reproduce :\r\n\r\n```python\r\nfrom google.cloud import bigtable\r\n\r\ninstance_name = \"the-instance\"\r\ntable_name = \"the-table\"\r\n\r\nclient = bigtable.Client(admin=False)\r\ninstance = client.instance(instance_name)\r\ntable = instance.table(table_name)\r\n\r\nlast_readall_key = None\r\nrows = table.read_rows(start_key=last_readall_key)\r\n\r\nwhile True:\r\n try:\r\n rows.consume_next()\r\n except StopIteration as e:\r\n break\r\n except Exception as e:\r\n print 'Got exception of type %s : %s' % (type(e), str(e)) # mostly grpc._channel._Rendezvous exceptions are thrown here\r\n\r\n table = instance.table(table_name)\r\n rows = table.read_rows(start_key=last_readall_key)\r\n\r\n rows.consume_next()\r\n\r\n for key in rows.rows:\r\n last_readall_key = key\r\n\r\n rows._rows.clear() #this was an attempt to fix, but it doesn't have any effect\r\n```\r\n\r\nWhen running the above code, my instance RAM fills itself until full.\r\n\r\nAnother weird thing, is that the problem does not happen on my MacOS Sierra 10.12.6 machine. I only witness the problem on Linux machines.\r\n\r\nI saw this problem on Linux Ubuntu 14.04 LTS and Linux Ubuntu 10.04.5 LTS. I did not try with other Linux distributions or others versions of Ubuntu though.\r\n\r\nAm I doing something wrong ? Does anyone knows what may cause this problem ?\r\nWould anyone have any trick to avoid this problem ?\r\n\r\nFind below the pip requirements to reproduce :\r\n\r\n```\r\ncachetools==2.0.1\r\ncertifi==2017.11.5\r\nchardet==3.0.4\r\ndill==0.2.7.1\r\nenum34==1.1.6\r\nfuture==0.16.0\r\nfutures==3.2.0\r\ngoogle-api-core==0.1.2\r\ngoogle-auth==1.2.1\r\ngoogle-cloud-bigtable==0.28.1\r\ngoogle-cloud-core==0.28.0\r\ngoogle-gax==0.15.16\r\ngoogleapis-common-protos==1.5.3\r\ngrpcio==1.7.3\r\nidna==2.6\r\nply==3.8\r\nprotobuf==3.5.0.post1\r\npyasn1==0.4.2\r\npyasn1-modules==0.2.1\r\npytz==2017.3\r\nrequests==2.18.4\r\nrsa==3.4.2\r\nsix==1.11.0\r\nurllib3==1.22\r\n```\r\n(these dependancies are installed automatically when using `pip install google-cloud-bigtable` )\r\n\r\nThanks for your time.","author":{"url":"https://github.com/Rafff","@type":"Person","name":"Rafff"},"datePublished":"2017-12-13T22:13:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/4586/google-cloud-python/issues/4586"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9e73e82e-5860-d3ad-04a2-f0c4e96e6663 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D738:A303:A81CF2:E55731:6A4D524C |
| html-safe-nonce | 91e0983919e55dbaa48ef84e134b39a1a5761d7c05e016255add1ad270c4d69d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzM4OkEzMDM6QTgxQ0YyOkU1NTczMTo2QTRENTI0QyIsInZpc2l0b3JfaWQiOiIyNzA1MzY2MzMwOTQwNjY3NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 84a445eb0a906054d890d6bb15d79db2910d2c95117440573066a3ee2dc2ca6f |
| hovercard-subject-tag | issue:281915251 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/4586/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6b3e80c707016ee6a6f419d5862d0839e9858a79c6b2a943226c7f1ee09b53ed/googleapis/google-cloud-python/issues/4586 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6b3e80c707016ee6a6f419d5862d0839e9858a79c6b2a943226c7f1ee09b53ed/googleapis/google-cloud-python/issues/4586 |
| og:image:alt | Hi, While using the python google-cloud-bigtable to read a large collection of data (10M to 90M rows of at least 4MB to 5MB per row), I noticed a strange behavior: The used RAM was at lease twice t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Rafff |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width