A tutorial workshop that will dive in understanding "what's going on in your JVM".
This workshop has the following components:
- Part 1: Basics with OS, processes, and thread
- Part 2: Java Mission Control and Flight Recorder
- Part 3: Advanced Flight Recorder
- Part 4: Java Heap Analysis
- Part 5: Garbage Collections
This workshop is utilizing a basic web service that is included, which isn't exactly optimal in how it performs. The goal is to use this service as an interactive example and identify its poor performing elements. To learn more about this web service that is included, see the following notes.
The web service is a simple dropwizard server, which has a single API to search for talks from kcdc.info, and returns results about these talks.
Prerequisites:
Assemble the service:
mvn clean package
💡 If you have issues with building it locally due to your setup, you can download the server assembly here.
Start the workshop service:
java -jar java-perf-workshop-server/target/java-perf-workshop-server-1.0-SNAPSHOT.jar server server.yml
To simulate responses of kcdc.info (as the service may change over time), we will first run a mock instance of this service using WireMock. Go ahead and start another terminal session where we will run another service to mock a remote dependency of the workshop service. Navigate to the same directory where you cloned this repository, then execute the following commands:
mvn dependency:copy -Dartifact=com.github.tomakehurst:wiremock-standalone:2.5.1 -Dmdep.stripVersion=true -DoutputDirectory=.
Run the mock service, which will provide the essential end-points to support the service we will be testing:
java -jar wiremock-standalone.jar --port 9090 --root-dir java-perf-workshop-server/src/test/resources
Alternatively, you can run the mockservice.sh
script which will do both commands, ie: sh mockservice.sh
Example configuration of service:
server:
applicationConnectors:
- type: http
port: 80
adminConnectors:
- type: http
port: 8071
requestLog:
timeZone: UTC
appenders:
- type: file
currentLogFilename: /var/log/java-perf-workshop-server-access.log
threshold: ALL
archive: true
archivedLogFilenamePattern: /var/log/java-perf-workshop-server-access.%d.log.gz
archivedFileCount: 5
logging:
level: INFO
appenders:
- type: file
currentLogFilename: /var/log/java-perf-workshop-server.log
threshold: ALL
archive: true
archivedLogFilenamePattern: /var/log/java-perf-workshop-server-%d.log
archivedFileCount: 5
timeZone: UTC
The service will return back results from the KCDC website on sessions that are available which contain a substring in their title, abstract, or tags. Example:
http://localhost:8080/search?q=clojure
Example results:
{
"results" : [ {
"title" : "Concurrency Options on the JVM",
"presenter" : "Jessica Kerr"
}, {
"title" : "Fast, Parallel, or Reliable: Pick 3, a tour of Elixir",
"presenter" : "Jordan Day"
} ]
}
If you get a 500
error message when trying to test the service, verify that the wiremock server is running.
{
"code" : 500,
"message" : "There was an error processing your request. It has been logged (ID d8998189f8d4ee8c)."
}