Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup test executions & Save the planet #23564

Merged
merged 1 commit into from
Feb 11, 2022
Merged

Conversation

Sanne
Copy link
Member

@Sanne Sanne commented Feb 9, 2022

.. and it's also very helpful when debugging locally to only have a couple threads rather than having to scroll through hundreds.

@Sanne Sanne added the kind/enhancement New feature or request label Feb 9, 2022
@Sanne Sanne requested a review from stuartwdouglas February 9, 2022 21:16
if (httpConfiguration.ioThreads.isPresent()) {
ioThreads = Math.min(httpConfiguration.ioThreads.getAsInt(), eventLoopCount);
} else if (launchMode.isDevOrTest()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you want to do this in dev-mode as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, why not?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because it's pretty significant difference between dev mode and prod mode

Copy link
Member Author

Choose a reason for hiding this comment

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

I realize I might be missing something, but I don't expect people to perform load tests in dev mode.

On the other hand, it keeps resource usage under control when running interactive exploration sessions, possibly having multiple Quarkus based microservices running.

Other than performance aspects, I don't think it would have semantic changes that impact developer's ability to explore things?

( other than facilitating debugging by not having breakpoints hit by 100 threads )

But yeah sure I get that it's debatable, no rush. That's also why I pinged Stuart too, so at least he's aware.

We can totally start doing it for tests only.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I understand the rationale completely. It's always a delicate balance...

I am not totally against doing this in dev-mode, I guess I am +0 :)

@stuartwdouglas
Copy link
Member

This does bother me a bit, as it means the test environment is fundamentally different to the prod environment. There are some tests where this could make a difference, e.g. stress based tests such as https://github.com/stuartwdouglas/quarkus/blob/01bee6969efe374d4489d35189c65f34106cea87/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stress/SuspendResumeStressTest.java#L63 may perform differently with only 2 threads.

I don't know if this is a good enough reason not to merge this though.

@Sanne
Copy link
Member Author

Sanne commented Feb 10, 2022

If it bothers too much I can close it.

But I don't think stresstests are commonly run this way? When they do they could set the httpConfiguration.ioThreads to an high number. It would actually help to harden such test to have more ioThreads than 2xCores so it seems a win-win to me.

(My patch is ineffective if the number of iothreads is configured explicitly)

as it means the test environment is fundamentally different to the prod environment.

prod is always going to be fundamentally different than "test" in such details, as we literally run code differently. And also this number of threads which I'm limiting depends on the executing machine, there's good chances that test boxes can't guarantee having the same number of cores as production and staging boxes, so I hope we're prepared for minor differences here.

Just to put things in context, my machine has 24 cores. With HT that's reporting 48, which vertx duplicates further. So I'm spinning 96 threads each time a hello world endpoint needs to be tested with a single request... and the same pattern likely applies to each of you and CI building Quarkus each time.

Copy link
Member

@stuartwdouglas stuartwdouglas left a comment

Choose a reason for hiding this comment

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

Ok, I think this is definitely ok for tests. I am not 100% convinced for dev mode, but maybe we can just merge it and see if it causes problems? You can always work around it by explicitly setting the number of cores so it won't block anyone.

@famod
Copy link
Member

famod commented Feb 11, 2022

I was thinking about logging something in dev mode when this new block is reached. But in the end it would probably be just noise for most people. 🤔

@Sanne
Copy link
Member Author

Sanne commented Feb 11, 2022

Cool, thanks. I'm also curious to see if it makes any difference to CI builds :)

@Sanne Sanne merged commit dbf92d5 into quarkusio:main Feb 11, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Feb 11, 2022
@Sanne Sanne deleted the LimitCpuUsage branch February 11, 2022 00:02
@famod
Copy link
Member

famod commented Feb 11, 2022

CI has only two cores, but let's see. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertx kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants