0

I am handling a project which contain message queue concept. Now the project is in PHP, and it's making more delay in message sending or mail sending. So I suggest to develop a message queue in Perl or Python script. Could you please suggest which is best either PHP or Perl or Python?

Tom Zych
  • 13,329
  • 9
  • 36
  • 53
Chandru
  • 67
  • 3
  • 5

3 Answers3

6

A possible solution could be to use Gearman as a queue :

  • Your PHP project would send messages to Gearman, as background jobs ; and finish
  • Gearman would dispatch those messages to workers
  • Workers will deal with the jobs -- doing the stuff that might take time

One additional advantage : the day you need several servers to handle a larger amount of jobs, you'll already have what's needed : Gearman will deal with load-balancing for you.

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
2

PHP is perfectly adequate to implement a simple message queue. So, if your current code is causing delays then it is because of your design, not because of some limitation with PHP. Switching to a different language isn't going to help you. Bad code is bad code regardless of language.

The best thing you can probably do is going with an existing message queue. Pascal recommended Gearman. I have worked with (and quite liked) Beanstalkd. If you need a metric ton of features, have a look at ApacheMQ or RabbitMQ.

That said, if you insist on implementing your own message queue, I would suggest sticking with PHP. That way you can re-use code from your existing application (e.g. re-use your models and database API for example).

Sander Marechal
  • 22,978
  • 13
  • 65
  • 96
1

Here are two alternative for gearman

a. Beanstalkd b. MemcacheQ

MemcacheQ http://memcachedb.org/memcacheq/
Adding and fetching from queue needs to be done manually using code. Its not like you send it to queue and MemcacheQ will execute it one by one. but its very very fast.

Beanstalkd http://kr.github.com/beanstalkd/download.html
It supports many languages.

Rahul Prasad
  • 8,074
  • 8
  • 43
  • 49