Skip to content

Commit

Permalink
Update readme, clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
skjolber committed Oct 24, 2023
1 parent 83c2152 commit 7487cec
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ Temporarily disable boost (untill next reboot) for AMD:

> echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost


The JMH plugin seems to have trouble refreshing the project, so restart the Gradle deamon before running.
## Benchmarks

* Parse token (if possible)
* Verify token
* Verify token, get claim.

## General observations
There is not much headroom for improving the performance further. Most of the CPU time goes to signature verification.
## General performance observations
There is not much headroom for improving the performance of RSA-based signatures; most (> 90%) of the CPU time goes to signature verification.

This observation is based on two simple 'baseline' RSA-based JWT verifiers included in this project. They perform about 5% faster than the fastest JWT libraries,
but then only does signature verification and no JSON parsing / field validation. So it seems likely this is the upper limit.

## Latest results
Running for OpenJDK 11 build 11.0.18+10 and OpenJDK 17 build 17.0.6+10, on Fedora Linux 6.1.8-200, AMD Ryzen 5950.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ configure(project(':jmh-benchmark')) {
warmup = '1s' // Time to spend at each warmup iteration.
warmupIterations = 10

includes = ['JwtVerifyBenchmark']
// includes = ['JwtVerifyBenchmark']

fork = 1
timeOnIteration = '5s'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.openjdk.jmh.annotations.Benchmark;

public abstract class JwtClaimBenchmark {
public class JwtClaimBenchmark {

@Benchmark
public Object nimbus_claim(BenchmarkState state) throws Exception {
Expand Down Expand Up @@ -31,5 +31,4 @@ public Object fusionauth_claim(BenchmarkState state) throws Exception {
return state.getFusionAuthJsonWebTokenVerifier().verifyJsonWebToken(state.getToken()).getObject("test");
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.text.ParseException;

public abstract class JwtParseBenchmark {
public class JwtParseBenchmark {

@Benchmark
public com.nimbusds.jwt.JWT nimbus_parse(BenchmarkState state) throws ParseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@Measurement(iterations = 1, time = 30, timeUnit = TimeUnit.SECONDS)
public class JwtVerifyBenchmark {

/*
@Benchmark
public Object nimbus_verify(BenchmarkState state) throws Exception {
return state.getNimbusTokenVerifier().verifyJsonWebToken(state.getToken());
Expand All @@ -37,15 +36,13 @@ public Object jjwt_verify(BenchmarkState state) throws Exception {
public Object auth0_verify(BenchmarkState state) throws Exception {
return state.getAuth0TokenVerifier().verifyJsonWebToken(state.getToken());
}
*/
/*

/*
@Benchmark
public Object okta_verify(BenchmarkState state) throws Exception {
return state.getOktaJsonWebTokenVerifier().verifyJsonWebToken(state.getToken());
}
*/
*/

@Benchmark
public Object fusionauth_verify(BenchmarkState state) throws Exception {
Expand Down

0 comments on commit 7487cec

Please sign in to comment.