I see. Both of these approaches are equally valid. The latter approach
would be a unary RPC and require the server to buffer the entire
spreadsheet in memory, meaning that it wouldn't be able to scale to very
large datasets. However, this would also be the simpler approach in terms
of implementation -- everything can be written synchronously.

The former approach is more robust if you need to scale to large datasets.
This would be a client-unary, server-streaming RPC and the server wouldn't
have to buffer the whole dataset in memory.

A couple of pitfalls specific to Python. The sync stack works with a fixed
sized thread pool, which limits the number of clients that can connect to
your backend at once. In the case of a unary RPC, this is less of an issue.
If you go with the streaming approach, however, misbehaving clients could
eat up a thread indefinitely until you have none left to service requests.
If this is a concern for you, you could use the asyncio stack instead. A
last caveat for Python is that it will be slower than other languages you
could choose, including Go, Java, and C++, all of which are well supported
gRPC implementations which will be more performant.

Thanks,
Richard Belleville



On Fri, May 14, 2021 at 2:14 PM Raja Omer <[email protected]> wrote:

> My confusion is regarding my approach, specifically that how to serve a
> client call for excel data using a  GRPC server? Do I have to store the
> data in some database and then read it into a message and send back on a
> row by row basis or can I just read from the excel directly in the GRCP
> server python file and send the entire excel data as one message response?
> Would any of these approaches be correct and will the server python file be
> the right place for this implementation?
> On Saturday, May 15, 2021 at 2:02:06 AM UTC+5 [email protected] wrote:
>
>> > Do I have to read the excel in this step using python or do I have to
>> make a database connection and pull the excel data from a database?
>>
>> This question doesn't actually seem to have anything to do with gRPC. Is
>> there something I'm missing?
>>
>> On Fri, May 14, 2021 at 1:35 PM Raja Omer <[email protected]> wrote:
>>
>>> I am new to GRPC, and want to know how should a GRCP server which can
>>> read from a file and send the data to a GRCP client in python?
>>>
>>> Scenario implementation: I have an excel file with two columns, ID and
>>> value. My understanding for implementation of this scenario is :
>>> 1- I will have to define a message in a protocol buffer file having
>>> these two attributes.
>>> 2- Inside my protocol buffer file, I will define a service which will
>>> send the data to the client.
>>> 3- Using GRPC tools I will then create _pb2.py and _pb2_grpc.py files.
>>> 4- Now I will write the GRPC server file in python. Inside this file I
>>> will override or define the service I have written in the protocol buffer
>>> file. My confusion is regarding this step. Do I have to read the excel in
>>> this step using python or do I have to make a database connection and pull
>>> the excel data from a database?
>>>
>>> Many thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "grpc.io" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/grpc-io/a59b9544-13c0-42fd-afd8-284be0ea34cfn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/grpc-io/a59b9544-13c0-42fd-afd8-284be0ea34cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/23a8d925-1420-44a4-9b9c-8c35d29c86a7n%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/23a8d925-1420-44a4-9b9c-8c35d29c86a7n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAOew_sHZ0mDCFsVtH5EuDpMgBg8%3DU9d0pKdhRwfQCB1H-A%2BzPg%40mail.gmail.com.

Reply via email to