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

Add production checklist about maxNumEventLoopsPerEndpoint #5297

Merged
merged 5 commits into from Jan 16, 2024

Conversation

0x1306e6d
Copy link
Contributor

Motivation:

Using maxNumEventLoopsPerEndpoint and maxNumEventLoopsPerHttp1Endpoint with the default value (1) may be a bottleneck when a client sends lots of requests to a small number of servers because an Endpoint uses a single event loop.

Modifications:

  • Add a production checklist about maxNumEventLoopsPerEndpoint and maxNumEventLoopsPerHttp1Endpoint.

Result:

  • Users would recognize the bottleneck problem earlier.

@@ -96,3 +96,20 @@ See [Using CircuitBreaker with non-Armeria client](/docs/client-circuit-breaker#
ClientBuilder cb = Clients.builder(...);
cb.factory(cf);
```

- Increase `maxNumEventLoopsPerEndpoint` and `maxNumEventLoopsPerHttp1Endpoint` when your clients send requests
Copy link
Contributor

Choose a reason for hiding this comment

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

How about explaining the effect of increasing the number of event loops?

Suggested change
- Increase `maxNumEventLoopsPerEndpoint` and `maxNumEventLoopsPerHttp1Endpoint` when your clients send requests
- Increase `<type://ClientFactoryBuilder.maxNumEventLoopsPerEndpoint(int)>` and
`<type://ClientFactoryBuilder.maxNumEventLoopsPerHttp1Endpoint(int)>` when a client
needs to send a large number of requests to a specific endpoint. The client will
assign more CPU resources and create more connections by increasing the number of
event loops.

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

Thanks @ghkim3221 ! 🙇 👍 🙇

import com.linecorp.armeria.client.ClientFactory;
import com.linecorp.armeria.client.ClientFactoryBuilder;

ClientFactoryBuilder cfb = new ClientFactoryBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

The default constructor isn't public (optionally it would be great if the other examples in this page are updated)

Suggested change
ClientFactoryBuilder cfb = new ClientFactoryBuilder();
ClientFactoryBuilder cfb = ClientFactory.builder();

Comment on lines 100 to 101
- Increase `maxNumEventLoopsPerEndpoint` and `maxNumEventLoopsPerHttp1Endpoint` when your clients send requests
to a small number of servers. As an Endpoint uses a single event loop, there may be a bottleneck.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • What do you think of adding Consider since performance may not always be better.
  • What do you think of conveying why there is a bottleneck?
Suggested change
- Increase `maxNumEventLoopsPerEndpoint` and `maxNumEventLoopsPerHttp1Endpoint` when your clients send requests
to a small number of servers. As an Endpoint uses a single event loop, there may be a bottleneck.
- Consider increasing `maxNumEventLoopsPerEndpoint` and `maxNumEventLoopsPerHttp1Endpoint` for better request throughput. Doing so may increase performance at the cost of opening more connections.

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw this comment late #5297 (comment) .
I think using this comment is fine, but still I think adding "Consider" is a good idea

@jrhee17 jrhee17 added this to the 1.27.0 milestone Nov 14, 2023
@0x1306e6d
Copy link
Contributor Author

Thank you so much @ikhoon and @jrhee17 !!!

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Thanks a lot, @ghkim3221!

site/src/pages/docs/advanced-production-checklist.mdx Outdated Show resolved Hide resolved
site/src/pages/docs/advanced-production-checklist.mdx Outdated Show resolved Hide resolved
0x1306e6d and others added 2 commits November 23, 2023 17:53
Co-authored-by: minux <songmw725@gmail.com>
Co-authored-by: minux <songmw725@gmail.com>
@0x1306e6d
Copy link
Contributor Author

Thank you @minwoox!

Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Thanks!

@ikhoon ikhoon merged commit 20827c0 into line:main Jan 16, 2024
13 checks passed
eottabom pushed a commit to eottabom/armeria that referenced this pull request Jan 18, 2024
Motivation:

Using `maxNumEventLoopsPerEndpoint` and
`maxNumEventLoopsPerHttp1Endpoint` with the default value (1) may be a
bottleneck when a client sends lots of requests to a small number of
servers because an `Endpoint` uses a single event loop.

Modifications:

- Add a production checklist about `maxNumEventLoopsPerEndpoint` and
`maxNumEventLoopsPerHttp1Endpoint`.

Result:

- Users would recognize the bottleneck problem earlier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants