javalin / javalin-routing-extensions Goto Github PK
View Code? Open in Web Editor NEWSet of alternative routing implementations for Javalin 5.x
Home Page: https://github.com/javalin/javalin-routing-extensions/wiki
License: MIT License
Set of alternative routing implementations for Javalin 5.x
Home Page: https://github.com/javalin/javalin-routing-extensions/wiki
License: MIT License
Requested on Reposilite's Discord
Spec
val sharedThreadPool = QueuedThreadPool(4)
class ExampleEndpoint(private val exampleFacade: ExampleFacade) : AbstractRoutes<AppContext>() {
private val sync = route("/sync", GET, async = false) { context.result(blockingDelay("Sync")) }
private val blockingAsync = route("/asyncBlocking", GET) { blockingDelay("Blocking Async") }
private val nonBlockingAsync = route("/async", GET) { nonBlockingDelay("Non-blocking Async") }
override val routes = setOf(sync, blockingAsync, nonBlockingAsync)
}
private suspend fun nonBlockingDelay(message: String): String =
delay(100L).let { message }
@Suppress("BlockingMethodInNonBlockingContext")
private suspend fun blockingDelay(message: String): String =
sleep(100L).let { message }
Results
Requests done per route in Burst Throughput
(10s), Adjustment test
(30s) and Loading test
(30s):
/sync - 192 / 491 / 335
/asyncBlocking - 96 / 251 / 172
/async - 785 / 7203 / 10499
Details
Tool: https://github.com/hagen1778/fasthttploader
------ Burst Throughput ------
Elapsed time: 10.094717s
Req done: 192; Success: 100.00 %
QPS: 19.019849; Connections: 8
Errors: 0; Timeouts: 0
------ Adjustment test ------
Elapsed time: 30.001615s
Req done: 491; Success: 100.00 %
QPS: 16.365786; Connections: 102
Errors: 0; Timeouts: 0
------ Loading test ------
Elapsed time: 30.002567s
Req done: 335; Success: 100.00 %
QPS: 11.165711; Connections: 107
Errors: 188; Timeouts: 188
------ Burst Throughput ------
Elapsed time: 10.050572s
Req done: 96; Success: 100.00 %
QPS: 9.551695; Connections: 8
Errors: 0; Timeouts: 0
------ Adjustment test ------
Elapsed time: 30.003456s
Req done: 251; Success: 100.00 %
QPS: 8.365703; Connections: 86
Errors: 0; Timeouts: 0
------ Loading test ------
Elapsed time: 30.002243s
Req done: 172; Success: 100.00 %
QPS: 5.732905; Connections: 172
Errors: 146; Timeouts: 146
------ Burst Throughput ------
Elapsed time: 10.050354s
Req done: 785; Success: 100.00 %
QPS: 78.106699; Connections: 8
Errors: 0; Timeouts: 0
------ Adjustment test ------
Elapsed time: 30.001574s
Req done: 7203; Success: 100.00 %
QPS: 240.087406; Connections: 30
Errors: 0; Timeouts: 0
------ Loading test ------
Elapsed time: 30.004469s
Req done: 10499; Success: 100.00 %
QPS: 349.914540; Connections: 29
Errors: 0; Timeouts: 0
Extension methods for Context class
Moved from javalin/javalin#2049:
fun <SETUP> RouterConfig.mount(initializer: RoutingApiInitializer<SETUP>, setup: RoutingSetupScope<SETUP> = RoutingSetupScope {}): RouterConfig = also {
initializer.initialize(cfg, cfg.pvt.internalRouter, setup)
}
Annotation processor may replace reflective based implementation with safe wrappers generated at compile-time.
Similar to: https://docs.micronaut.io/latest/guide/#apiVersioning + It could be also integrated with OpenApi plugin
@Status(success = HttpStatus.OK, error = HttpStatus.INTERNAL_SERVER_ERROR)
maven.reposilite.com/snapshots
ub
Planned:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.