Hi,
I do somthing like the following code and get an average
time of 0.039s per request.
- Martin
<?php
$dom = new DOMDocument();
$n=10;
$z=microtime(true);
for($i=0;$i<$n;$i++) {
echo $i.' ';
$dom->loadXML(ereg_replace('\&\#([0-8]|1[12456789]|2[0-9]|3[01]);','
',file_get_contents('http://my.domain.com:8080/opensearch?query='.urlencode($_GET["q"]).'&hitsPerSite=10&hitsPerPage=10')));}
echo '<br>Average duration per Nutch request:
'.((microtime(true)-$z)/$n).'s';
# -- print items title
$xp=new DOMXPath($dom);
echo '<br>';
$anz=$xp->query('//rss/channel/opensearch:totalResults');
echo $anz->item(0)->nodeValue;
$items=$xp->query('//rss/channel/item/title');
foreach ($items as $item) {
echo '<br>'.$item->nodeValue;}
?>
[email protected], [EMAIL PROTECTED] schrieb:
> We've built a php frontend onto nutch. We're finding that this
> interface is dreadfully slow and the problem is the interface between
> the two languages.
>
> Here's where the slow down is:
>
> $url = 'http://localhost:8080/opensearch?query=' . $query .
> '&start=' . $start_index .
> '&hitsPerPage=' . HITS_PER_PAGE .
> '&hitsPerSite=' . HITS_PER_SITE .
> '&hitsPerDup=' . HITS_PER_DUP;
> $xml_contents = file_get_contents ($url); <--------this step right
> here is slow.
>
> That above function call in our code can take between 5 to 12 seconds to
> complete.
>
> We tried the same function but called http://127.0.0.1:8080 instead of
> localhost just in case we were having DNS issues. Still slow. We also
> tried using curl instead of file_get_contents, no change. I thought it
> was my server so I bought a new dual xeon/raid0 scsi/8 gigs of ram and
> no change (that was a bit disappointing :) ).
>
> I suspect that something is timing out when we interface between the two
> languages but no idea what. Does anyone have any suggestions on where
> to diagnose next? Has anyone had success in calling tomcat from php
> without delays?
>
> Thanks for any help.
>
> -glenn
>
>
>
--
TU Braunschweig, Institut für Betriebssysteme und Rechnerverbund
Mühlenpfordtstr. 23 Phone: +49 531 391 3155
D-38106 Braunschweig, Germany Fax: +49 531 391 5936
http://www.ibr.cs.tu-bs.de/ Email: [EMAIL PROTECTED]