views:

390

answers:

5

I have a site which uses AJAX and preloaders. Now I would like to see the impact of these preoloaders before deploying the site online.

The "problem" is that localhost doesn't have loading time and the response is immediate, so that I can't see my preloaders.

How can I simulate loading or limited bandwidth (with Firefox, Rails or whatever else)?

A: 

You can use Firebug plugin to Firefox to determine the network behavior of your page. This works fine for localhost. You should see all images being retrieved simultaneously at the time of the preload execution.

Pascal Lindelauf
I don't know whether you understood my question: I mean, I would like to see the preloader, but a request to localhost only needs ~40 ms (which is not sufficient to me to see it ;) )
collimarco
Sorry collimarco, you're right. It's a bit of another take on the matter. I had a similar situation recently, where I preloaded a slide show. In my case there wasn't a whole lot to see about the preloading: it was necessary to verify the preloading took place as planned using Firebug.
Pascal Lindelauf
A: 

You could configure your router so that it forwards requests on a certain port to the computer you're running the website on. Then, when you open your.ip.add.ress:the_port in your browser, the bottleneck will be your upload speed, which is generally quite low.

But that's just how I would do it ;)

Jongsma
+3  A: 

If on windows, download Fiddler and set it to act like you are on a modem:

Tools-->Performance-->Simulate Modem Speeds

[edit] Since you said you are now on a MAC, you have Charles which has throttling [/edit]

epascarello
I am on a Mac :(
collimarco
Then use Charles: http://www.charlesproxy.com/ - the trial version will run for 30 minutes, but IMHO it's worth buying a license.
NickFitz
I should have mentioned Charles orginally! Charles is not as nice as Fiddler (IMHO), but you can do it with Charles' throttling http://www.charlesproxy.com/documentation/using-charles/throttling/
epascarello
FWIW, you can run Fiddler on ANY Windows machine (even a VM) and simply point the Mac at it. http://www.fiddler2.com/fiddler/help/hookup.asp#Q-NonWindows
EricLaw -MSFT-
+1  A: 

One option would be to deploy the site briefly to the host you will be using for production under an alternate URL for performance testing.

However, the way it performs for you won't necessarily be the same for everyone else in other locations.

If you provide some more detail on what these "preloaders" are and how they work and what you mean by "see the impact" we might be able to give better answers. Do you mean you want to eyeball the AJAX spinner gifs and get a feel for how it will look to the end user as the loading takes place? Or do you mean you want to do some kind of formal benchmarking on them?

Ethan
People like this answer? Please tell me where you work so I can avoid it. Why would someone stick something on a production server to test performance and risk it effecting the site?
epascarello
+1  A: 

I don't have a rails app in front of me right now but why don't you just add a delay to the appropriate controller?

i.e.

def index
    # ...
    sleep 2        # sleeps for 2 seconds
    # ...
end

Alternatively, use a debugger and place a breakpoint in the controller code. This should mean that your preloader will show until execution is continued.

hopeless