Re: Handling multiple requests in a queue on FIFO based and process
by ww (Archbishop) on Nov 21, 2013 at 15:41 UTC
|
| [reply] |
|
|
| [reply] |
Re: Handling multiple requests in a queue on FIFO based and process
by BrowserUk (Patriarch) on Nov 21, 2013 at 16:03 UTC
|
I need to handle multiple data requests from different clients and receive them in a queue,
Do the clients run on your local LAN or remotely?
Presumably, FIFO based manner does not necessarily mean using a FIFO; but rather just first-in, first-out?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
Re: Handling multiple requests in a queue on FIFO based and process
by kschwab (Vicar) on Nov 21, 2013 at 16:33 UTC
|
Anyone supplying an answer would be guessing...you haven't really provided much detail.
- Are the clients that submitted the request waiting, on the same socket, for a reply? Or is it fire-and-forget?
- Is the FIFO requirement literal, as in, request #2 blocks until request #1 is fully completed...even if it could be run in parallel? Even if the two requests came from different connected clients?
- How large are the requests (bytes), and response (if there is one)?
- As mentioned in another reply, are the clients on a local LAN or remote? Is cleartext okay? Do the clients need to authenticate?
- Are the clients cell phones? web browsers? Something else?
| [reply] |
|
|
Thanks for the reply.
The clients are pc's and connected to the server pc through a network, the requests are submitted and it is fire-and-forget.
The FIFO requirement is sequential, even if the two request came from different clients. request #2 blocks until request #1 is fully completed.
The request size bytes is in below 1k and no need of response.
The clients are in local LAN, no need to authenticate clients.
The clients are pc,s connected to one server, all request handling will be done on the server side, in a First-in-first-out process.
| [reply] |
|
|
Gearman might work for you. There's a good overview here. It supports the idea of a background job which maps to "fire and forget". On the server side, to meet your FIFO requirement, you would have one worker for this specific task. . You would have to use Storable or similar to coax your hash into a scalar on the client side, and vice-versa on the worker side.
| [reply] |
Re: Handling multiple requests in a queue on FIFO based and process
by Laurent_R (Canon) on Nov 21, 2013 at 18:09 UTC
|
If your requests are stored in hash references, you could easily build yourself a FIFO queue with a simple array of hashrefs, using push to insert a new request and shift to pick up the oldest one (or possibly using pop and unshift). But using existing CPAN modules is probably better.
| [reply] [d/l] [select] |