Reputation: 113976
For multiple running PHP scripts (10 to 100) to communicate, what is the least memory intensive solution?
Other techniques I have heard of, but never tried:
Upvotes: 0
Views: 566
Reputation: 449435
In general, a shared memory based solution is going to be the fastest and have the least overhead in most cases. If you can use it, do it.
Message Queues I don't know much about, but when the choice is between databases and flat files, I would opt for a database because of concurrency issues.
A file you have to lock to add a line to it, possibly causing other scripts to fail to write their messages.
In a database based solution, you can work with one record for each message. The record would contain a unique ID, the recipient, and the message. The recipient script can easily poll for new messages, and after reading, quickly and safely remove the record in question.
Upvotes: 2
Reputation: 340241
This is hard to answer without knowing:
And so on...
Using a DB is probably easiest to setup in a PHP environment and, depending on how many queries per minute and the type of those queries, that might indeed be the sanest solution. Personally I'd try that first and then see if it's not enough.
But, again, hard to tell for sure without more information on the application.
Upvotes: 2