Archived

This forum has been archived. Please start a new discussion on GitHub.

Serialization only for the same request

Hi!
When using multi-threaded pool, the requests from the same operation (the operation may be called many times in a short time) in the same connection or different connection may be not be dispatched in the order they were received.
But I want they could be dispatched in the order they were received, others are not required, what do I do?

sorry, my English is poor!

Comments

  • If you use multiple threads for dispatch, then your requests are processed in parallel, and you have no control over the ordering. This is nothing specific to Ice, but simply how multi-threaded systems work.

    For oneway requests in particular, see also this FAQ.
  • marc wrote: »
    If you use multiple threads for dispatch, then your requests are processed in parallel, and you have no control over the ordering. This is nothing specific to Ice, but simply how multi-threaded systems work.

    For oneway requests in particular, see also this FAQ.

    Thanks for your answer.

    I'm sorry I didn't express my question clearly.
    I know you said.
    When the server employ a thread pool with multiple threads, We could force the thread pool to dispatch requests serially by setting one of properties Ice.ThreadPool.name.Serialize or adapter-name.ThreadPool.Serialize.

    A multi-threaded pool for serializtion can dispatch requests for different connections concurrently while serializing requests form the same connection.
    But this isn't what I want.

    My question is , for example
      xxx.ice
        ...
        interface A {
             ... // other operation
             int op(int argument);
        };
        ...
    
      client.cpp
        ... 
        APrx prx = ...;
        ...
        prx->begin_op(...);	// Time1
        prx->begin_op(...);         // Time2
        ...
    

    Server:
    Configuring the thread pool to support multiple threads, I want the same operation from the same connection or different connection can be dispatched and processed serialtized in the Server, but the different operations can be dispathced and processed in parallel.

    I want to know how to configure the Ice server or is there some interfaces for us to do this.
  • You can configure two object adapters with different thread pools and thread pool properties. Then you could use one object adapter to serve Ice objects for which you want requests to be serialized, and another for which you want requests to be dispatched in parallel. Note that using two object adapters implies two connections from each client that uses them. I'm afraid there is no way to do what you want to do with just a single connection and a single object adapter, or for different functions of the same Ice object.
  • The advice you gave can't slove my problem. I can't using two object adapters ...

    Configure the multile-threaded for serialization, that means Ice run time can get the order the requests were received. Is there a interface to let me get the order. If so, I could make the server dispatch the same requests serilized in implement of operation.
  • No, there is no such interface. I'm sorry, but I'm afraid I don't have any other advice I can offer you.
  • Of course you could add ordering information to the operation itself, i.e., have your client send ordering information along with the rest of the request parameters.
  • Now, i only use this to slove my problem.

    Thanks!
    hui.
  • I'm not completely sure I understand either, but do you not want AMD? If server-side you hand off some AMD objects to a executor which only has a single thread then they would be processed serially (in the order the arrived at the server).

    Sorry if I misunderstood you,
    ~Josh.
  • This method can really solve my problem. But I just want the same requests (caused by calling one special operation many times) cloud be processed serially, and others are processed in parallel. Taking the advice, that mean I have to do rewrite my Ice server. It is too much work. I want Ice can provide interfaces and configuration or just rewrite the special operation.

    Thanks all the same!
    joshmoore wrote: »
    I'm not completely sure I understand either, but do you not want AMD? If server-side you hand off some AMD objects to a executor which only has a single thread then they would be processed serially (in the order the arrived at the server).

    Sorry if I misunderstood you,
    ~Josh.