Skip to content

Commit

Permalink
Merge pull request #2 from devinrsmith/cfs-ugp-cycle-log-gctimes-0
Browse files Browse the repository at this point in the history
Cfs ugp cycle log gctimes 0
  • Loading branch information
jcferretti authored Mar 30, 2022
2 parents c2fc1cf + 1ae9c3c commit 0ed2481
Show file tree
Hide file tree
Showing 18 changed files with 227 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def runtimeVersion = Integer.parseInt((String)project.findProperty('runtimeVersi
def testLanguageLevel = Integer.parseInt((String)project.findProperty('testLanguageLevel') ?: '11')
def testRuntimeVersion = Integer.parseInt((String)project.findProperty('testRuntimeVersion') ?: '11')

def excludeReleaseFlag = project.hasProperty('excludeReleaseFlag')

if (languageLevel > compilerVersion) {
throw new IllegalArgumentException("languageLevel must be less than or equal to compileVersion")
}
Expand Down Expand Up @@ -63,15 +61,14 @@ tasks.withType(JavaCompile).configureEach {
options.incremental = true
options.compilerArgs << '-parameters'

if (!excludeReleaseFlag) {
def checkLevel = (name == 'compileTestJava') ? testLanguageLevel : languageLevel
if (compilerVersion != checkLevel) {
options.release.set checkLevel
if (name == 'compileTestJava') {
if (compilerVersion != testLanguageLevel) {
options.release.set testLanguageLevel
}
} else {
// This is a special case; without this we still get a failure about
// --add-opens together with --release for the hotspot-impl module.
sourceCompatibility = languageLevel
if (compilerVersion != languageLevel) {
options.release.set languageLevel
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion docker/server-slim/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configurations {
}

dependencies {
serverApplicationDist project(path: ':server-netty', configuration: 'applicationDist')
serverApplicationDist project(path: ':server-netty-app', configuration: 'applicationDist')
}

def dockerContext = project.layout.buildDirectory.dir('context')
Expand Down
2 changes: 1 addition & 1 deletion docker/server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ configurations {
}

dependencies {
serverApplicationDist project(path: ':server-netty', configuration: 'applicationDist')
serverApplicationDist project(path: ':server-netty-app', configuration: 'applicationDist')
}

def dockerLicenses = License.createFrom(project).syncDockerLicense().get()
Expand Down
2 changes: 2 additions & 0 deletions hotspot-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ dependencies {

tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ['--add-exports', 'java.management/sun.management=ALL-UNNAMED']
// Explicitly set the source compatibility so gradle will invoke javac with `-source 11` instead of `--release`
sourceCompatibility = 11
}
1 change: 0 additions & 1 deletion hotspot-impl/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
io.deephaven.project.ProjectType=JAVA_LOCAL
excludeReleaseFlag=
15 changes: 0 additions & 15 deletions hotspot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
plugins {
id 'io.deephaven.project.register'
}

configurations {
compile.extendsFrom configurations.dhUtil
}

dependencies {
compile project(':log-factory')

testRuntime project(path: ':configs'), project(path: ':test-configs')

testRuntimeOnly project(':log-to-slf4j')
Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly')

Classpaths.inheritJUnitPlatform(project)
}
18 changes: 12 additions & 6 deletions server/jetty/README.md → server/jetty-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ be sure to first set `PYTHON_CONFIGURE_OPTS="--enabled-shared"`.
### Build

```shell
./gradlew server-jetty:build
./gradlew server-jetty-app:build
```

produces

* `server/netty/build/distributions/server-jetty-<version>.tar`
* `server/netty/build/distributions/server-jetty-<version>.zip`
* `server/jetty-app/build/distributions/server-jetty-<version>.tar`
* `server/jetty-app/build/distributions/server-jetty-<version>.zip`

### Run

Expand All @@ -61,17 +61,23 @@ The above artifacts can be uncompressed and their `bin/start` script can be exec
Alternatively, the uncompressed installation can be built directly by gradle:

```shell
./gradlew server-jetty:installDist
./gradlew server-jetty-app:installDist
```

And then run via:

```shell
JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/jetty/build/install/server-jetty/bin/start
JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/jetty-app/build/install/server-jetty/bin/start
```

Finally, Gradle can be used to update the build and run the application in a single step:

```shell
./gradlew :server-jetty:run -Pgroovy
./gradlew server-jetty-app:run -Pgroovy
```

### Internals

`server-jetty-app` is configured by default to include code that depends on JVM internals via
`--add-opens java.management/sun.management=ALL-UNNAMED`. To disable this, set the gradle property `includeHotspotImpl`
to `false`.
60 changes: 60 additions & 0 deletions server/jetty-app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
id 'application'
id 'io.deephaven.project.register'
}

configurations {
applicationDist
}

dependencies {
implementation project(':server-jetty')

runtimeOnly project(':log-to-slf4j')
runtimeOnly project(':logback-print-stream-globals')
runtimeOnly project(':logback-logbuffer')
Classpaths.inheritLogbackClassic(project)
}

distributions {
main {
distributionBaseName = 'server-jetty'
}
}

def extraJvmArgs = [
'-server',
'-XX:+UseG1GC',
'-XX:MaxGCPauseMillis=100',
'-XX:+UseStringDeduplication',
'-XshowSettings:vm',
]

if (hasProperty('groovy')) {
extraJvmArgs += ['-Ddeephaven.console.type=groovy']
}

if (property('includeHotspotImpl') == 'true') {
dependencies {
runtimeOnly project(':hotspot-impl')
}
extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED']
}

tasks.withType(JavaExec).configureEach {
// This appends to the existing jvm args, so that java-open-nio still takes effect
jvmArgs extraJvmArgs
}

tasks.withType(CreateStartScripts).configureEach {
defaultJvmOpts += extraJvmArgs
}

applicationName = 'start'
mainClassName = 'io.deephaven.server.jetty.JettyAppMain'

artifacts {
applicationDist project.tasks.findByName('distTar')
}

apply plugin: 'io.deephaven.java-open-nio'
2 changes: 2 additions & 0 deletions server/jetty-app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
io.deephaven.project.ProjectType=JAVA_LOCAL
includeHotspotImpl=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.deephaven.server.jetty;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class JettyAppMain {
public static void main(String[] args)
throws IOException, InterruptedException, ClassNotFoundException, TimeoutException {
JettyMain.main(args);
}
}
47 changes: 5 additions & 42 deletions server/jetty/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
id 'application'
id 'java-library'
id 'io.deephaven.project.register'
}

dependencies {
implementation project(':server')
api project(':server')
runtimeOnly(project(':web'))

Classpaths.inheritDagger(project)
Classpaths.inheritDagger(project, /* test */ true)

Classpaths.inheritGrpcPlatform(project)
runtimeOnly project(':hotspot-impl')

implementation('org.eclipse.jetty:jetty-servlet:11.0.8')
implementation 'org.eclipse.jetty:jetty-webapp:11.0.8'
Expand All @@ -21,49 +21,12 @@ dependencies {
implementation project(':grpc-java:grpc-servlet-websocket-jakarta')
implementation 'org.eclipse.jetty.websocket:websocket-jakarta-server:11.0.8'

runtimeOnly project(':log-to-slf4j')
runtimeOnly project(':logback-print-stream-globals')
runtimeOnly project(':logback-logbuffer')
Classpaths.inheritLogbackClassic(project)

testImplementation project(':server-test')

runtimeOnly(project(':web'))
testRuntimeOnly project(':log-to-slf4j')
Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly')
}

test.systemProperty "UpdateGraphProcessor.allowUnitTestMode", false

distributions {
main {
distributionBaseName = 'server-jetty'
}
}

def extraJvmArgs = [
'-server',
'-XX:+UseG1GC',
'-XX:MaxGCPauseMillis=100',
'-XX:+UseStringDeduplication',
'-XshowSettings:vm',
]
if (hasProperty('groovy')) {
extraJvmArgs += ['-Ddeephaven.console.type=groovy']
}
if (hasProperty('hotspot')) {
dependencies {
runtimeOnly project(':engine-hotspot')
}
extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED']
}
tasks.withType(JavaExec) {
// This appends to the existing jvm args, so that java-open-nio still takes effect
jvmArgs extraJvmArgs
}
tasks.withType(CreateStartScripts) {
defaultJvmOpts += extraJvmArgs
}

applicationName = 'start'
mainClassName = 'io.deephaven.server.jetty.JettyMain'

apply plugin: 'io.deephaven.java-open-nio'
44 changes: 44 additions & 0 deletions server/netty-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Native packaging for Deephaven Netty server

### Build

```shell
./gradlew server-netty-app:build
```

produces

* `server/netty-app/build/distributions/server-<version>.tar`
* `server/netty-app/build/distributions/server-<version>.zip`

### Run

The above artifacts can be uncompressed and their `bin/start` script can be executed:

```shell
JAVA_OPTS="-Ddeephaven.console.type=groovy" bin/start
```

Alternatively, the uncompressed installation can be built directly by gradle:

```shell
./gradlew server-netty-app:installDist
```

And then run via:

```shell
JAVA_OPTS="-Ddeephaven.console.type=groovy" ./server/netty-app/build/install/server/bin/start
```

Finally, Gradle can be used to update the build and run the application in a single step:

```shell
./gradlew server-netty-app:run -Pgroovy
```

### Internals

`server-netty-app` is configured by default to include code that depends on JVM internals via
`--add-opens java.management/sun.management=ALL-UNNAMED`. To disable this, set the gradle property `includeHotspotImpl`
to `false`.
60 changes: 60 additions & 0 deletions server/netty-app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
id 'application'
id 'io.deephaven.project.register'
}

configurations {
applicationDist
}

dependencies {
implementation project(':server-netty')

runtimeOnly project(':log-to-slf4j')
runtimeOnly project(':logback-print-stream-globals')
runtimeOnly project(':logback-logbuffer')
Classpaths.inheritLogbackClassic(project)
}

distributions {
main {
distributionBaseName = 'server'
}
}

def extraJvmArgs = [
'-server',
'-XX:+UseG1GC',
'-XX:MaxGCPauseMillis=100',
'-XX:+UseStringDeduplication',
'-XshowSettings:vm',
]

if (hasProperty('groovy')) {
extraJvmArgs += ['-Ddeephaven.console.type=groovy']
}

if (property('includeHotspotImpl') == 'true') {
dependencies {
runtimeOnly project(':hotspot-impl')
}
extraJvmArgs += ['--add-opens', 'java.management/sun.management=ALL-UNNAMED']
}

tasks.withType(JavaExec).configureEach {
// This appends to the existing jvm args, so that java-open-nio still takes effect
jvmArgs extraJvmArgs
}

tasks.withType(CreateStartScripts).configureEach {
defaultJvmOpts += extraJvmArgs
}

applicationName = 'start'
mainClassName = 'io.deephaven.server.netty.NettyAppMain'

artifacts {
applicationDist project.tasks.findByName('distTar')
}

apply plugin: 'io.deephaven.java-open-nio'
2 changes: 2 additions & 0 deletions server/netty-app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
io.deephaven.project.ProjectType=JAVA_LOCAL
includeHotspotImpl=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.deephaven.server.netty;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class NettyAppMain {
public static void main(String[] args)
throws IOException, InterruptedException, ClassNotFoundException, TimeoutException {
NettyMain.main(args);
}
}
Loading

0 comments on commit 0ed2481

Please sign in to comment.