Concurrent usage of an EJB that is exposed as RMI

2019-08-26 15:22发布

问题:

I have built an application which simulates several clients using the same RMI service. This service is then invoked concurrently by every client retrieving and uploading data to the server. My concern is if every remove invocation takes some time does the remote service implementation (jBoss 5 EJB) can handle these calls remotely or it serializes them down.

If the latter is the case then I have to limit the number of clients to prevent slowing them down.

回答1:

RMI calls are not sequentialized unless the remote method implementations perform synchronization of some kind. This applies to both RMI/JRMP and RMI/IIOP.



回答2:

What exactly do you mean?

Do you mean that there are several clients who each obtain a remote EJB bean and then call a method on the stub/proxy they received, or do a large number of remote clients share a single proxy?

And what kind of EJB beans are we talking about? Stateless session beans?

These beans are pooled by the server and for each incoming remote method call to them, an instance is assigned to a worker thread from a thread pool. So yes, if the number of requests in a given time frame is larger then the number of available bean instances and worker threads, then those surplus requests will have to wait until a bean becomes available.

This is an automatic throttling mechanism thus.