Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: bandwidth consumption #551

Closed
myrinx opened this issue Feb 23, 2017 · 4 comments
Closed

request: bandwidth consumption #551

myrinx opened this issue Feb 23, 2017 · 4 comments

Comments

@myrinx
Copy link

myrinx commented Feb 23, 2017

Hi,

Locust is great for testing, it would be even more awesome if there is a way (graphically) to see what the consumed bandwidth (per sec) is.

Is there a way to implement this quickly? As the number of requests per second and the content size is known, i assume the bandwidth is also traceable? This especially is convenient when master-slave configurations are used.

Thanks!

@cgoldberg
Copy link
Member

using reqs/sec and content size to calculate bandwidth would not include overhead from the headers at several layers of network transfer, so it won't be a real accurate measure of bandwidth used. It's also not a trivial change :)
I think this type of metric is better handled by measuring with network monitoring tools.

@myrinx
Copy link
Author

myrinx commented Feb 23, 2017 via email

@cgoldberg
Copy link
Member

otherwise you'd have to make another
tool that traces bandwidth used on a nic.

but lots of such tools exist.

maybe I can find something trivial like a library which does it

check out psutil: https://github.com/giampaolo/psutil

It's a popular library for gathering system and process stats. It's also cross-platform, which is probably the most difficult part of implementing this to intregrate with Locust. You would need to retrieve network i/o stats for a given nic (or all nics) at specified intervals, and then do calculations to get bits/sec for each interval (and probably aggregate stats for the entire run).

You can get at the data easily with the net_io_counters() function from psutil: https://pythonhosted.org/psutil/#psutil.net_io_counters

There is an example included that has most of it done for you:
https://github.com/giampaolo/psutil/blob/master/scripts/nettop.py

just remember that these stats are system-wide, not per process. (but maybe that's what you are after anyways).

hope that helps..

@myrinx
Copy link
Author

myrinx commented Feb 23, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants