Code Monkey home page Code Monkey logo

javalin-routing-extensions's Issues

Coroutines FastHttpLoader - 11.08.2021

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

  • Sync
------ 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
  • Async (blocking)
------ 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
  • Async (non-blocking)
------ 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.