Paralel Process In PHP

October 17, 2006 | PHP

In my own experience, paralelizing process in PHP is alot efficient. Not saving your time, but it will save memory usage.

I use paralel method when working with several task at once. For example, fetching several RSS feeds. Let’s give it a try.

Sample case, we must fetch data from 5 (five) rss feeds.

// call this run.php
$feeds = array(
"http://feeds.com/feed1.xml",
"http://feeds.com/feed2.xml",
"http://feeds.com/feed3.xml",
"http://feeds.com/feed4.xml",
"http://feeds.com/feed5.xml"
);

foreach($feeds as $feed){
exec("php.exe fetcher.php?url=$feed");
}
?>

Well, that’s jus’t a simple illustration. Not so good, I think :P

I’ve written more complex task using paralel method for my web crawler and it works as beast!

No comment

This post has no comments, you can be the first!

 

Leave a comment

Allowed tags are: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>