java - How to implement this Queue in a Jboss cluster? -
My application works as an intermediate object, receiving requests from customers, then changing it into some arguments and the other Send a Changed Request to General HTTP Request or Webservice Soap Request as Service Provider
We say that my application is A, Service Provider is s.
Now I have been informed that there will be several (3-5) times every year under two zebus servers (in the cluster) behind a balance, each time the run time will last for about 4 hours. I can get a program about the time below.
During the downtime, changing A and requesting S.'s request should not be sent anymore, but get requests in the queue. After returning S, the queued requests should be processed.
Note:
-
Received requests should be processed in exactly the same order as they did. One-by-one process to process a request means sending a sent request to S., and receiving the success or error of the response. Usually it will not take much time.
-
Based on 1, when A is working on queued requests, new incoming requests should be encrypted, though S is already available. Unless the queue is vacant, it may continue to send AS to S.
-
In each minute, 2-3 requests are received.
Since we have two labels, I was planning to maintain this line in the database, manage queue threads and downtime status. However, synchronization between two jabos always makes me a headache.
Soon, the problems I had met:
-
To set the flag of the time below, so that requests request instead of sending two papers . (I thought the solution, before processing each request, was set by the query database. Flags thread for this flag, this could be a poor solution.)
- < P> After returning to s, how to design the dequeue operation of two jboss (it seems that, at the same time always a weasel is useless ...)
-
How to notify two pockets, "Now the queue is empty, do not do any now."
Logic little Til. I hope I explained my problem clearly ...
Do you have any thoughts on that?
There is more details about FIFA if there is no downtime, then one can process those requests in parallel with different customers. Since this 'transaction choice' order has been ensured by the customers, for example.
Client X: -Send http: // \ / createUser ... -exassed http: //../... Success was obtained from updateUser ...- if the API ( ) If unsuccessful, the update user is not the sender. Client y: -Service http: // CreateCompany ...
Given that another client (y) remained to make the request With the Thakampani X, x.create user can process these two requests simultaneously by A in parallel.
While thinking about downtime and queue:
- http: // // send the cooker user .. (downtime) - Received 'enque' (s) Is back) - Send http: //../ updateUser ...
Now the order "Create-> Update" is required
Kent
Itemprop = "text">
Have you got any approval from S Has any specific request received properly? (If not, you should consider applying it to reduce your chances of making your app even more robust and losing requests due to network problems, server crashes, etc.)
This type of acceptance system can be extended with an algorithm, after using a deadline to send an application to an ACK on time. To wit. If the ACK is not received within a configured timeout interval, then the request has been declined again. Next time a big time ends, eg. 2 * t, then 4 * t etc. As long as the original request is not accepted, the incoming new requests are queued. After the actual request is successfully sent, the queued requests are processed in the FIFO command. If the queue is empty, normal processing will resume.
This algorithm will automatically process s shed downtime as well as some other network failures, and will be at the expense of some more resources and network traffic. But with 2-3 requests per minute, it should not be a concern (unless the individual request is huge, not at all).
Of course, it can also be improved from time to time to configuring the default timeout. To wit. For the duration of scheduled downtime of 4 hours, the default timeout can be set up to 4 hours. After the downtime is over, timeout is reset to the default value.
Comments
Post a Comment