There are many npm database client but they can't be browserified, some used tcp, some used binaries. so we can't use sqlite, mysql, ... in k6.
please add support for database, or add more support for these npm package
Thanks for opening this issue! We'd like to support database connections - both so that data for the load test could be retrieved from them, but also because we'd like to be able to actually load test databases.
The actual DB connection handling, query execution and measurement (for the load testing) should likely be handled in Go, for performance reasons and because there are nice abstractions and a lot of available drivers (1, 2) that use them. Unfortunately, I can't give an accurate estimation on when we'll get to implementing DB support, since we have quite a lot of other important things in our roadmap. But we'll likely accept quality pull requests for something like this, so if anyone is interested on working on it, feel free to reach out in this issue.
Hi! Any progress on that?
Hi @ayaka209 and @paralectvkomodey,
I've written a very basic plugin for load testing SQL databases, mainly PostgreSQL, MySQL and SQLite: k6-plugin-sql. It can also be used to read data from or insert data into database in setup/teardown functions.
The plugin system is not merged yet, but you can play with it: https://github.com/loadimpact/k6/issues/1353 and https://github.com/loadimpact/k6/pull/1396.
The instructions are available on Build k6 from source (with plugin support PR), though you still need to fix conflicts before being able to use k6 with plugin support on the master branch. Otherwise, you can use the v0.26.2 tag, which I don't recommend.
Also, we'd be happy to hear your feedback.
+1 for moving this forward :-)
Most helpful comment
+1 for moving this forward :-)