Hi,

On Wed, Oct 28, 2020 at 11:36 AM Oleg Astakhov <[email protected]> wrote:
>
> Hello,
> I know about this mail: 
> https://www.eclipse.org/lists/jetty-users/msg09182.html
>
> But I feel the need to continue this discussion because I have zero load, 
> just me on localhost and I see rate limiter (anti DOS) in effect. To my 
> understanding, I must _only_ see it when server is under considerable load 
> from one connection, which is not the case.
>
> Just couple of days ago I switched to Embedded Jetty and enabled HTTP/2. 
> While testing all this on localhost, not only I get these exceptions in the 
> logs, but they also affect web application - HTTP requests are dropped and 
> static resources are never fetched. It happens very randomly and often.
> So, main exception is (example):
>
> (HttpChannel.java:596) - handleException /images/social-buttons/share.png 
> java.io.IOException: enhance_your_calm_error/invalid_priority_frame_rate
>
> Chrome Developer Tools Status column says:
>
> (failed)net::ERR_HTTP2_PROTOCOL_ERROR
>
> Sometimes they occur both and sometimes I get the (failed) in Chrome Dev 
> Tools but I see no exception in logs.
>
> I use:
> Spring Boot 2.3.4 and from the dependencies I see that Jetty 9.4.31 is in 
> use. My relevant Gradle part:
>
>     implementation 'org.springframework.boot:spring-boot-starter-jetty'
>     implementation 'org.eclipse.jetty:jetty-alpn-conscrypt-server'
>     implementation 'org.eclipse.jetty.http2:http2-server'
>
> No other Jetty-specific configurations are made. Just these common server 
> properties:
>
> server.http2.enabled=true
> server.compression.enabled=true
> server.compression.min-response-size=1024
>
> plus server.ssl.* configuration.
>
> So, I am writing this to clarify/ask several things:
>
> 1) Since that initial question was asked a year ago, today that default is 
> still 20 events per second, that means the team behind Jetty thinks that this 
> is a reasonable default. But at the same time, I don't think that I should 
> see HTTP requests dropped with this limit being the only user on localhost 
> without any load. So, something is not quite right, please clarify.
>

20 events per seconds should be more than enough for normal usage.
However, if you have more than 20 resources that are requested at the
same time, and each one of them carries a PRIORITY frame, you can
encounter this problem.
This may happen in load testing or with large pages with many
dependent resources.
Is this your case?

> 2) A lot of settings in Jetty are in INI file, including this configuration 
> jetty.http2.rateControl.maxEventsPerSecond
> but I am using Embedded Jetty, I don't have access to INI. I've searched 
> everywhere on how to set it but found nothing. Common Spring server-prefixed 
> properties do not expose it. Jetty prefixed properties do not expose it. 
> Setters on HttpConfiguration, ServerConnector, etc. do not exist. By digging 
> Jetty source code, I know I can manually create implementation of 
> AbstractHTTP2ServerConnectionFactory, but I'd rather not, because it's not 
> transparent how to do it properly. I'd rather rely on standardized setters or 
> app properties.
> My current solution is find currently existing connection factory and set 
> (override) rate control factory, something like this (simplified code):
>
> AbstractHTTP2ServerConnectionFactory http2ServerConnectionFactory = 
> (server.getConnectors()[0]).getConnectionFactories()
>                 .stream()
>                 .filter(it -> it instanceof 
> AbstractHTTP2ServerConnectionFactory)
>                 .map(it -> (AbstractHTTP2ServerConnectionFactory)it)
>                 .findFirst().get();
> http2ServerConnectionFactory.setRateControlFactory(new 
> WindowRateControl.Factory(40));

Unfortunately Spring Boot is hiding too much of Jetty, so Jetty fine
tuning is also hidden by Spring Boot -- nothing we can do about.
Embedded Jetty is supposed to be used via API, and it's Spring Boot
that adds properties (although only some of them).
The code above is a good workaround.

> as you can see I set 40 instead of 20, and I don't create new connection 
> factory, but rather look up the existing one, since it's the one which is 
> configured with a value of 20.
> After I did this change, I saw no exceptions, but I only tested it several 
> times. I just do not think it is normal that such configuration needs to be 
> made out of the box. Either 20 is a too small value, or I am missing 
> something. But I am observing this behavior with just a single page load, and 
> not all resources get downloaded.
>
> I'd appreciate it very much if you guided me here. I would like to stay with 
> Jetty but this bothers me, as it will affect customers immediately.

If you can easily reproduce this issue, please enable DEBUG logging
and report the logs (e.g. in an issue).
We may be convinced to increase the default if there is evidence that
a normal page can cause this problem.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to