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

Does locust support DB connection? #383

Closed
carlosmmelo opened this issue Feb 9, 2016 · 8 comments
Closed

Does locust support DB connection? #383

carlosmmelo opened this issue Feb 9, 2016 · 8 comments

Comments

@carlosmmelo
Copy link

I'm new to locust, I've been using jmeter for API and DB (using JDBC) load tests. However it seems locust just support API load test (by using HttpLocust module).

Is there any way for me to connect directly into a DB (say postgresql for example) and run my tests against that db? without using an API (ODBC)

@mthurlin
Copy link

Yes, you can write a custom client class that uses whatever protocol you want:
http://docs.locust.io/en/latest/testing-other-systems.html

@MochiXu
Copy link

MochiXu commented Oct 14, 2022

I have modified my code based on this introduction, But the aggregate report keeps showing 0, and there are no charts from result
image

@cyberw
Copy link
Collaborator

cyberw commented Oct 14, 2022

Where is your client implementation? You need to override methods in your client (or use getattr as shown in the example) so that they call self.env.events.request.fire(...) after each request.

@cyberw
Copy link
Collaborator

cyberw commented Oct 14, 2022

@pinchukov98
Copy link

@MochiXu hi, tell me, did you manage to connect to the database?

@cyberw
Copy link
Collaborator

cyberw commented Aug 29, 2024

There's now an example User class for Postgres: https://github.com/locustio/locust/blob/master/locust/contrib/postgres.py

Here's a locustfile that shows how to use it: https://github.com/locustio/locust/blob/master/examples/postgres/locustfile.py

@pinchukov98
Copy link

@cyberw Can you find out what the error is here, the connection to the Mssql database is not being made? I just hid the user data for now
Mssql2

@pinchukov98
Copy link

@cyberw and how to import locust.contrib.postgres ?

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

6 participants