开发者

Best way for Background processing in PHP based application

I am working on a huge php application with Zend framework, in that project we need to process files and create thumbnail开发者_如何学运维s for images, videos, documents for which we are using imagemagick, ffmpeg, openoffice in background process. To make the process optimized and fast with minimum resources I am thinking of implementing this process using another language may be java or c.

What you people suggest

  1. Stick with PHP
  2. Use Java
  3. Use C


I really would stick with PHP. Here are the Reasons:

  1. No need to learn another language, or if you don't need to:
  2. If you want to hire someone new, he only needs to understand php
  3. You probably can reuse some code written for the app itself.
  4. you only need the php to start and configure things like imagemagick, ooffice and ffmpeg. They are already written in C/C++ and they do the heavy lifting. Your PHP code is just the glue between these programs. What's the matter if you can save some milliseceonds until a ffmpeg process starts when it's running several minutes.

IMHO it's not worth it to use C/C++ to start these processes.


Whatever language you use including PHP, you can use Gearman to initiate and manage the background processes for the heavy lifting.

Your Zend PHP application will create "jobs" and send them to Gearman, who will then dispatch them to "workers" who will perform them and report back, while your application can go on and not block. Said workers can be in a multitude of languages including PHP.


If your processing is using external tools mainly, you can stay on shellscripts.

Then you just run 1-2-4-8 scripts in background which run constantly, fetch & process pieces of work and you are done.

Going C++/java is way longer to implement with very little benefit on this task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜