I am having bidirectional grpc stream on a server which is deployed on Cloud Run (Server written in Go). Time of stream is limited by Request Timeout which can not be longer than 1 hour. Grpc stream suppose to be use for long time connections. Workaround for that is to reconnect on a client side but it requires some additional implementations on a client and server side to provide continuous operations. Is there a little bit more "elegant" way to handle long time continous grpc streams via Cloud Run ?
Related
I have implemented a synchronous rpc server that provides a set of functions through grpc. This is grpc basic functionality and works well, but now I am looking for an ideomatic way to execute a task periodically on the synchronous grpc server - initiated by the server itself.
For example, I want to achieve something like updating a server-side cache. While updating this cache, the server must not process rpc requests to ensure consistent data.
Is there any functionality in grpc to accomplish such a task, or do I need to implement my own solution?
I was thinking about setting up a thread that periodically sends an rpc request to the server. That is, I would add an additional function to the existing grpc service. However, I think that this is not the idomatic way to implement such a use case.
I'm working on bidirectional stream gRPC in C++. I want to set a timeout limit on server side, and kill the connection if it exceeds a threshold.
But the only timeout mechanism I've found is on client side(https://grpc.io/blog/deadlines/#c). And I don't find any API possible to for ServerContext(https://grpc.github.io/grpc/cpp/classgrpc_1_1_server_context.html). Does someone know how to do that?
gRPC does not support server side timeout limit/setting and hence you might need to have your own implementation mechanism and update client using context.abort.
We have a streaming endpoint where data streams through our api.domain.com service to our backend.domain.com service and then as chunks are received in backend.domain.com, we write those chunks to the database. In this way, we can ndjson a request into our servers and IT IS FAST, VERY FAST.
We were very very disappointed to find out the cloud-run firewalls for http1.1 at least (via curl) do NOT support streaming!!!! curl is doing http2 to google cloud run firewall and google is by default hitting our servers with http1.1(for some reason though I saw an option to start in http2 mode that we have not tried).
What I mean, by they don't support streaming is that google does not send our servers a request UNTIL the whole request is received by them!!!(ie. not just headers, it needs to receive the entire body....this makes things very slow as opposed to streaming straight through firewall 1, cloud run service 1, firewall 2, cloud run service 2, database.
I am wondering if google's cloud run firewall by chance supports http/2 streaming and actually sends the request headers instead of waiting for the entire body.
I realize google has body size limits.......AND I realize we respond to clients with 200OK before the entire body is received (ie. we stream back while a request is being streamed in) sooooo, I am totally ok with google killing the connection if size limits are exceeded.
So my second question in this post is if they do support streaming, what will they do when size is exceeded since I will have already responded with 2000k at that point.
In this post, my definition of streaming is 'true streaming'. You can stream a request into a system and that system can forward it to the next system and keep reading/forwarding and reading/forwarding rather than waiting for the whole request. The google cloud run firewall is NOT MY definition of streaming since it does not pass through chunks it receives! Our servers sends data as it receives it so if there are many hops, there is no impact thanks to webpieces webserver.
Unfortunately, Cloud Run doesn't support HTTP/2 end-to-end to the serving instance.
Server-side streaming is in ALPHA. Not sure if it helps solving your problem. If it does, please fill out the following form to opt in, thanks!
https://docs.google.com/forms/d/e/1FAIpQLSfjwvwFYFFd2yqnV3m0zCe7ua_d6eWiB3WSvIVk50W0O9_mvQ/viewform
I am trying to use WinHTTP C++/Windows API in order to connect to multiple Http servers. Before switching to WinHTTP, i tried using HttpClient C# 4.5 in async manner, however i did not get high throughput and the CPU was too high.
On WinHTTP, a single request should not take more than 100ms; however i noticed that when using WinHTTPSetTimeouts it has no effect even when setting timeout to 10ms, still a single request to a port on the same machine takes 15-30ms, and when connecting to a port no body listens to, the request takes up to 1000ms, therefore, i concluded that timeout is not working.
In addition, i noticed that the time taken to fire a GET request on the same machine takes 15-30ms which is too high compared to .NET which takes 2-7ms...
I also tried setting connect/recv/send timeout to 1 second, yet the receive operation timeout after 4 seconds.
Do you have a clue how to work it out with timeouts and why a single request is taking time.
We have a mobile Application in a very unsteady WLan Environment. Sending Data to a webserver could result in a timeout or in a lost WLan connection.
How do we ensure, that our data is delivered correctly? Is there a possibility of having Web Services Reliable Messaging (WSRM) on the device?
MSMQ is no option at the moment.
WSRM isn't supported. A reliable mechanism is to ensure that either the Web Service responds to the upload with an ack after the data has been received (i.e. a synchronous call) or that when you start the upload you get back a transaction ID that you can then send back to the service at a later point to ensure that it has been delivered before local deletion.