Re: Fast queue logic
by dws (Chancellor) on Dec 06, 2002 at 10:20 UTC
|
What is the best approach to setup a queue with maximum accepting speed like INSERTS and maximum processing speed like in using files?
The fastest way is to write a queue management service which keeps the queue entries in memory. Clients access the service via socket. That makes polling quick, but isn't particularly fault-tolerant. You need to persist the queue at some point. I'd start off with files, and see if that's good enough.
| [reply] |
Re: Fast queue logic
by Zaxo (Archbishop) on Dec 06, 2002 at 10:40 UTC
|
You need to flesh out your requirements a bit. You list 100-200 'files/sec', bur I don't see where those files come from. Are they requested by name, or is their content part of the request? Are these all new connections, or just a few busy clients? What protocol is this?
That is a pretty rapid request rate. You will need to handle several requests per timeslice on linux, and that is only considering CPU usage. Typically, I/O rate is the limiting factor in client/server applications.
How much hardware can you throw at this? How much do you have now? Your data rate can be met by dedicated apache servers, is that what you want?
After Compline, Zaxo
| [reply] |
|
|
Time for some more explanation:
Clients connect using TCP. The request from clients are now stored in files for processing, that is why I said 100-200 files/sec. This is currently the fasted rate at which request can be stored. This I would like to improve by using a database with INSERTS, which is considerably faster. But to process these queued requests (either in files or database), the filesystem is much faster again. So I need to find the best of both worlds, actually.
If you need more information, I will be happy to give you it.
Regards,
Marcel
| [reply] |
|
|
| [reply] |
|
|
|
|
Re: Fast queue logic
by perrin (Chancellor) on Dec 06, 2002 at 15:51 UTC
|
You think that moving from flat files to a relational database will make adding things faster? Flat files are nearly always faster than a database for this kind of simple operation. If files seem to be going too slowly for you, you should profile your code to see if there's something taking up the time. There are also a number of nodes on this site that talk about speeding up file access. | [reply] |
Re: Fast queue logic
by PodMaster (Abbot) on Dec 06, 2002 at 10:18 UTC
|
| [reply] |
Re: Fast queue logic
by rcaputo (Chaplain) on Dec 10, 2002 at 17:37 UTC
|
You can't beat a named pipe (FIFO) for speed, but there are two
requirements:
- Your queue items must be relatively small (usually less than 512 bytes).
- Your queue reader and writer processes must all be on the same machine.
-- Rocco Caputo - troc@pobox.com - poe.perl.org
| [reply] |