JMS: A Solution in Search of a Problem? (cont'd)
Stating Some Theorems
Assuming there can only be a finite number of threads in an application at a time, then clearly the N-tiered system using asynchronous messages can handle more simultaneous client requests, and can probably service each individual request fasteror at least as fastcompared to the RPC-based application. To state it as theorem, one might say ...
Given:
- N threads in an application
- To formulate a response the application requires, on average, R requests to later tiers
- Each request to a later tier requires, on average, t seconds to complete
- Let's also assume there is some per-request work the thread must complete within the application that takes, on average, w seconds to complete
Then an RPC-based application can handle N simultaneous client requests, each request taking on average (R·t + w) seconds to complete. An approximate formula for how long the system takes to service X requests is
|
time = |  |
where div is integer division (i.e., without remainder).
But for a message-based application, we can make a couple more assumptions:
- Each thread can send off multiple requests simultaneously. This means the amount of time the thread waits for later tiers is as small as:
- During the time the thread is waiting for other tiers it simultaneously services other requests. All in all, we can assume a single thread services c simultaneous requests, where c => 1.
To service the same X requests, the message-based application requires less time, approximated by this formula:
|
time = |  |
Again, assuming the maximum number of threads per application is more or less constant, the enterprise built with message-based communications services more client requests, faster, compared to the RPC-based equivalent. The messaging concept is thus essential for enterprise scalability.