Archive for September, 2011

I just run into an issue where one of our servers was totally bogged down when users started to download 100 or more files. See, the problem is that we had to check that each file was downloaded successfully before processing with the rest of the code. In other words;

1) Query for files that need to be downloaded
2) Loop over the records
3) Within loop download the file
4) check if file has been downloaded successfully
5) continue with the code.

In Coldfusion (or CFML to be general) your code would look like:

<cfloop query…>
<cfthread action=”join”…>

As I mentioned above, we need to check if the file has been downloaded successfully before continuing with the next download. That’s why  there is a cfthread in this code.  Now, while this might be a good idea with small download, it has a hazardous effect if you will trigger 1000 downloads, which again would create 1000 threads!!!

So, there are actually 2 things I’ve learned from this:

  1. There is no need for the cfthread. Since cfhttp will halt the code process until the file has been downloaded, creating the thread is not needed.
  2. Creating a thread within the iteration of your resultset (cfloop) is a VERY  bad idea!

Since upgrading to MacOS X 10.7 Lion and its update to 10.7.1, I’ve have had my fan coming on a lot of times. Something I have hardly every experienced with Snow Leopard. It seams that many are also experiencing this issue as the Apple discussion boards prove.

One of the “solutions” that have worked for me is to disable spotlight (I really don’t need it) with the following command (issued in the terminal):

sudo mdutil -a -i off

Another one was to remove any spotlight plugins that applications like Microsoft Office, Parallels, etc. put into your “/Library/Spotlight” folder. This helped big time.

Last but not least, you can also remove any processes that are being launched during startup which might cause a high CPU usage. In my case, I disable a couple of launchdaemons. The command to do so is:

sudo launchctl unload -w /Library/LaunchDaemons/{application}

Say, you want to remove the startup parallels daemon you would do a:

sudo launchctl unload -w /Library/LaunchDaemons/com.parallels.desktop.launchdaemon.plist

Hope this helps anybody out there. After all, there is still hope that Apple finally brings the much needed update that helps fix some issues that came up in MacOS X Lion.