3

I am using jmeter to test an application which uses PostgreSQL. I can connect to the database by using ssh tunnel provided by the database applications. Can someone please tell me how do I do this using jmeter. I do not see any ssh tunnel option in jmeter database connection confi element.

Sonali
  • 51
  • 5

2 Answers2

0

You could use port forwarding,as explained in this answer:

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
0
  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. 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)

  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 -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://localhost:2345/your_database
    
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I am not load testing database, I just need to check for a value after I run all my load test. I tried #3 but I see ssh: connect to host username@your_postgresql_server port 22: Operation timed out. Can you please suggest why this might be happening and how to fix this. – Sonali Jan 28 '19 at 17:43