Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WebClient client = WebClient.builder()
.baseUrl("http://" + args[0])
.build();
Flux
.generate(AtomicLong::new, (state, sink) -> {
long i = state.getAndIncrement();
sink.next(i);
return state;
})
.limitRate(1)
.flatMap(n -> client.get().uri("/MYENDPOINT").exchange())
.doOnNext(resp -> {
if (resp.statusCode().is2xxSuccessful())
counter.increment();
})
.blockLast();
@DarrenForsythe

This comment has been minimized.

Copy link

@DarrenForsythe DarrenForsythe commented Oct 28, 2019

Are you aware of any tools that have something on their backlog to move to non blocking Impls? I was wondering about the real world differences after having just setup a new jmeter test

@jkschneider

This comment has been minimized.

Copy link
Owner Author

@jkschneider jkschneider commented Oct 28, 2019

@DarrenForsythe No, I'm not aware of any. At this point, I find it pretty simple to just run little main methods like the above for this kind of testing. Spring's WebClient is already instrumented with Micrometer, so you can just ship metrics from the load test to a monitoring system of your choice and plot the results there. Might just be enough abstraction now that a dedicated tool isn't really necessary anymore.

@DarrenForsythe

This comment has been minimized.

Copy link

@DarrenForsythe DarrenForsythe commented Oct 28, 2019

Agreed, I think I wasted more time on the JMeter setup that I could have done programmatically. Mostly around client cred requests.

If only I wasn't using AppD, would like to help on that but think its out of my depth to contribute to the impl of that.

@jkschneider

This comment has been minimized.

Copy link
Owner Author

@jkschneider jkschneider commented Oct 29, 2019

@DarrenForsythe I like to think you don't need to make one and only one monitoring system choice inside an org, especially if you can convince those around you to stand up an OSS product for limited use like this while still using the expensive vendor option for production cases for as long as that is justifiable.

@tircis

This comment has been minimized.

Copy link

@tircis tircis commented Oct 29, 2019

Hi, you may be interested in https://gatling.io/ instead of JMeter for a more complete product than a simple main program

@slandelle

This comment has been minimized.

Copy link

@slandelle slandelle commented Jan 9, 2020

Disclaimer: Gatling author here

Hi,

  • indeed, Gatling uses a non blocking architecture, not a one-thread-per-virtual-user one + blocking IO.
  • what you're doing is only realistic wrt server to server traffic where you share one global connection pool and SSLContext. If you want to simulate web traffic realistically, each virtual user must have its own connections and SSLSessions.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment