13

How to simulate low bandwidth (network delay) in localhost ( running on wamp, windows XP) ? I was looking to set it on the server-side not on the client-side.

maan81
  • 3,469
  • 8
  • 36
  • 53
  • possible duplicate of: http://stackoverflow.com/questions/1094760/network-tools-that-simulate-slow-network-connection – Dmitry Reznik Mar 26 '12 at 06:00
  • Take a look at my answer to http://stackoverflow.com/questions/9742828/fake-poor-internet/9742918#9742918 If you use Charles Proxy, then you can direct multiple clients to it. Then you can throttle them all to simulate poor bandwidth, as well as see every request that gets sent. – louielouie Mar 26 '12 at 06:14
  • Thanks for both. I was looking for something like configuring WAMP to simulate the delay without having to install anything. Is that possible ? – maan81 Mar 26 '12 at 12:42

2 Answers2

8

You can do this by using a module for Apache called Bandwidth Mod. Even though this version is for Apache 2.2.14, I am using it on 2.2.21 without any problems.

Grab the bw_mod.dll file from the link above, and put it into the Apache modules folder (usually bin\Apache\Apache2.2.xx\modules in your Wampserver installation folder) and then add this to your httpd.conf file:

LoadModule bw_module modules/mod_bw.dll
BandWidthModule On
ForceBandWidthModule On
BandWidth    all 50000
MinBandWidth all -1

Be sure to check out the readme file for this module as it comes with a lot of options.

Hope this helps !

Valentin Flachsel
  • 10,795
  • 10
  • 44
  • 67
1

This is a recipe for Apache 2.2.x on FreeBSD for your own LAN server, meaning you have access to the apache.conf file.

Unfortunately, mod_bw does not work with .htaccess files (yet) so easy and fast testing with various speeds in not possible that way. But here is a workaround that works fine for me.

Install mod_bw on FreeBSD...

# cd /usr/ports/www/mod_bw
# make install clean

Make a speed dir in your document root...

# cd /path/to/doc/root
# mkdir _s

Make symbolic links in that speed dir to the document root...

# cd _s
# ln -s /path/to/doc/root 33k
# ln -s /path/to/doc/root 56k
# ln -s /path/to/doc/root 128k
# ln -s /path/to/doc/root 256k
# ln -s /path/to/doc/root 512k
# ln -s /path/to/doc/root 1024k

Edit /usr/local/etc/apache22/httpd.conf and make these line occur...

LoadModule bw_module libexec/apache22/mod_bw.so

<Directory "/path/to/doc/root">
    Options FollowSymLinks
</Directory>

<directory /path/to/doc/root/_s/33k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 33000
    </ifmodule>
</directory>
<directory /path/to/doc/root/_s/56k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 56000
    </ifmodule>
</directory>
<directory /path/to/doc/root/_s/128k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 128000
    </ifmodule>
</directory>
<directory /path/to/doc/root/_s/256k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 256000
    </ifmodule>
</directory>
<directory /path/to/doc/root/_s/512k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 512000
    </ifmodule>
</directory>
<directory /path/to/doc/root/_s/1024k>
    <ifmodule mod_bw.c>
        BandWidthModule On
        ForceBandWidthModule On
        Bandwidth all 1024000
    </ifmodule>
</directory>

Restart apache...

# apachectl restart

That's it! You can access your LAN website the usual way with LAN speed or with a selected speeds...

E.g.

  • http://serverip/website_name/
  • http://serverip/_s/56k/website_name/

Goodluck!

P.S. Your website need to be designed such that it will always run whether it is located in document root or in any sub directory.

Rbgo Web
  • 136
  • 1
  • 7