{"id":21734757,"url":"https://github.com/ansys/grpc_chunk_stream_demo","last_synced_at":"2025-08-15T14:19:50.908Z","repository":{"id":43354824,"uuid":"277729284","full_name":"ansys/grpc_chunk_stream_demo","owner":"ansys","description":"Demonstrate Large Array Serialization using gRPC","archived":false,"fork":false,"pushed_at":"2022-03-24T07:55:35.000Z","size":1027,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T19:22:40.527Z","etag":null,"topics":["cpp","grpc"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ansys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-07T05:53:09.000Z","updated_at":"2023-02-21T06:27:24.000Z","dependencies_parsed_at":"2022-09-06T06:41:28.657Z","dependency_job_id":null,"html_url":"https://github.com/ansys/grpc_chunk_stream_demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansys%2Fgrpc_chunk_stream_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansys%2Fgrpc_chunk_stream_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansys%2Fgrpc_chunk_stream_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansys%2Fgrpc_chunk_stream_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansys","download_url":"https://codeload.github.com/ansys/grpc_chunk_stream_demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654026,"owners_count":21140236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","grpc"],"created_at":"2024-11-26T05:10:26.114Z","updated_at":"2025-04-13T01:40:23.807Z","avatar_url":"https://github.com/ansys.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Large Array Serialization using gRPC\n\n#### Prerequisites\n\nInstall `gRPC` for C++ using by following the directions at [gRPC Quick Start](https://grpc.io/docs/languages/cpp/quickstart/).  This will install both `gRPC` and `protobuf`, which you will need to compile the server and client.  If you wish you use the Python server as well, install `Python 3.6` or newer.\n\nYou will also need `cmake` to build the server and client, and the directions for installing a modern version of `cmake` are also at [gRPC Quick Start](https://grpc.io/docs/languages/cpp/quickstart/).\n\n\n#### C++ Server\n\nEnter the `cpp` directory and run the following to build the `demo_server`\n\n```\nmkdir build\ncd build\ncmake ..\nmake -j\n```\n\nNext, start the `demo_server` with:\n\n\n```\n./demo_server\n```\n\nYou should see:\n\n```\nServer listening on 0.0.0.0:50000\n```\n\nThe C++ server is now waiting for connections from port 50000.\n\n\n#### C++ Client\n\nAfter compiling the C++ server, start the C++ client with\n\n```\n./demo_client\n```\n\nThis will automatically run the streaming demo:\n\n```\n./demo_client\nConnected to server at: localhost:50000\nCreated an INT32 array on the server size 10000000\nArray is 38.15 MB\n\nTesting with byte stream...\nUsing chunk size 256 kB\nAverage time: 0.0167268\nApprox speed: 2.23 GBps\n\nTesting with repeated messages...\nAverage time: 0.0932537\nApprox speed: 409.07 MBps\n\nTesting with repeated chunked messages...\nAverage time: 0.0300367\nApprox speed: 1.24 GBps\n\n```\n\nUse the `-h` flag to see the options available when running the client.\n\n```\n./demo_client -h\n```\n\n```\ndemo_client [options]\nOptions:\n-h               Print this help\n--target         Set the target channel (default localhost:50000)\n--chunk_size     Set the chunk size in kB (default 256)\n--skip_repeated  Skip testing the repeated messages\n--array_size     Size of array in int32\n--ntimes_stream  Number of times to test the stream\n```\n\n#### Python Client\n\nFirst, ensure you have the following packages installed:\n\n- `grpcio`\n- `google-api-python-client`\n\n\nAlso, make sure that the version of the packages is greater than or equal to your `gRPC` C++ version.\n\n\nNext, enter the `python` directory and run:\n\n```\nmake\n```\n\nThis will generate the python gRPC interface files `chunkdemo_pb2.py`\nand `chunkdemo_pb2_grpc.py`.  While you have the C++ server running,\nrun:\n\n```\npython client.py\n```\n\nThis will connect to the server at your local host and run a basic\narray transfer test using both a byte stream and repeated messages.\n\n```\nConnected to server at 127.0.0.1:50000\nCreated an INT32 array on the server size 20000000\nTesting with byte stream...\nAverage time: 0.03763810700038448\nAprox speed: 2.0GiB\n\nTesting with repeated messages...\nAverage time: 0.8858063033355089\nAprox speed: 86.1MiB\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansys%2Fgrpc_chunk_stream_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansys%2Fgrpc_chunk_stream_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansys%2Fgrpc_chunk_stream_demo/lists"}