13

Can you suggest how to create a test environment to simulate various types of bandwidths and traffic in a web app?

Or maybe an open source program which does this against localhost?

I think this is a very important subject when programming web apps but it is not a usual topic, the only way i can imagine to create such kind of environment is to use some kind of proxy in a local network but before start looking into the squid documentation i would like to hear your suggestions.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
paranoio
  • 349
  • 6
  • 13

13 Answers13

7

if you're using apache you may want to take a look at apache ab

Owen
  • 82,995
  • 21
  • 120
  • 115
4

There are two approaches to shape network traffic to simulate a network link:

  1. Run some software on the client or server that sits somewhere in the networking stack and shapes the traffic between the app and the network interface
  2. Run the traffic shaping software on a dedicated machine with 2 network interfaces through which your traffic is routed

(2) is a better solution if you don't want to install software on the client or server (and possibly impact performance), but requires more hardware fiddling.

Some other features you might want to think about are what shaping parameters can be simulated. Most do delay and packet loss, some do jitter and bandwidth limiting as well. Some solutions can selectively filter traffic (for instance by port number, TCP or UDP etc).

Here is a list of some of the systems I've found:

Open Source or Freeware

DummyNet is an open source BSD Unix-based for dedicated devices. It is not clear if the software is being actively maintained

NistNet is an open source Linux-based system for dedicated devices. The software has not been actively maintained for several years.

Commercial

Apposite Technoligies sell dedicated hardware solutions for simulating WAN links, with a Web based GUI for configuring the settings and collecting traffic measurements

East Coast DataCom sell hardware dedicated simulators for simulating routers and modems

Itrinegy offer both dedicated device solutions, and solutions for running on clients or servers.

Network FX offer several dedicated device products for simulating network impairments between the client & server

NetLimiter is a client side system that allows throttling of individual applications, and includes a firewall.

Shunra Software offer a range of products, from high end enterprise WAN simulation and testing, to a simple client-resident emulator.

rupello
  • 8,361
  • 2
  • 37
  • 34
3

The closest I can think of is doing something similar with VEDekstop from Shunra..

Simulating High Latency and Low Bandwidth in Testing of Database Applications

Shunra VE Desktop Standard is a Windows-based client software solution that simulates a wide area network link so that you can test applications under a variety of current and potential network conditions – directly from your desktop.

Gulzar Nazim
  • 51,744
  • 26
  • 128
  • 170
1

I wrote a php script awhile back which used CURL to run a sequence of page requests against my server which represented a typical use scenario. I had it output the times that it took for the server to respond to each of the requests. I then had another script which spawned a bunch of these test case scripts simultaneously for a sustained period and correlated the results into a file which I could then look at in a spreadsheet to see average times. This way I could simulate the number of users hitting the site that I wanted. The limitations are that you need to run the test script on a different server to the web server and that the client machine can become too loaded to give meaningful results past a certain point. I've since left the job otherwise I would paste the scripts here.

Matthew Smith
  • 6,165
  • 6
  • 34
  • 35
1

If you are running a Linux box as your server, Linux box as your client, or have the capability to put (perhaps a VM) a Linux router between your client and server, you can use NetEm.

NetEm is a Linux TC (Traffic Control) discipline which can delay (i.e. add latency) packets leaving a host. Although it's tricky to set up clever rules (e.g. add latency to some traffic, not to others), it's easy to add a simple "delay everything leaving the interface by 50ms" type rules and some recipes are provided.

By sticking a Linux VM between your client and server, you can simulate as much latency as you like. And you can turn it on and off dynamically. Linux has other TC disciplines which can be combined with NetEm to restrict bandwidth (but the script to set this up can be somewhat complicated). NetEm can also randomly drop packets.

I use it and it works a treat :)

MarkR
  • 62,604
  • 14
  • 116
  • 151
1

I haven't used it for years (lack of need, not because I'd found anything else), but xat webspeed would be the first thing I would point toward

Assembler
  • 794
  • 1
  • 8
  • 24
1

As other people have mentioned, Apache's ab (comes with Apache, so you probably have it already) is good.

Other good options are:

I personally like ab and JMeter the best.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
sammich
  • 335
  • 5
  • 13
  • 19
1

Web Application Stress Tool (WAST) from Microsoft is what you need.

http://www.microsoft.com/downloads/details.aspx?familyid=e2c0585a-062a-439e-a67d-75a89aa36495&displaylang=en

devXen
  • 3,013
  • 3
  • 35
  • 44
0

We use Loadrunner to do bandwidth and traffic simulation in our App. Loadrunner is can start agents on various machines and you can simulate one machine as running on dialup modem v/s another on DSL v/s another on Cable internet. We also use Loadrunner to simulate various kinds of traffic conditions from 10 user run to 500 user run. We can also insert think times in the script and simulate a real user executing the http request. The best part is that it comes with a recording studio where it will plug in with Internet explorer and you can record the whole scenario/Usecase that can be as simple as hitting one page to a full blown 50-60 page script or more.

Kalpesh Patel
  • 323
  • 3
  • 13
0

i found this little java program that works great : sloppy

yet not a proffesional solution but it works for simple tests, i guess it uses java streams and buffers to slow down the connection .

paranoio
  • 349
  • 6
  • 13
0

Have you looked at Tsung? It's a great utility for seeing if your website will scale in event of attack, I mean massive popularity. We use it for our web frontend, and our internal systems too.

Sargun Dhillon
  • 1,788
  • 2
  • 18
  • 24
0

If you're interested in performing your tests out of your browser, there is also a really great Firefox plug-in.

picardo
  • 24,530
  • 33
  • 104
  • 151
0

Do not forget about Wanulator (http://www.wanulator.de/). The name Wanulator comes from "WAN" and "simulator. This pretty much describes what the software does: It simulates different Internet conditions such as delay or packet loss. Furthermore it simulates user access line speeds e.g. modem, ISDN or ADSL. Wanulator is currently packaged as a Linux boot CD based on SLAX. This will give you a full out of the box experience. You can turn any PC into a test-system within a blink - just by booting the Wanulator CD. The package already includes useful client SW such as web-browser and network sniffer (Wireshark). Nevertheless if the PC has 2 network interfaces the system can run as an intermediate system between your server and your client - as a switch - without any configuration hassles.

Maksim
  • 1