Skip to content

Conversation

@MirahImage
Copy link
Member

Summary Of Changes

Deploys perf-test and stream-perf-test as Kubernetes Jobs, rather than running pods directly.

Additional Context

This is designed to make clean-up easier.

@mkuratczyk
Copy link
Contributor

For me, the plugin stopped working with these changes:

$ kubectl rabbitmq create foo
error: Unexpected args: []
See 'kubectl apply -h' for help and examples

# after deploying an instance with a version from main
$ kubectl rabbitmq perf-test foo
error: the server doesn't have a resource type ""

@MirahImage MirahImage force-pushed the k-rmq-perf-test-improvements branch from 874e875 to e61807b Compare December 20, 2021 10:27
@MirahImage MirahImage marked this pull request as ready for review December 20, 2021 10:47
Copy link
Member

@Zerpet Zerpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me :shipit:

@coro
Copy link
Contributor

coro commented Jan 11, 2022

A couple questions from me:

What's the expected method of sourcing prometheus metrics from perf test in this case? Previously there was a service created - do you get the same output from scraping the pods directly?

Can we also hide the output from the pushd/popd as well?
New output:

$ ./bin/kubectl-rabbitmq perf-test billing --rate 100
/var/folders/gm/mgfz1ccs4t7_tbh12qfkprxm0000gp/T/tmp.11LqVZJN ~/GolandProjects/cluster-operator
job.batch/perf-test created
~/GolandProjects/cluster-operator

compared with old:

$ k rabbitmq perf-test billing --rate 100
service/perf-test created
pod/perf-test created

The perf-test command works fine, but the stream one doesn't out of the box. I've checked on different versions of RMQ - it seems the one on main doesn't hit this issue, but this branch does:

k logs stream-perf-test-zpwfd
java.lang.IllegalArgumentException: Wrong scheme in rabbitmq-stream URI: stream. Should be rabbitmq-stream or rabbitmq-stream+tls
	at com.rabbitmq.stream.impl.StreamEnvironmentBuilder.toUri(StreamEnvironmentBuilder.java:74)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at com.rabbitmq.stream.impl.StreamEnvironmentBuilder.uris(StreamEnvironmentBuilder.java:98)
	at com.rabbitmq.stream.impl.StreamEnvironmentBuilder.uris(StreamEnvironmentBuilder.java:44)
	at com.rabbitmq.stream.perf.StreamPerfTest.call(StreamPerfTest.java:546)
	at com.rabbitmq.stream.perf.StreamPerfTest.call(StreamPerfTest.java:86)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.executeHelpRequest(CommandLine.java:1929)
	at picocli.CommandLine.executeHelpRequest(CommandLine.java:1909)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2176)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at com.rabbitmq.stream.perf.StreamPerfTest.run(StreamPerfTest.java:382)
	at com.rabbitmq.stream.perf.StreamPerfTest.main(StreamPerfTest.java:362)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)

using cluster-operator 1.10.0, example rmq:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: billing
spec:
  replicas: 3
  image: rabbitmq:3.9-management
  rabbitmq:
    additionalPlugins:
    - rabbitmq_stream

Otherwise works well for me, and I like the change, thanks!

@MirahImage
Copy link
Member Author

What's the expected method of sourcing prometheus metrics from perf test in this case? Previously there was a service created - do you get the same output from scraping the pods directly?

Unfortunately, creating a service would defeat the purpose of using a Job, namely, allowing the perf-test command to clean up after itself. Thankfully, it's possible to monitor the job using a podMonitor instead of a serviceMonitor, so I have updated the instructions with the relevant podMonitor.

Copy link
Contributor

@coro coro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be a pain; the stream perf test command now works but the pushd/popd output is still shown, and the echo statements are now also shown:

$ ./bin/kubectl-rabbitmq perf-test billing --rate 100
/var/folders/gm/mgfz1ccs4t7_tbh12qfkprxm0000gp/T/tmp.lzJyhNZe ~/GolandProjects/cluster-operator
+ echo 'apiVersion: batch/v1'
+ echo 'kind: Job'
+ echo metadata:
+ echo '  name: perf-test'
+ echo '  labels:'
...

@MirahImage
Copy link
Member Author

MirahImage commented Jan 13, 2022

I've removed the output, at the cost of more technically incorrect bash. Unfortunately, it seems that due to the nature of kubectl plugins, it's not possible to hide pushd/popd output, so we're forced to use cd, which should generally be avoided in scripts.

@MirahImage MirahImage requested a review from coro January 13, 2022 13:14
Correct stream URI.

Hide pushd/popd from output.

Change serviceMonitor to podMonitor to allow prometheus scraping.

Update tests to clean up perf-test job.

Switch to bad bash to reduce output.
@MirahImage MirahImage force-pushed the k-rmq-perf-test-improvements branch from 824ba86 to a792589 Compare January 13, 2022 13:35
@MirahImage MirahImage merged commit c8393c8 into main Jan 13, 2022
@MirahImage MirahImage deleted the k-rmq-perf-test-improvements branch January 13, 2022 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants