ICE异步调用的两种方式


目前正在研读ICE异步调用的章节,下面抢鲜分享一小段 
http://www.zeroc.com/doc/Ice-3.3.0/manual/Async.html#22064 

此外ICE还有网格计算,和Map reduce有些仿佛. 
http://www.zeroc.com/doc/Ice-3.3.0/manual/IceGrid.html#22064 

_______________________________________________________ 
29.2.1 Asynchronous Method Invocation 
异步方法调用 

Asynchronous Method Invocation (AMI) is the term used to describe the 
client-side support for the asynchronous programming model. 

AMI supports both oneway(不需要返回值) and twoway(需要返回值) requests, but 
unlike their synchronous counterparts, AMI requests never block the 
calling thread. 

When a client issues an AMI request, the Ice run time hands the 
message off to the local transport buffer or, if the buffer is 
currently full, queues the request for later delivery. 

当客户端发起一个异步方法调用(AMI)的请求,Ice运行环境将其从本地的传输缓存(如果缓存已经满了,放入队列,过一会再发)发出这个消息. 

The application can then continue its activities and, in the case of a 
twoway invocation, is notified when the reply eventually arrives. 

程序可以干继续它的活. 
如果是一个双向的调用(zsp注:可以理解为需要回调),当回应到达时,会发出一个通知. 

Notification occurs via a callback to an application-supplied 
programming-language object1. 

下面还有服务器端异步分派任务 

29.2.2 Asynchronous Method Dispatch 

The number of simultaneous synchronous requests a server is capable of 
supporting is determined by the server's concurrency model (see 
Section 28.9). If all of the threads are busy dispatching long-running 
operations, then no threads are available to process new requests and 
therefore clients may experience an unacceptable lack of 
responsiveness. 

Asynchronous Method Dispatch (AMD), the server-side equivalent of AMI, 
addresses this scalability issue. Using AMD, a server can receive a 
request but then suspend its processing in order to release the 
dispatch thread as soon as possible. 

从广义的说,异步的任务分配(AMD)的服务器端的(AMI). 
一个服务器可以接受一个请求,但推迟处理直到分配线程可用. 

When processing resumes and the results are available, the server 
sends a response explicitly using a callback object provided by the 
Ice run time. 

当进程继续,结果可用时.服务器产生一个回应,并回调Ice运行环境提供回调对象 

In practical terms, an AMD operation typically queues the request data 
(i.e., the callback object and operation arguments) for later 
processing by an application thread (or thread pool). 

在实际的项目中,AMD操作一般将request data存入队列(比如,需要回调的对象和参数),让应用的线程(或线程池)稍后处理. 

In this way, the server minimizes the use of dispatch threads and 
becomes capable of efficiently supporting thousands of simultaneous 
clients. 

这样,服务器就可以节省分配线程,所有可以高效同时支持上千个客户端. 

An alternate use case for AMD is an operation that requires further 
processing after completing the client's request. In order to minimize 
the client's delay, the operation returns the results while still in 
the dispatch thread, and then continues using the dispatch thread for 
additional work. 

另外一种AMD的用途是当客户请求结束后需要继续处理.为了最小客户端的时延,当操作还再分配的时候就立即返回,然后用分派线程去干其他的事情 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值