简体   繁体   English

如何在jmeter中的隧道上配置PostgreSQL数据库

[英]How to configure PostgreSQL database over the tunnel in jmeter

I am using jmeter to test an application which uses PostgreSQL. 我正在使用jmeter测试使用PostgreSQL的应用程序。 I can connect to the database by using ssh tunnel provided by the database applications. 我可以使用数据库应用程序提供的ssh隧道连接到数据库。 Can someone please tell me how do I do this using jmeter. 有人可以告诉我如何使用jmeter进行此操作。 I do not see any ssh tunnel option in jmeter database connection confi element. 我在jmeter数据库连接confi元素中看不到任何ssh隧道选项。

You could use port forwarding,as explained in this answer: 您可以使用端口转发,如此答案中所述:

  1. I don't think you should be load testing the database directly, your load test should simulate real-life application under test usage . 我不认为您应该直接对数据库进行负载测试, 您的负载测试应该在测试使用情况下模拟真实的应用程序 So instead of testing the database you should focus on the application itself and treat it like a black box so my general recommendation is reconsidering the approach. 因此,与其测试数据库,不如将重点放在应用程序本身上,并像黑盒子一样对待它,因此我的一般建议是重新考虑该方法。

  2. If you have performed normal load testing already and identified that the database is the bottleneck and would like to load test the database separately - performance testing it over the SSH tunnel is not the best idea itself as the SSH tunnel traffic might be the next bottleneck due to the nature of TCP protocol and immense CPU footprint required for encryption/decryption of the data sent over SSH. 如果您已经执行了正常的负载测试,并且确定数据库是瓶颈,并且想单独对数据库进行负载测试, 那么通过SSH隧道进行性能测试并不是最佳方法,因为SSH隧道流量可能是下一个瓶颈TCP协议的性质,以及通过SSH发送/加密数据所需的大量CPU占用空间。 So I would recommend talking to network administrators and asking them to temporarily open the Postgres network port to the machine(s) you're running JMeter from or provide you access to the machine(s) where you can install JMeter which will be having access to the database directly (preferably in the same subnet / physical location, otherwise you might be suffering from high latencies ) 因此,我建议与网络管理员交谈,并请他们暂时打开您正在运行JMeter的计算机的Postgres网络端口,或者为您提供访问可以安装JMeter的计算机的访问权限。直接连接到数据库(最好在同一子网 /物理位置,否则您可能会遇到高延迟

  3. If for any reason the above instructions are not applicable for you - you can use SSH Local Forwarding in order to map remote Postgres port to your local port, the relevant command would be: 如果出于任何原因上述说明均不适用于您-您可以使用SSH本地转发将远程Postgres端口映射到您的本地端口,则相关命令为:

     ssh -L 2345:localhost:5432 username@your_postgresql_server 

    Once done you should be able to connect to Postgres instance as it is installed locally on port 2345 like: 完成后,您应该能够连接到Postgres实例,因为它是本地安装在端口2345例如:

     postgres://localhost:2345/your_database 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM