how to configure python in jmeter

65 views Asked by At

i have created a python code to display data in the database, I want to test and see the value of Throughput, Latency, Resource utilization and Error Rate of the code using the jmeter application.

but in JSR223 Sampler there is no python or jython language selection option

how do I make the python or jython language option appear in jmeter, because I have downloaded and installed the jython.jar file in the lib but there is still no option for that choice

1

There are 1 answers

1
Dmitri T On
  1. Using JMeter for testing performance of a piece of a Python code is not the best idea because JMeter is a pure Java application and Python support can be added via Jython interpreter so you will be measuring JMeter's possibility to run Jython code, not your code performance itself
  2. Jython supports only Python 2 which support has ended 3 years ago. Are you sure your code is fully compatible and can be used by both interpreters?
  3. Each time JMeter encounters a JSR223 test element with Jython it creates an instance of Jython interpreter which is resource consuming and not efficient. If you want to load test the database itself it's better to consider using JDBC Request sampler. If JDBC Request sampler is not powerful enough consider using Groovy language, Groovy scripts can be compiled and cached providing performance close to native code. See Beanshell vs. JSR223 vs. Java For JMeter: Complete Showdown article for more information.

If despite above points you still want to add Python support to JMeter:

  1. Make sure to choose Jython Standalone version, not the "Installer" or whatever. Current direct link is https://repo1.maven.org/maven2/org/python/jython-standalone/2.7.3/jython-standalone-2.7.3.jar
  2. Drop the .jar file to "lib" folder of your JMeter installation (or appropriate place in JMeter Classpath)
  3. Restart JMeter to pick up the .jar

enter image description here