smithmicro / jmeter-ecs

JMeter Docker Image for Distributed Testing on EC2 Container Service (ECS)
Apache License 2.0
43 stars 34 forks source link

How can I add plugins to jmeter? #19

Closed Kostanos closed 6 years ago

dsperling commented 6 years ago

Version 1.4 plugins are added to the standard Docker image here.

No Plugin testing has occurred, so I will be interested in your feedback.

Kostanos commented 6 years ago

what do you think to add plugins manager? https://jmeter-plugins.org/wiki/PluginsManagerAutomated/ with this one, everyone can add extra CMDs on each minion and install plugins that needed?

dsperling commented 6 years ago

I was not aware of this project and is certainly the way to go. Adding the manager is trivial. This is the necessary lines for the Dockerfile:

# install JMeter Plugins Manager
RUN cd $JMETER_HOME/lib \
  && curl -O http://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/2.0/cmdrunner-2.0.jar \
  && cd $JMETER_HOME/lib/ext \
  && curl -O http://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/0.19/jmeter-plugins-manager-0.19.jar \
  && java -cp jmeter-plugins-manager-0.19.jar org.jmeterplugins.repository.PluginManagerCMDInstaller

The question is how we run PluginsManagerCMD.sh.

Do the exact same plugins need to be installed on Gru on the Minions? If the plugins only need to be installed in Gru, then we can use the following in entrypoint.sh for Gru.

PluginsManagerCMD.sh install-for-jmx $1

However if they need to be installed on both, then we should do something like this for both Gru and Minions, where the user would pass --env JMETER_PLUGINS=jpgc-fifo,jpgc-json=2.2:

PluginsManagerCMD.sh install $JMETER_PLUGINS

Thoughts?

dsperling commented 6 years ago

Neve mind my previous question. The best way to support plugins is to use the Plugins Manager and then install all plugins into the Docker image. This only adds 45MB to the image size.

You can test the new JMeter image with ALL plugins using: --env JMETER_VERSION=feature-19

dsperling commented 6 years ago

Take a look at branch feature-19 for the preliminary code changes. I am still testing. https://github.com/smithmicro/jmeter-ecs/tree/feature-19

Here is a test plan using the UDP plugin: demo-plugin.jmx.zip

dsperling commented 6 years ago

I have run into a problem with dependencies in my tests of the UDP plugin. I posted a question over in the JMeter Plugins forum: https://groups.google.com/forum/#!topic/jmeter-plugins/xR17sUgkZgA

Kostanos commented 6 years ago

@dsperling did you pushed the feature-19 updates to docker hub? I run: docker run -ti smithmicro/jmeter:3.3 sh And I only see this on plugins folder:

/opt/lib/ext # ls
CMDRunner.jar                 JMeterPlugins-ExtrasLibs.jar  TestPlanCheck.bat
FilterResults.bat             JMeterPlugins-Standard.jar    TestPlanCheck.sh
FilterResults.sh              JMeterPluginsCMD.bat
JMeterPlugins-Extras.jar      JMeterPluginsCMD.sh

or I'm checking in a wrong place?

It is only 3.3 can be run on ECS, as 4.0 is still has error.

dsperling commented 6 years ago

I just figured out what is going wrong. PluginsManagerCMD.sh install-all-except actually does not work as expected. For some reason, running it twice works around the issue. See my comments at: https://groups.google.com/forum/#!topic/jmeter-plugins/xR17sUgkZgA

I will get an updated image pushed soon to smithmicro/jmeter:feature-19

Give me a few minutes.

dsperling commented 6 years ago

OK, try a docker pull smithmicro/jmeter:feature-19

Kostanos commented 6 years ago

that one works, thank you!

dsperling commented 6 years ago

Excellent. Once I get a formal answer from the JMeter Plugin team, I will wrap this up and merge to master. I'm curious, which plugins are you exercising?

Kostanos commented 6 years ago

my partner actually now is looking for the better way to dynamically add plugins, as adding all plugins will not resolve the issue in case if someone needs to use custom made plugin which is not published.

answering your question, we currently need 2 plugins: random CSV - and Thread Group.

dsperling commented 6 years ago

2 ways that I can see:

  1. Dockerfile

    FROM smithmicro/jmeter:4.0
    COPY myplugin.jar /opt/apache-jmeter-4.0/lib/ext/

    and to create:

    docker build -t jmeter-with-plugin:latest .

    This would require a push to your own public registry. It would also require modifications to Lucy where you could tell here which public namespace to use: --env JMETER_IMAGE=jmeter-with-plugin:latest

  2. curl inside entrypoint.sh

    if [ $CUSTOM_PLUGIN_URL != '' ]; then
    curl -O $CUSTOM_PLUGIN_URL
    CUSTOM_PLUGIN_FILE="${CUSTOM_PLUGIN_URL##*/}"
    mv $CUSTOM_PLUGIN_FILE /opt/apache-jmeter-4.0/lib/ext/
    fi

    Much simpler and would be happy to add this if this meets your requirements.

Kostanos commented 6 years ago

Second solution is perfect, that's

On Mon, Mar 19, 2018, 4:18 PM Dave Sperling notifications@github.com wrote:

2 ways that I can see:

  1. Dockerfile

FROM smithmicro/jmeter:4.0 COPY myplugin.jar /opt/apache-jmeter-4.0/lib/ext/

and to create:

docker build -t jmeter-with-plugin:latest .

This would require a push to your own public registry. It would also require modifications to Lucy where you could tell here which public namespace to use: --env JMETER_IMAGE=jmeter-with-plugin:latest

  1. curl inside entrypoint.sh

if [ $CUSTOM_PLUGIN_URL != '' ]; then curl -O $CUSTOM_PLUGIN_URL CUSTOM_PLUGIN_FILE="${CUSTOM_PLUGIN_URL##*/}" mv $CUSTOM_PLUGIN_FILE /opt/apache-jmeter-4.0/lib/ext/ fi

Much simpler and would be happy to add this if this meets your requirements.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smithmicro/jmeter-ecs/issues/19#issuecomment-374358213, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFYPstmdoHfGXngmOtqSf81LL4j8G31ks5tgBKFgaJpZM4SuBUq .

dsperling commented 6 years ago

I have it coded but I can only partially test it as I don't have a custom plugin. Use both: docker run ... smithmicro/lucy:feature-19.2 and

--env JMETER_VERSION=feature-19.2
--env CUSTOM_PLUGIN_URL=http://...

Changes were required in both images. I am using feature-19.2 to ensure your AWS cluster pulls a new image.

dsperling commented 6 years ago

I have a formal response from JMeter Plugins Manager team that the most reliable way to install all plugins is the following, since hadoop and oauth plugins are no longer maintained:

PluginsManagerCMD.sh install-all-except jpgc-hadoop jpgc-oauth

I am ready to push these changes to master but would like you feedback on CUSTOM_PLUGIN_URL before I do so.

undera commented 6 years ago

PluginsManagerCMD.sh install-all-except jpgc-hadoop,jpgc-oauth is the right command

dsperling commented 6 years ago

Thanks. I see that this correct command now fixed two warnings I was seeing during install:

16:14:56.521 [main] WARN  org.jmeterplugins.repository.Plugin - Unable to load class: com.atlantbh.jmeter.plugins.oauth.OAuthSampler
java.lang.NoClassDefFoundError: org/apache/jmeter/protocol/http/sampler/HTTPSampler2
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_151]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_151]
...
Caused by: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.sampler.HTTPSampler2
...
2018-03-21 16:14:56,521 WARN o.j.r.Plugin: Unable to load class: com.atlantbh.jmeter.plugins.oauth.OAuthSampler
java.lang.NoClassDefFoundError: org/apache/jmeter/protocol/http/sampler/HTTPSampler2
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_151]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_151]
...
Caused by: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.sampler.HTTPSampler2
...
Kostanos commented 6 years ago

Why don't we just leave the optional way to add plugins with env variable, without adding all?

On Wed, Mar 21, 2018, 12:52 PM Dave Sperling notifications@github.com wrote:

Thanks. I see that this correct command now fixed two warnings I was seeing during install:

16:14:56.521 [main] WARN org.jmeterplugins.repository.Plugin - Unable to load class: com.atlantbh.jmeter.plugins.oauth.OAuthSampler java.lang.NoClassDefFoundError: org/apache/jmeter/protocol/http/sampler/HTTPSampler2 at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_151] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_151] ... Caused by: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.sampler.HTTPSampler2 ... 2018-03-21 16:14:56,521 WARN o.j.r.Plugin: Unable to load class: com.atlantbh.jmeter.plugins.oauth.OAuthSampler java.lang.NoClassDefFoundError: org/apache/jmeter/protocol/http/sampler/HTTPSampler2 at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_151] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_151] ... Caused by: java.lang.ClassNotFoundException: org.apache.jmeter.protocol.http.sampler.HTTPSampler2 ...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smithmicro/jmeter-ecs/issues/19#issuecomment-375015046, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFYPiPQixENAICa9EDhGiHhAANPn5mTks5tgoVLgaJpZM4SuBUq .

dsperling commented 6 years ago

Great question. I started down that road using PluginsManagerCMD.sh install $JMETER_PLUGINS within the Lucy script before running the minion JMeter task.

What I found was that:

  1. Testing with a large number of minions, say 100, causes 100 containers to install the plugin creating unnecessary bandwidth usage and delay in the tests
  2. Running the test again will require another download of another 100 plugins
  3. Without pre-packaging plugins, there might be unnecessary project forks for developers to install their own plugins to work around 1 and 2.
  4. With plugins installed and a new user attempts to use jmeter-ecs, it will just work.
  5. By adding all plugins to the Docker image does add ~40MB to the image size, but assuming a cluster is re-used (with --env RETAIN_CLUSTER=true), the Docker image is only downloaded once to the EC2 instances and can be used for repeated tests.

Based on this, creating a monolithic Docker image will all popular plugins installed seems to solve the problem. And with your help today, all warnings have been resolved.

Another option is to have two Docker images:

But since we have 5 different Docker images for various versions, this would double our image management tasks.

dsperling commented 6 years ago

Fixed in v2.3