When I deploy my Kotless app, I notice that I only...
# kotless
a
When I deploy my Kotless app, I notice that I only have 1 function on AWS Lambda "merged-0" with 3 endpoints. Does this mean that these 3 endpoints would have to scale together? Is there a way to have these 3 endpoints as 3 lambda functions? For reference here are the endpoints
Copy code
package com.mdServerless.kotless

import io.kotless.dsl.ktor.Kotless
import io.ktor.application.*
import io.ktor.response.*
import io.ktor.routing.*
import kotlin.random.Random

class Server : Kotless() {

    override fun prepare(app: Application) {

        app.routing {

            get("/") {
                call.respondText { "Welcome to Kotless" }
            }

            get("/hello") {

                val result = compute()

                call.respondText { "Kotless says hello from Ktor! unique value: $result" }
            }

            post("/") {
                call.respondText { "Your post was well received!" }
            }
        }
    }

    private fun compute(): Int {
        return Random.nextInt()
    }
}
Am I doing something wrong?
t
No, all of them would scale independently, if I understood you right. But you can set other MergeLambda mode and lambdas would not be merged :)
a
@TanVD Ok and is there any advantage to merging them into 1 lambda ? Or if you know, what are use cases for each mode ?
t
Actually, if you use one lambda it would mean that it is warm more frequently then in case of few lambdas. On the contrary, I am not sure what are the benefits of few lambdas used :)
👍 1
a
We had this discussion at work the other day actually, and had a hard time coming up with too many concretes. I think that if you use best-effort in-memory caching as a pattern, then you would have locality benefits from multiple functions-- but the thing about that pattern is it becomes less useful as your scale goes up
👍 1