Hi, Does the code snippet indicate that the grpc server does process the client requests in reversed order (using stack)?
*"... but preserve the order of actual requests presented to the application."* Does it mean that with grpc async model, the client get replies in the same order of the requests are sent? I thought it is only possible with streaming model?? Thanks a lot. On Thursday, February 16, 2017 at 9:48:01 AM UTC+8, Craig Tiller wrote: > > You've misunderstood :) > > The server application needs to request incoming calls, and we need to > match them to requests as they come in. We arbitrarily reverse to order of > matching (because we get a faster implementation), but preserve the order > of actual requests presented to the application. > > On Wed, Feb 15, 2017, 1:56 PM Arpit Baldeva <[email protected] > <javascript:>> wrote: > >> Hi, >> >> This post is around the rpc sequence issued by a single client. >> >> For the sync model, I understand that rpc call order guarantee can't be >> maintained due to a pool of threads executing concurrently. The sync model >> is not suitable for my use case for other reasons and I was looking at the >> async model which allows for better threading control. On surface, it >> seemed like it would allow my application to see the same rpc order as >> issued by a client if I processed completion queue on a single thread. >> >> However, I was looking at the C core implementation and this code caught >> my eyes (The usage of stack structure) >> >> for (size_t i = 0; i < server->cq_count; i++) >> { size_t cq_idx = (chand->cq_idx + i) % server->cq_count; int request_id >> = gpr_stack_lockfree_pop(rm->requests_per_cq[cq_idx]); >> if (request_id == -1) >> { continue; } >> else { gpr_mu_lock(&calld->mu_state); calld->state = ACTIVATED; >> gpr_mu_unlock(&calld->mu_state); >> publish_call(exec_ctx, server, calld, cq_idx, >> &server->requested_calls_per_cq[cq_idx][request_id]); return; /* early out >> */ } >> >> So if two rpcs come from the same client in the same "network chunk", >> would the order of rpcs that the application see is reversed or I >> misunderstood the code here? >> >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/grpc-io. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/2e657a3c-0c8a-4159-bfe1-4c914d2a55b1%40googlegroups.com >> >> <https://groups.google.com/d/msgid/grpc-io/2e657a3c-0c8a-4159-bfe1-4c914d2a55b1%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/67e374b2-45d8-451a-b71c-8f51e9afd13a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
