forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Broker][Proxy][Function worker] Fix backpressure handling in Jetty w…
…eb server configuration (apache#14353) * [Broker] Improve Jetty configuration to handle backpressure - Fix maxConcurrentHttpRequests by using QoSFilter to limit concurrent requests - previous solution didn't limit concurrent http requests - Replace previous hardcoded connection limit of 10000 http connections with configurable setting - use Jetty's built-in connection limit instead of PulsarServerConnector's custom solution - Rate limiting should happen in the beginning of the filter chain - Let Jetty tune selectors and acceptors based on number of cores - JETTY_AVAILABLE_PROCESSORS=n environment variable can be used to override the number of cores reported by the OS - This is useful when CPU limit isn't set on k8s and the number of cores is the number of total cores available on the k8s node - use can also use -XX:ActiveProcessorCount=n to make Java's Runtime.getRuntime().availableProcessors() return n - Make accept queue capacity configurable - Make thread pool queue capacity bounded and make it configurable * [Functions] Add http backpressure handling for Functions worker's http server
- Loading branch information
Showing
16 changed files
with
307 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/Filters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pulsar.broker.web; | ||
|
||
import java.util.EnumSet; | ||
import java.util.Map; | ||
import javax.servlet.DispatcherType; | ||
import javax.servlet.Filter; | ||
import org.eclipse.jetty.servlet.FilterHolder; | ||
import org.eclipse.jetty.servlet.ServletContextHandler; | ||
|
||
public class Filters { | ||
private static final String MATCH_ALL = "/*"; | ||
|
||
/** | ||
* Adds a filter instance to the servlet context handler. | ||
* The filter will be used for all requests. | ||
* | ||
* @param context servlet context handler instance | ||
* @param filter filter instance | ||
*/ | ||
public static void addFilter(ServletContextHandler context, Filter filter) { | ||
addFilterHolder(context, new FilterHolder(filter)); | ||
} | ||
|
||
private static void addFilterHolder(ServletContextHandler context, FilterHolder filter) { | ||
context.addFilter(filter, | ||
MATCH_ALL, EnumSet.allOf(DispatcherType.class)); | ||
} | ||
|
||
/** | ||
* Adds a filter to the servlet context handler which gets instantiated and configured when the server starts. | ||
* | ||
* @param context servlet context handler instance | ||
* @param filter filter class | ||
* @param initParams initialization parameters used for configuring the filter instance | ||
*/ | ||
public static void addFilterClass(ServletContextHandler context, Class<? extends Filter> filter, | ||
Map<String, String> initParams) { | ||
FilterHolder holder = new FilterHolder(filter); | ||
holder.setInitParameters(initParams); | ||
addFilterHolder(context, holder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 0 additions & 67 deletions
67
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarServerConnector.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.