Introduction

Almost 2 years ago, I built a performance test framework that drives the Knox Gateway configured by different use cases. At that time, I implemented one use case that acquires/renews/uses Knox tokens. You can read this article for further details.

In this post, I'll explain how that performance test tool was used to measure some of the key metrics of Knox's token management feature such as response times, memory consumption, etc...

Configuration

The performance test framework's properties were modified as follows:

perf.test.usecase.knoxtoken.numOfThreads=10
perf.test.usecase.knoxtoken.testDurationInSecs=3600
perf.test.usecase.knoxtoken.requestDelayLowerBoundInSecs=3
perf.test.usecase.knoxtoken.requestDelayUpperBoundInSecs=6

Additionally, I wanted to measure the newest token management backend that persists token information in a relational database (PostgreSQL 10, in this test) instead of Zookeeper or local keystores. To be able to do that I'd to add the following configuration in gateway-site.xml:

    <property>
        <name>gateway.service.tokenstate.impl</name>
        <value>org.apache.knox.gateway.services.token.impl.JDBCTokenStateService</value>
    </property>
     <property>
        <name>gateway.database.type</name>
        <value>postgresql</value>
    </property>
    <property>
        <name>gateway.database.connection.url</name>
        <value>jdbc:postgresql://smolnar.local:5432/postgres?user=postgres</value>
    </property>

Test results

1.) 1-hour test execution with a medium-size load (tokens were generated between 3-6 seconds):

Number of tokens createdNumber of tokens renewedAverage response time (token creation)*Average response time (token renewal)
730634664.77 ms15.53 ms

Memory graph (using JConsole)











JSON/YAML result files: testResults.zip

2.) 2-hour test execution with a medium-size load (tokens were generated between 3-6 seconds):

Number of tokens createdNumber of tokens renewedAverage response time (token creation)*Average response time (token renewal)
1774084552.47 ms12.19 ms

Memory graph (using JConsole)

JSON/YAML result files: testResult.zip

3.) 1-hour test execution with high load (tokens were generated between 1-2 seconds on 15 threads)- without token eviction:

perf.test.usecase.knoxtoken.numOfThreads=15
perf.test.usecase.knoxtoken.testDurationInSecs=3600
perf.test.usecase.knoxtoken.requestDelayLowerBoundInSecs=1
perf.test.usecase.knoxtoken.requestDelayUpperBoundInSecs=2
Number of tokens createdNumber of tokens renewedAverage response time (token creation)*Average response time (token renewal)
49546142486.68 ms 19.86 ms

Memory graph (using JConsole)

JSON/YAML result files: testResults.zip

4.) 1-hour test execution with high load (tokens were generated between 1-2 seconds on 15 threads) - with token eviction:

In this test I kept the previous config and, additionally, I lowered the Token TTL to 10 minutes from 10 hours (by default, the token eviction grace period is set to 0). That triggered automated token eviction every 5 minutes.

Number of tokens createdNumber of tokens renewedAverage response time (token creation)*Average response time (token renewal)
49596143085.5 ms19.09 ms


Memory graph (using JConsole)

Token eviction took place as expected:

2022-06-17 14:33:11,667  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 3,438 expired token(s) from the database
2022-06-17 14:38:11,648  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,007 expired token(s) from the database
2022-06-17 14:43:11,629  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,018 expired token(s) from the database
2022-06-17 14:48:11,640  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,011 expired token(s) from the database
2022-06-17 14:53:11,644  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,031 expired token(s) from the database
2022-06-17 14:58:11,629  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 3,990 expired token(s) from the database
2022-06-17 15:03:11,638  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,005 expired token(s) from the database
2022-06-17 15:08:11,646  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,011 expired token(s) from the database
2022-06-17 15:13:11,671  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,029 expired token(s) from the database
2022-06-17 15:18:11,659  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 3,997 expired token(s) from the database
2022-06-17 15:23:11,643  INFO  token.state (JDBCTokenStateService.java:evictExpiredTokens(216)) - Removing 4,024 expired token(s) from the database


*:  There is a short warmup period at the beginning of each test round (see test results where token creation time takes ~2 seconds a couple of times). We could even see better results if those values were not recorded at the end (the longer the test period the better the average result is).

  • No labels