My domain has three different blogs on it. They are distributed as follows:
Amongst other things, myDomain.com/index.php serves to give the reader a glimpse of what's going on at those blogs -- by listing brief excerpts such as "Most Recent Post at first_blog" (which might include the title of that most recent post, author, when it was posted, etc.).
The code for obtaining this data is similar to the following:
$first_blog_rss = fetch_rss('www.mydomain.com/first_blog/feed/'); ... <?php echo $first_blog_item['title']; ?> <?php echo $first_blog_item['description']; ?>
(As you can see, I'm using the Magpie functionality provided by my WordPress.)
The code works fine -- except that it's *sometimes* really, really slow. Every now and then, the index.php site that executes this code lags badly. I'd say that it takes a minute to load anything at all-- as opposed to the few seconds that it normally requires.
Curiously, the problem is intermittent and appears to happen at random times. Also, when I'm having this problem, the blogs themselves never lag. Also, I've eliminated every other aspect of the index.php page that could be a potential problem -- so there must be something wrong with my code / method of data gathering.
It may also be worth noting that there a roughly a dozen such code snippets on my page (and, of course, that they are gathering feeds from three different blogs).
Could someone please suggest an alternative to my current method or a change in my code? Perhaps this could be accomplished through the use of SQL or an alternative feed reader. Perhaps there is some kind of caching issue going on here. Any ideas?