Skin Spider : Max Size Data Storage Rules

Posted October 7, 2006 at 1:29 PM

Tags: ColdFusion, Skin Spider

To learn all about Skin Spider, click here.

To view the most updated application, click here.

To view the current code base, click here.

As I have been working on this application and testing and letting it run in the background, I am quickly becoming aware that one mega byte files add up very quickly. On my local server, after letting the spider run for about 20 or 30 minutes, I had almost one GIG or videos stored. Granted, this was a large number of videos, but it made me realize that something had to be done; the spider could not be allowed to run unconditionally.

To remedy this, I have updated the application initialization process in the ColdFusion Application.cfm file to set a value for max storage size (APPLICATION.MaxStorageSize). This is the number of bytes that the application is allowed to store before spidering of new content is shut down. I have defined the size interms of math so that it can be easily manipulated:

 Launch code in new window » Download code as text file »

  • <!--- Set size limit to 800 mega bytes. --->
  • <cfset APPLICATION.MaxStorageSize = (1024 * 1024 * 800) />

This will make editing the max file size easy for anyone who does not know byte sizes.

Then, if you look on the spider.cfm, spider_gallery_links.cfm, spider_gallery.cfm, and spider_video.cfm pages, I am putting in a CFDirectory tag and an ArraySum() size check on the video storage directory. If the current size of the directory is greater than or equal to the max size allowed by the application, spidering is prevented. Additionally, I have put a special note on the home page, home.cfm, but there is nothing to "shut down" there.

I am not checking the size of the XML documents or the thumbnails. I figure these are such an insignificant means of hard drive space usage when compared to the videos themselves. If there is any concern, the max size of the application can always be lowered to accommodate thinking about all resources.

You will also notice that on the spider.cfm page, I am dealing with the max file size inline. Meaning, if the user has exceeded the file size usage, I tell them directly on that page, inline to the existing content. On other pages, however, such as the spider_gallery_links.cfm, spider_gallery.cfm, and spider_video.cfm, you will see that I am just performing a check and potentially forwarding the user onto another page. I just don't want those pages to get any more complicated then they have to. To keep all that checking inline on those pages would require the use of more IF statements and would make the page unnecessarily long.

As far as the pop-up spidering pages go (those mentioned above), they just forward onto a new page, spider_size_warning.cfm, whose only job is to display the size warning message. This makes everything easy and keeps the page logic as small as possible.

Now, we are, of course, violating the DRY principle. DRY stands for Do not Repeat Yourself. In this case, we are repeating ourselves on several page. This is something that will mostly likely be addressed in Phase II when we do general refactoring of the application.

I have also made some minor CSS modifications for display on the search page. Nothing big.

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page



Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

Reader Comments

Oct 8, 2006 at 11:00 AM // reply »
3 Comments

Just ran across this by accident and want you to know that I appreciate you posting all the code iteration by iteration.

I'm learning several things by studying your code as you improve/add to it.

Your code viewer is very cool.

Bruce


Oct 8, 2006 at 11:10 AM // reply »
6,516 Comments

Bruce,

I am glad you are finding the code posting useful. That is the objective that I am trying to accomplish. If you can think of anyway that I can make the whole process easier to understand or follow, please let me know.

One think that I will start doing that I just have not gotten around to is providing a ZIP file of all the code for the project. I appreciate you like the code viewer, but I also know that things are just easier to view on your local system. So, that should be up and running sometime this week.

Always glad to help and am dying for feedback on the project.

Thanks.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 21, 2009 at 6:47 PM
Hal Helms - Real World Object Oriented Development, Sarasota - Day Five
@charlie griefer, Thank you.. ... read »
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »
Nov 21, 2009 at 10:56 AM
HostMySite.com Has The Best ColdFusion Hosting
@Mehul, Yes very nice people, however several downtimes per day which was not acceptable. Hence we had to move out. I am glad you are having good luck with them so far. ... read »