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

Simulating real browser behaviour #120

Closed
krychu opened this issue Dec 22, 2013 · 6 comments
Closed

Simulating real browser behaviour #120

krychu opened this issue Dec 22, 2013 · 6 comments
Labels

Comments

@krychu
Copy link

krychu commented Dec 22, 2013

Hey,

A real browser will download not only the content of the page but also all js scripts, css, images etc. I was wondering how this is supported in locust. All those extra resources can easily amount for most of the web traffic but also server's ability to handle simultaneous users. It seems to me, however, that locust's (or requests') get gets only the main content. Is this the case? If so, how accurate are the locust measures when predicting real-life performance of your setup?

Thanks,

@heyman
Copy link
Member

heyman commented Dec 22, 2013

Hi!

Scaling up the serving of static files is very simple compared to scaling up a dynamic website. Also, high traffic websites often use some kind of CDN for static files. If not a CDN, a load balancer with a couple of nginx machines should be able to handle A LOT of traffic.

Locust focuses on simulating the traffic from dynamic requests. You could make Locust load static files by parsing responses and then issuing new calls to client.get(), but since the serving of static content should be totally separated from dynamic requests, I would recommend to have a separate load test that tests static files.

@heyman heyman closed this as completed Dec 22, 2013
@krychu
Copy link
Author

krychu commented Dec 22, 2013

Hey,

Techniques of scaling up the serving of static files or dynamic components have nothing to do with the task of load testing. More, some of the linked resources in HTML might require computation on the server side so could be considered dynamic. More, serving static content will consume CPU and bandwidth which can have significant effect on the server's efficiency in relation to dynamic content, so it would appear that you can't simply focus on dynamic parts without considering static parts. Also, resources such as CDN or a couple of nginx machines don't come for free so their availability should not be taken by granted. I think these are some strong assumptions you make about how people should build their apps or what they can afford.

Perhaps this is something you will want to consider. It would be fantastic to see such functionality in locust. Thanks for taking time to respond, I appreciate it.

@mthurlin
Copy link

More, some of the linked resources in HTML might require computation on the server side so could be considered dynamic

Then you should write locust tasks for them.

There are a multitude of other tools that are suitable for loadtesting static content, and you can run them at the same time as you run a locust test. The strength of Locust is to fetch dynamic content and act on the response.

However, using BeautifulSoup to fetch all images/css/js from every HTML-response in your Locust test and download those should be fairly trivial to implement yourself.

@ghost
Copy link

ghost commented Aug 26, 2017

@mthurlin We also want to load test something that will be hit by real browsers, so we need this functionality too. I just researched on this, and it would require implementing all a, img, link and other tags that can potentially reference things that a browser would download. While it isn't hard to do, it is certainly quite a bit of work and not something that can be done in 5 minutes and it's also easy to miss something. Most advice places like stackoverflow recommend simply using selenium instead, but of course that has probably way too much overhead for use in a load test.

Therefore, this seems to be a real gap of locust and I recommend reopening this ticket and reconsidering putting something in like this eventually, even if it's just a beautifulsoup script as some sort of contrib resource which people can reuse.

@ReallyNotARussianSpy
Copy link

This page has a lot of helpful info for doing this and more
https://tag1consulting.com/blog/drupal-loadtest-locust

@mektebi
Copy link

mektebi commented Dec 3, 2019

Hi all,

Any update?

@heyman heyman added the wontfix label Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants