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

WIP: Benchmark Jetty 12 & 11 #2782

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d81843
Prep for Java 21
iamsanjay Aug 22, 2024
1cd918b
merge conflicts
iamsanjay Oct 18, 2024
e357537
merge conflicts
iamsanjay Oct 18, 2024
e6859da
Changing Java version for workflows
iamsanjay Aug 30, 2024
1be027e
Adding suppress warning
iamsanjay Aug 30, 2024
a23be0d
Removed explicit cast of HttpClient to AutoClosable
iamsanjay Aug 30, 2024
e3af3ae
FloatingPointLiteralPrecision from errorProne task
iamsanjay Aug 30, 2024
e2a666d
merge conflicts
iamsanjay Oct 18, 2024
cc96a91
merge conflicts
iamsanjay Oct 18, 2024
fb26967
change java version for docker
iamsanjay Oct 10, 2024
24fb33c
gradle toolchain configured
iamsanjay Oct 11, 2024
58576c7
revert toolchain
iamsanjay Oct 11, 2024
4bb25de
set source and target at package level
iamsanjay Oct 15, 2024
46445cb
change documentation to reflect JDK 21
iamsanjay Oct 17, 2024
c2888ad
tidy
iamsanjay Oct 17, 2024
d95ce4d
suppress warnings
iamsanjay Oct 17, 2024
ea75378
remove old garbage collector ref
iamsanjay Oct 18, 2024
268a008
added changes.txt
iamsanjay Oct 18, 2024
3ba76ce
Jetty 11 upgrade
iamsanjay Oct 19, 2024
b1af232
Jetty 12 stuff not wokring
iamsanjay Oct 20, 2024
c5a6ce7
Updated doc and removed vm arg UseBiasedLocking
iamsanjay Oct 21, 2024
eaeedad
Merge branch 'main' into Java_Solr21
iamsanjay Oct 21, 2024
e485ba5
Jetty Upgrade
iamsanjay Oct 22, 2024
5e45809
Updated doc and removed vm arg UseBiasedLocking
iamsanjay Oct 21, 2024
c22e082
resolve conflict
iamsanjay Oct 22, 2024
c33c412
Merge main
iamsanjay Oct 24, 2024
2749f51
tidy
iamsanjay Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/bin-solr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
steps:
# Setup
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 21
java-package: jdk
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
steps:
# Setup
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 21
java-package: jdk
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
name: gradle check w/ Java 11
name: gradle check

runs-on: ubuntu-latest

Expand All @@ -19,11 +19,11 @@ jobs:
# Setup
- uses: actions/checkout@v4

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 21
java-package: jdk

- name: Setup Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/solrj-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
steps:
# Setup
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 21
java-package: jdk
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
5 changes: 3 additions & 2 deletions build-tools/scriptDepVersions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

ext {
scriptDepVersions = [
"min-java-version": "11",
"min-java-version": "21",
"min-solrj-java-version" : "17",
"apache-rat": "0.15",
"commons-codec": "1.16.0",
"ecj": "3.33.0",
"ecj": "3.36.0",
"javacc": "7.0.12",
"jgit": "6.7.0.202309050840-r",
"flexmark": "0.64.8",
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ apply from: file('build-tools/scriptDepVersions.gradle')

// Declare default Java versions for the entire project and for SolrJ separately
rootProject.ext.minJavaVersionDefault = JavaVersion.toVersion(scriptDepVersions['min-java-version'])
rootProject.ext.minJavaVersionSolrJ = JavaVersion.toVersion(scriptDepVersions['min-java-version'])
rootProject.ext.minJavaVersionSolrJ = JavaVersion.toVersion(scriptDepVersions['min-solrj-java-version'])

apply from: file('gradle/globals.gradle')

Expand Down
2 changes: 2 additions & 0 deletions crave.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Solr:
image: "accupara/openjdk:21"
4 changes: 2 additions & 2 deletions dev-docs/solr-source-code.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Building Solr from Source

Download the Java 11 JDK (Java Development Kit) or later.
Download the Java 21 JDK (Java Development Kit) or later.
We recommend the OpenJDK distribution Eclipse Temurin available from https://adoptium.net/.
You will need the JDK installed, and the $JAVA_HOME/bin (Windows: %JAVA_HOME%\bin) folder included on your command path.
To test this, issue a "java -version" command from your shell (command prompt) and verify that the Java version is 11 or later.
To test this, issue a "java -version" command from your shell (command prompt) and verify that the Java version is 21 or later.
See the xref:jvms.adoc[JVM developer doc] for more information on Gradle and JVMs.

Clone the latest Apache Solr source code directly from the Git repository: <https://solr.apache.org/community.html#version-control>.
Expand Down
1 change: 1 addition & 0 deletions gradle/globals.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,6 @@ allprojects {
// Assign different java version for client-side modules 'api' and 'solrj*'
var isSolrJ = project.name.matches("^(solrj.*|api)\$")
minJavaVersion = isSolrJ ? rootProject.minJavaVersionSolrJ : rootProject.minJavaVersionDefault
minJavaTestVersion = rootProject.minJavaVersionDefault
}
}
37 changes: 16 additions & 21 deletions gradle/java/javac.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@

allprojects {
plugins.withType(JavaPlugin) {
sourceCompatibility = project.minJavaVersion
targetCompatibility = project.minJavaVersion

// Use 'release' flag instead of 'source' and 'target'
tasks.withType(JavaCompile) {
options.compilerArgs += ["--release", project.minJavaVersion.toString()]
}

// Use 'release' flag instead of 'source' and 'target'
tasks.withType(JavaCompile) {
compileTestJava {
sourceCompatibility = project.minJavaTestVersion
targetCompatibility = project.minJavaTestVersion
options.compilerArgs += ["--release", project.minJavaTestVersion.toString()]
}
compileJava {
sourceCompatibility = project.minJavaVersion
targetCompatibility = project.minJavaVersion
options.compilerArgs += ["--release", project.minJavaVersion.toString()]
}
}
// Configure warnings.
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
Expand All @@ -51,22 +56,12 @@ allprojects {
"-Xdoclint:all/protected",
"-Xdoclint:-missing",
"-Xdoclint:-accessibility",
"-Xlint:synchronization",
"-Xlint:text-blocks",
"-proc:none", // proc:none was added because of LOG4J2-1925 / JDK-8186647
"-Xlint:removal"
]

// enable some warnings only relevant to newer language features
if (rootProject.runtimeJavaVersion >= JavaVersion.VERSION_15) {
options.compilerArgs += [
"-Xlint:text-blocks",
]
}

if (rootProject.runtimeJavaVersion >= JavaVersion.VERSION_16) {
options.compilerArgs += [
"-Xlint:synchronization",
]
}

if (propertyOrDefault("javac.failOnWarnings", true).toBoolean()) {
options.compilerArgs += "-Werror"
}
Expand Down
6 changes: 0 additions & 6 deletions gradle/testing/defaults-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ allprojects {
ignoreFailures = resolvedTestOption("tests.haltonfailure").toBoolean() == false

jvmArgs Commandline.translateCommandline(resolvedTestOption("tests.jvmargs"))

// Up to JDK-15 we have to enforce --illegal-access=deny, because we want no code to access
// JDK internals; JDK-16 and later will default to deny, see https://openjdk.java.net/jeps/396:
if (rootProject.runtimeJavaVersion < JavaVersion.VERSION_16) {
jvmArgs '--illegal-access=deny'
}

def loggingConfigFile = layout.projectDirectory.file("${resources}/logging.properties")
def tempDir = layout.projectDirectory.dir(testsTmpDir.toString())
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ include "solr:modules:cross-dc"
include "solr:modules:opentelemetry"
include "solr:modules:extraction"
include "solr:modules:gcs-repository"
include "solr:modules:hadoop-auth"
//include "solr:modules:hadoop-auth"
include "solr:modules:hdfs"
include "solr:modules:jwt-auth"
include "solr:modules:langid"
include "solr:modules:ltr"
include "solr:modules:s3-repository"
//include "solr:modules:s3-repository"
include "solr:modules:scripting"
include "solr:modules:sql"
include "solr:webapp"
Expand Down
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Other Changes

* SOLR-17285: SolrJ RemoteSolrException moved to SolrClient. (@samuelrivascoding)
iamsanjay marked this conversation as resolved.
Show resolved Hide resolved

* SOLR-17321: Bump up minimum Java version for Apache Solr is now 21, and for SolrJ, it is 17. (Sanjay Dutt, David Smiley)

================== 9.8.0 ==================
New Features
---------------------
Expand Down
3 changes: 1 addition & 2 deletions solr/benchmark/jmh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ echo "running JMH with args: $@"
# -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 # and this note: Prevents G1 undermining young gen, which otherwise causes a cascade of issues
# MRM: I've also seen 15 claimed as a sweet spot.

# -XX:-UseBiasedLocking - should be unreflective in recent JVMs and removed in the latest.
jvmArgs="-jvmArgs -Djmh.shutdownTimeout=5 -jvmArgs -Djmh.shutdownTimeout.step=3 -jvmArgs -Djava.security.egd=file:/dev/./urandom -jvmArgs -XX:+UnlockDiagnosticVMOptions -jvmArgs -XX:+DebugNonSafepoints -jvmArgs --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"

jvmArgs="-jvmArgs -Djmh.shutdownTimeout=5 -jvmArgs -Djmh.shutdownTimeout.step=3 -jvmArgs -Djava.security.egd=file:/dev/./urandom -jvmArgs -XX:-UseBiasedLocking -jvmArgs -XX:+UnlockDiagnosticVMOptions -jvmArgs -XX:+DebugNonSafepoints -jvmArgs --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
gcArgs="-jvmArgs -XX:+UseG1GC -jvmArgs -XX:+ParallelRefProcEnabled"

# -jvmArgs -Dlog4j2.debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.solr.bench.Docs;
import org.apache.solr.bench.MiniClusterState;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
import org.openjdk.jmh.annotations.Benchmark;
Expand Down Expand Up @@ -70,6 +71,9 @@ public static class BenchState {
@Param({"50000"})
int preGenerate;

@Param({"2", "4", "8", "16", "32", "64", "128"})
int maxConnectionPerHost;

private final Docs largeDocs;
private final Docs smallDocs;
private Iterator<SolrInputDocument> docIterator;
Expand Down Expand Up @@ -118,6 +122,7 @@ public void doSetup(MiniClusterState.MiniClusterBenchState miniClusterState) thr
preGenerate();

System.setProperty("mergePolicyFactory", "org.apache.solr.index.NoMergePolicyFactory");
Http2SolrClient.maxConnectionPerHost = maxConnectionPerHost;
miniClusterState.startMiniCluster(nodeCount);
miniClusterState.createCollection(COLLECTION, numShards, numReplicas);
}
Expand Down
13 changes: 2 additions & 11 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ verbose=false
THIS_OS=$(uname -s)

# What version of Java is required to run this version of Solr.
JAVA_VER_REQ=11
JAVA_VER_REQ=21

stop_all=false

Expand Down Expand Up @@ -1322,18 +1322,9 @@ function start_solr() {
exit 1
fi

# Workaround for JIT crash, see https://issues.apache.org/jira/browse/SOLR-16463
if [[ "$JAVA_VER_NUM" -ge "17" ]] ; then
SCRIPT_SOLR_OPTS+=("-XX:CompileCommand=exclude,com.github.benmanes.caffeine.cache.BoundedLocalCache::put")
echo "Java $JAVA_VER_NUM detected. Enabled workaround for SOLR-16463"
fi

# Vector optimizations are only supported for Java 20 and 21 for now.
# This will need to change as Lucene is upgraded and newer Java versions are released
if [[ "$JAVA_VER_NUM" -ge "20" ]] && [[ "$JAVA_VER_NUM" -le "21" ]] ; then
SCRIPT_SOLR_OPTS+=("--add-modules" "jdk.incubator.vector")
echo "Java $JAVA_VER_NUM detected. Incubating Panama Vector APIs have been enabled"
fi
SCRIPT_SOLR_OPTS+=("--add-modules" "jdk.incubator.vector")

SOLR_START_OPTS=('-server' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE_ARR[@]}" "${GC_LOG_OPTS[@]}" "${IP_ACL_OPTS[@]}" \
"${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" -Dsolr.log.dir="$SOLR_LOGS_DIR" \
Expand Down
7 changes: 0 additions & 7 deletions solr/bin/solr.in.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,8 @@ REM set GC_TUNE=-XX:+ExplicitGCInvokesConcurrent
REM set GC_TUNE=-XX:SurvivorRatio=4
REM set GC_TUNE=%GC_TUNE% -XX:TargetSurvivorRatio=90
REM set GC_TUNE=%GC_TUNE% -XX:MaxTenuringThreshold=8
REM set GC_TUNE=%GC_TUNE% -XX:+UseConcMarkSweepGC
REM set GC_TUNE=%GC_TUNE% -XX:ConcGCThreads=4
REM set GC_TUNE=%GC_TUNE% -XX:ParallelGCThreads=4
REM set GC_TUNE=%GC_TUNE% -XX:+CMSScavengeBeforeRemark
REM set GC_TUNE=%GC_TUNE% -XX:PretenureSizeThreshold=64m
REM set GC_TUNE=%GC_TUNE% -XX:+UseCMSInitiatingOccupancyOnly
REM set GC_TUNE=%GC_TUNE% -XX:CMSInitiatingOccupancyFraction=50
REM set GC_TUNE=%GC_TUNE% -XX:CMSMaxAbortablePrecleanTime=6000
REM set GC_TUNE=%GC_TUNE% -XX:+CMSParallelRemarkEnabled
REM set GC_TUNE=%GC_TUNE% -XX:+ParallelRefProcEnabled etc.

REM Set the ZooKeeper connection string if using an external ZooKeeper ensemble
Expand Down
12 changes: 3 additions & 9 deletions solr/bin/solr.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,8 @@
#-XX:SurvivorRatio=4 \
#-XX:TargetSurvivorRatio=90 \
#-XX:MaxTenuringThreshold=8 \
#-XX:+UseConcMarkSweepGC \
#-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \
#-XX:+CMSScavengeBeforeRemark \
#-XX:ParallelGCThreads=4 \
#-XX:PretenureSizeThreshold=64m \
#-XX:+UseCMSInitiatingOccupancyOnly \
#-XX:CMSInitiatingOccupancyFraction=50 \
#-XX:CMSMaxAbortablePrecleanTime=6000 \
#-XX:+CMSParallelRemarkEnabled \
#-XX:+ParallelRefProcEnabled etc.

# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
Expand Down Expand Up @@ -263,7 +257,7 @@
# Runtime properties are passed to the security policy file (server/etc/security.policy)
# You can also tweak via standard JDK files such as ~/.java.policy, see https://s.apache.org/java8policy
# This is experimental! It may not work at all with Hadoop/HDFS features.
#SOLR_SECURITY_MANAGER_ENABLED=true
# SOLR_SECURITY_MANAGER_ENABLED=true
# This variable provides you with the option to disable the Admin UI. if you uncomment the variable below and
# change the value to true. The option is configured as a system property as defined in SOLR_START_OPTS in the start
# scripts.
Expand All @@ -279,7 +273,7 @@
# other directory, which will implicitly enable heap dumping. Dump name pattern will be solr-[timestamp]-pid[###].hprof
# When using this feature, it is recommended to have an external service monitoring the given dir.
# If more fine grained control is required, you can manually add the appropriate flags to SOLR_OPTS
# See https://docs.oracle.com/en/java/javase/11/troubleshoot/command-line-options1.html
# See https://docs.oracle.com/en/java/javase/21/troubleshoot/command-line-options1.html
# You can test this behavior by setting SOLR_HEAP=25m
#SOLR_HEAP_DUMP=true
#SOLR_HEAP_DUMP_DIR=/var/log/dumps
Expand Down
6 changes: 4 additions & 2 deletions solr/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ dependencies {
implementation ('io.dropwizard.metrics:metrics-graphite', {
exclude group: "com.rabbitmq", module: "amqp-client"
})
implementation 'org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api'
//implementation 'org.eclipse.jetty.toolchain:jetty-servlet-api'
implementation 'io.dropwizard.metrics:metrics-jmx'
implementation 'io.dropwizard.metrics:metrics-jvm'

Expand Down Expand Up @@ -122,7 +124,7 @@ dependencies {
implementation 'org.eclipse.jetty:jetty-client'
implementation 'org.eclipse.jetty:jetty-http'
implementation 'org.eclipse.jetty:jetty-io'
implementation 'org.eclipse.jetty.toolchain:jetty-servlet-api'
//implementation 'org.eclipse.jetty.toolchain:jetty-servlet-api'

// ZooKeeper
implementation('org.apache.zookeeper:zookeeper', {
Expand Down Expand Up @@ -185,7 +187,7 @@ dependencies {
testImplementation 'org.apache.lucene:lucene-test-framework'

testImplementation 'org.eclipse.jetty:jetty-server'
testImplementation 'org.eclipse.jetty:jetty-servlet'
testImplementation 'org.eclipse.jetty.ee10:jetty-ee10-servlet'

testImplementation 'com.carrotsearch.randomizedtesting:randomizedtesting-runner'
testImplementation 'junit:junit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.solr.api;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.servlet.CoordinatorHttpSolrCall;
Expand Down
4 changes: 2 additions & 2 deletions solr/core/src/java/org/apache/solr/api/V2HttpCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import static org.apache.solr.servlet.SolrDispatchFilter.Action.REMOTEQUERY;

import io.opentelemetry.api.trace.Span;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
Expand All @@ -35,8 +37,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.jcip.annotations.ThreadSafe;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.common.SolrException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

static {
KNOWN_MIME_TYPES = new HashSet<>(MimeTypes.getKnownMimeTypes());
KNOWN_MIME_TYPES = new HashSet<>();
for (MimeTypes.Type type : MimeTypes.Type.values()) {
KNOWN_MIME_TYPES.add(type.toString());
}
KNOWN_MIME_TYPES.add("text/xml");
KNOWN_MIME_TYPES.add("text/csv");
KNOWN_MIME_TYPES.add("text/javascript");
KNOWN_MIME_TYPES.add("application/xhtml+xml");
}

public ShowFileRequestHandler() {
Expand Down
Loading
Loading