RE: [ACFUG Discuss] Using caching and threading to load a page quickly

2014-09-29 Thread Charlie Arehart
Some more thoughts…

You could also track the time at which you got it, and then on the page where 
it’s shown, you could add a flag of some sort if the date is older than the 2 
minutes, if knowing that may be important to your users.

Another thing is that rather than rely on CFcache to cache things, you can be 
more explicit (and help better manage the cache) by using CF9+’s new caching 
functions. So you could check the time, decide whether to retrieve from the 
cache or not, and if so then store it anew in the cache. There are then other 
caching functions that would let you look at what was cached, to manage things 
(which may help you address the concerns Troy had). Those can be used whether 
the cache was written to via cfcache or the newer caching functions.

Finally, whether you go with either the idea to store the result in a file 
(Troy’s idea) or a variable or table (Cam’s idea) or the cache, there’s still 
something else you may want to consider, Chris, if you’re not familiar with it. 
You could either store the RSS feed or go ahead and write the formatted HTML 
into wherever you’d be persisting things, using CFSAVECONTENT. Just would allow 
you then to refer to that result quickly in your page where you’d “show” it 
finally. Some may debate if that’s confusing our “view” and your “model”. I’ll 
leave others to debate that if they want.  Just wanted you to know it was an 
option if it may help.

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Cameron Childress
Sent: Monday, September 29, 2014 10:27 AM
To: discussion@acfug.org; Chris
Subject: Re: [ACFUG Discuss] Using caching and threading to load a page quickly

 

I'd load the RSS feed via a scheduled task and save it someplace like the 
application scope or a database table. Don't make your homepage do any of that 
work. 

 

-Cameron

 

 



Re: [ACFUG Discuss] Using caching and threading to load a page quickly

2014-09-29 Thread Cameron Childress
I'd load the RSS feed via a scheduled task and save it someplace like the
application scope or a database table. Don't make your homepage do any of
that work.

-Cameron

On Mon, Sep 29, 2014 at 1:34 AM, Chris  wrote:

> Hi All,
>
> I have a main index page which is in ColdFusion which gets a RSS feed from
> another website(Newswebsite which is a WordPress 3.9.2 website running on
> shared hosting). The Newswebsite is on shared hosting so takes about 7
> seconds to load(a little slow, I know, but the decision to go with a shared
> hosting was done to save on costs by the purchasing people).
>
> Now, people don't want the main index page to take 7 seconds to load. I
> estimate using caching of the RSS feed so that updates are retrieved from
> the feed only every 2 minutes and having a thread so that the main index
> page loads(in 2 seconds or less) without waiting for the RSS feed can
> alleviate the issue. The thread which fetches the data from RSS feed can
> display the feeds on the main index page after the data is retrieved.
>
> 1. If the idea is on the right track, would something like the below work?
>
>
> -
>
> The full implementation is at http://collabedit.com/dgraj/history
>
> 
>
>
> 
>
> 
>
>
> 
>
>
>
> 
>
> 2. Are there other better ways to tackle the issue?
>
> I want the other parts of the main index page which is in ColdFusion to
> load quickly and not get delayed because getting data from the RSS feed of
> news website takes 7 seconds.
>
> Any suggestions would be appreciated.
>
> Thanks
>
> P.S. I used ColdFusion code and Yahoo e-mail did not allow me to send it.
> I heard Yahoo Mail flags messages containing code as spam so does not allow
> such messages. So, just had to explain it in text and provide a link to
> Collabedit.
>



-- 
Cameron Childress
--
p:   678.637.5072
im: cameroncf
facebook  | twitter
 | google+



RE: [ACFUG Discuss] Using caching and threading to load a page quickly

2014-09-29 Thread troy
Chris,

I recently did a similar project (albeit not with Wordpress) where I imported a 
XML feed from another website into a ColdFusion powered site. What I found out, 
at least for the project I was doing, was that writing the file to my machine 
and using that for my output was significantly more manageable than trying to 
manage cache. This was especially true when having to debug something that came 
from the imported data. While I'm sure that Wordpress's RSS feed is stable, the 
main thing is that you're getting content from a source that you do not have 
direct control over and this can create some issues outside of what you're 
already experiencing.

I think your idea is solid, I'd just simply think about writing the import to a 
file for use by your application. I do have one other small recommendation. If 
you are planning to update every two minutes, I'd recommend setting the timeout 
on your  to something below 120 (ideally below 100) as it seems to me 
that you could be creating collision or recursion with the current value of 180.

Just my two cents.

Thank you,

Troy Jones
Technical Manager
Third Wave Digital
1841 Hardeman Ave.
Macon, GA 31201
t...@thirdwavedigital.com
www.thirdwavedigital.com

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Chris
Sent: Monday, September 29, 2014 1:35 AM
To: discussion@acfug.org
Subject: [ACFUG Discuss] Using caching and threading to load a page quickly

Hi All,

I have a main index page which is in ColdFusion which gets a RSS feed from 
another website(Newswebsite which is a WordPress 3.9.2 website running on 
shared hosting). The Newswebsite is on shared hosting so takes about 7 seconds 
to load(a little slow, I know, but the decision to go with a shared hosting was 
done to save on costs by the purchasing people).

Now, people don't want the main index page to take 7 seconds to load. I 
estimate using caching of the RSS feed so that updates are retrieved from the 
feed only every 2 minutes and having a thread so that the main index page 
loads(in 2 seconds or less) without waiting for the RSS feed can alleviate the 
issue. The thread which fetches the data from RSS feed can display the feeds on 
the main index page after the data is retrieved.

1. If the idea is on the right track, would something like the below work?

-

The full implementation is at http://collabedit.com/dgraj/history














2. Are there other better ways to tackle the issue?

I want the other parts of the main index page which is in ColdFusion to load 
quickly and not get delayed because getting data from the RSS feed of news 
website takes 7 seconds.

Any suggestions would be appreciated.

Thanks

P.S. I used ColdFusion code and Yahoo e-mail did not allow me to send it. I 
heard Yahoo Mail flags messages containing code as spam so does not allow such 
messages. So, just had to explain it in text and provide a link to Collabedit.