https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
n

napperley

05/23/2018, 11:48 PM
Kotlin Native has some server-side samples, could that be extended to cover Serverless? Is Serverless development going to be officially supported in Kotlin Native?
g

gildor

05/24/2018, 2:01 AM
But what is serverless development? I mean each “serverless” service has own API and even own supported platforms (jvm/js/native)
I’m not expert, but I played with different services such as openwhisk, aws lambda, firebase (kotlin js), all of them have very different set of features, different platforms, own packaging and deployment tools. It’s hard to create really helpful sample, because most of problems is on side of service and their deployment tools
n

napperley

05/24/2018, 2:16 AM
There are some frameworks like Serverless (https://serverless.com/framework/) which attempt to provide a common API that works across all FAAS (Function As A Service) platforms. Serverless these days has become the defacto framework for FAAS platforms, and has official Kotlin support (for Kotlin JVM and Kotlin JS, no Kotlin Native support yet ⏲️).
g

gildor

05/24/2018, 2:26 AM
But it requires support of Serverless Framework, probably it should be done by community, don’t think that support of one particular framework by K/N team is a right solution on current stage of K/N
hmmm, I may be wrong, but looks like serverless framework do not allow to support different platforms, it’s more like faas-dependant templates generator
n

napperley

05/24/2018, 2:32 AM
Agree with the community providing support for Serverless with Kotlin Native. Do think that the Kotlin Native team can do some basic things (likely small bits and pieces) to ensure that Kotlin Native works well on FAAS platforms (aka platform neutral).
g

gildor

05/24/2018, 2:35 AM
Do you see any problems with it? As I understand you can deploy K/N program to any faas platform with support of binaries
we don’t have yet K/N library for http or sockets, so the only choice now is use some C library or raw sockets
I think K/N team should work on this before support of any other particular use cases
n

napperley

05/24/2018, 2:37 AM
Are there some FAAS platforms that allow binary deployment? Some FAAS platforms allow for Docker deployment.
g

gildor

05/24/2018, 2:37 AM
Because if you have http server it’s trivial to implement any faas with support of binaries
openwhisk
docker is also option, but again, it’s jus binary distribution that listen port
nothing magic there
n

napperley

05/24/2018, 2:39 AM
There is a case of Kotlin Native working in Open Whisk: https://jaxenter.com/kotlin-native-serverless-tutorial-fibonacci-fun-136615.html
g

gildor

05/24/2018, 2:39 AM
yes, just docker image
so this sample uses C library for Json
would be better to invest to kotlinx.serilization than to particula-faas-partiular-framework sample
I don’t want to rant here too much, sorry if it sounds rough
I just think that this is a great field for community contribution and not clear what exactly K/N team should do here
n

napperley

05/24/2018, 2:48 AM
Just to clarify where the Kotlin Native team fits into this. There are Kotlin Native performance optimisation's that will need to be done to ensure the Kotlin Native runtime is performant in Serverless use cases, and the Kotlin Native team is in the best position to do this.
g

gildor

05/24/2018, 3:09 AM
How “Serverless use case” is different from other use cases? Startup time? it’s already pretty fast, much faster than jvm Any performance optimisations is good for any use case
Checked openwhisk samplese for custom docker
this Python http script to proxy requests to your custom program looks as incredibly clunky and non-optimal solution
anyway, it allows to run any custom program
o

olonho

05/24/2018, 6:34 AM
in a sense, even KotlinConf Spinner example https://github.com/JetBrains/kotlinconf-spinner/blob/master/kotlin-native/samples/fullstack/httpserver/src/main/kotlin/server/HttpServer.kt contains “serverless” server (i.e. lightweight standalone server), which is running for a year already, without much problems
g

gildor

05/24/2018, 7:01 AM
Funny thing that such self contained server is not what people expect from “serverless”, they want integration with some third party “FaaS” service For example on openwhisk you even don’t need http service inside, they pass request to main function arguments as Gson JsonObject 🤔
I have really strange feelings after tests of all those “serverless” services and frameworks
But actually openwhisk kotlin runner supports data classes, so it’s better than raw JsonObject, but overall architecture of those solutions looks not really good for me
o

olonho

05/24/2018, 7:06 AM
yep, term is somewhat vague indeed, but at least if we’re talking about producing small standalone binaries written in relatively high-level language - K/N is pretty good here
☑️ 1
👍 1
o

olonho

05/24/2018, 7:06 AM
that’s Kotlin/JVM one, I guess
:yes: 1
g

gildor

05/24/2018, 7:06 AM
this is what actually runs your functions, no magic there
Yes, of course, for JVM
o

olonho

05/24/2018, 7:08 AM
running it as a standalone process would provide better isolation and resource control, I’d say
g

gildor

05/24/2018, 7:08 AM
They run this service on each request, as I know
at least openwhist tries to do some smart things about jvm, because start jvm is not so fast
but anyway, it looks not really effecient
but you right, k/n looks as much better alternative than jvm in this particular usecase
This is how they run custom binaries, there is Pyton (sic!) web server that proxies requests to your binary https://github.com/tleyden/openwhisk-dockerskeleton/blob/master/actionproxy.py
o

orangy

05/24/2018, 8:31 AM
One way to understand “serverless” that helps me is that “server” here is not a dedicated hardware, and being serverless doesn’t mean running in a cloud. “Server” here is a dedicated software (web server, framework, etc) that has a specific lifecycle (binds to a port, listens to connections, processes http requests). Hence FaaS is serverless, but docker with a http server is not.
s

sdeleuze

05/24/2018, 10:02 AM
I would like to experiment about Kotlin/Native support for Serverless, and I am thinking about the deployment options because even if most platform runs under Linux x86-64 that could be not always the case. Could we imagine using Klib as a deployement unit to deploy LLVM bytecode on a FaaS that could be compiled as an native executable on the Faas platform ?
I know that Klib is not expected to be an executable but FaaS is higher level so maybe if Klib implement a given function type and provide function named by convention we could use that
For long term, I really think WebAssembly should be explored as a possible option. See
Any thoughts ?
g

gildor

05/24/2018, 10:29 AM
It’s actually not clear for me why wasm instead of platform compatible binary?
I know, this is not the most common approach for serverless services, but I don’t understand why
s

sdeleuze

05/24/2018, 10:32 AM
You don't know the internals of the system you are deployed on, this is sandboxed runtime so great for security, it is a good trade-off between performance, flexibility and security
Serverless could run on Arm or x86 for example
So I don't want to deploy a specific platform executable
I want to deploy a sandboxed autonomous efficient fonction
o

olonho

05/24/2018, 4:05 PM
Docker example shows that generally Linux binaries are good enough executable unit format representation, so I’d suggest to use raw native code instead of yet another VM
1
n

napperley

05/24/2018, 9:44 PM
In other words Kotlin Native would be a good way to go depending on what Serverless software is being developed.
s

spierce7

05/24/2018, 11:44 PM
There are serverless environments for Swift. I think IBM's OpenWhisk offers it. Perhaps Kotlin-native could run in a Swift environment?
g

gildor

05/25/2018, 1:51 AM
Swift runner for OpenWhisk compiles Swift files itself. There is no magic. The only thing what they do is compile your swfit source code on their server I don’t see any problems to do same for K/N, they even use gradle as a build tool for swift, I just think that this approach is strange, but if people like, maybe who is really intereseted, could write openwhist runtime for K/N, it shouldn’t be hard. But Swift and possible K/N has a problem: first time when you run your action your file with function will be compiled before execution, not so bad, it will be cached. But still this can be avoided using docker image
You can check implementation, it’s not so many code: https://github.com/apache/incubator-openwhisk-runtime-swift
So approach with docker looks much better for me, especially if you want to have dependencies and know exactly what is available on your platform.
s

sdeleuze

05/25/2018, 10:58 AM
Make sense yeah