collimarco
collimarco

Reputation: 35450

Simulate loading on localhost

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)?

Upvotes: 4

Views: 2039

Answers (5)

ideasasylum
ideasasylum

Reputation: 2130

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.

Upvotes: 1

epascarello
epascarello

Reputation: 207527

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]

Upvotes: 3

Ethan
Ethan

Reputation: 60169

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?

Upvotes: 1

Pieter Jongsma
Pieter Jongsma

Reputation: 3373

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 ;)

Upvotes: 0

Pascal Lindelauf
Pascal Lindelauf

Reputation: 4870

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.

Upvotes: 0

Related Questions