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
g

gpeal

01/22/2019, 10:15 PM
Hi everybody, I've been a huge proponent of Kotlin and helped migrate Airbnb's Android team to Kotlin and am not well underway doing the same at Tonal (https://www.tonal.com/). I'm meeting with our backend team tomorrow to introduce the idea of using Kotlin to them. Right now, they do everything in Go but I think there could be a ton of value to having shared language/code/knowledge/tooling. Plus, Kotlin is wonderful. However, I have very limited experience with Java/Kotlin on the server side of things. Any suggestions for talking points or ideas I could lead that discussion with?
👍 1
🍾 1
k

kenkyee

01/22/2019, 11:04 PM
Wow... Didn't realize you left Airbnb... Hope you're still taking care of Lottie ☺️ Against Go, your hardest problem will be speed comparisons. Some of the Kotlin server frameworks support GraalVM including Spring, ktor, http4k, and vert.x. You lose a lot of java lib support though...and the tech is in its infancy. Kotlin is a more expressive language than Go but Go folks have a lot of workarounds so they're generally pretty happy. Sharing code with clients is also a good talking point if you need to do workflows while offline (e.g., billing and booking).
g

gpeal

01/22/2019, 11:05 PM
yes, Lottie is definitely 100% maintained 🙂 We're using it at Tonal too
Based on preliminary reading I've done, it seems like people have been happy with Spring Boot
h

herlevsen

01/22/2019, 11:45 PM
I too am pretty happy with Spring Boot, it is really easy to setup and handles a lot of the heavy lifting for you, while stile giving you the ability to customize it to your needs. I dont know too much about Go, but from what i’ve read, i think that kotlins type system is far superior to Go. AFAIK Go doesn’t even have generics, which for me at least would be a selling point. And then i would guess the number of libraries available for Kotlin is far greater (because of its interoperability with Java).
🤔 1
💯 1
Oh, and it might also be easier to hire for Kotlin? (Java)
1
m

Mike

01/23/2019, 12:34 AM
If they’re serious Go users, you have a tough sell. Spring Boot is great, Pivotal is adopting more and more Kotlin. Netflix is contributing back to Spring Boot for Cloud, and they use Kotlin. BUT Kotlin/JVM is still heavier on memory consumption, and slower to start (unless you are really adventurous and move to GrallVM). I don’t think it’s necessarily slower on performance, but benchmarks are a tricky thing. KTor is an all Kotlin library. Micronaut also looks very interesting (Java, Groovy, Kotlin) and they have examples for GraalVM. Regardless, if they’re big Go users, you’ll have a tough time convincing them. Good luck!
4
n

napperley

01/23/2019, 12:36 AM
Kotlin Native is an option for doing specialised back-end development (includes Serverless - https://github.com/JetBrains/kotlin-native/tree/master/samples/weather_function ) where performance and platform integration is important, however it is in Beta and doesn't have a sizeable/mature ecosystem yet. Some of the major Kotlin libraries/frameworks (eg Ktor - https://github.com/ktorio/ktor/issues/571 ; https://blog.jetbrains.com/kotlin/2018/07/kotlinnative-v0-8-released/ ) have plans to provide a Kotlin Native version. Already there is reasonable tooling available for Kotlin Native where a Kotliner can use IntelliJ (Community or Ultimate edition), Gradle via the Kotlin Multiplatform plugin (Gradle Kotlin DSL support is arriving "soonish" with Kotlin 1.3.20 - https://youtrack.jetbrains.com/issue/KT-28458 ; https://youtrack.jetbrains.com/issue/KT-26389 ). Looks as though there is a Kotlin Native Benchmark tool under development ( https://github.com/JetBrains/kotlin-native/tree/master/tools/benchmarksAnalyzer ). There are many Kotlin Native samples available ( https://github.com/JetBrains/kotlin-native/tree/master/samples ).
k

kenkyee

01/23/2019, 1:14 AM
K/N is only for libs, not executables AFAIK. At least for now... Spring Boot is the safest choice because of Netflix. I like Micronaut as well. Depends on what they're doing with Go. If it's lambda/cloud functions, Go is still the fastest and lightest. Once the JVM spins up, it's competitive but slower and more of a memory hog as Mike mentioned. Go is still the fastest and lightest framework...
n

napperley

01/23/2019, 1:27 AM
Not sure where you get the impression that Kotlin Native can only do libraries. Kotlin Native can do binaries (both dynamically and statically linked - https://superkotlin.com/kotlin-native/ ) which is a capability that has been available since v0.1, with support for developing libraries landing in a later version.
k

kenkyee

01/23/2019, 1:49 AM
For some reason, I thought the JB folks recommended GraalVM for Kotlin executables... Thanks for the clarification 🙂
g

gildor

01/23/2019, 2:19 AM
I wouldn’t choose K/N for backend except if you don’t do serverless JVM is just much safer and powerful platform for big BE application imo Agree with @Mike that transition from Go to JVM is not so obvious decision and if BE team doesn’t have relevant JVM experience is probably not the best solution. I prefer JVM, but the best choice is what you know and where you have more expert knowledge
d

dave

01/23/2019, 9:23 AM
The big API that I'd be worried about missing in K/N is the date time one - is there a current replacement that matches the JDK? I can't really imagine not having to use that in pretty much any significant backend (or if I think back to any of my previous projects for the last decade), unless it was just some kind of proxy or BFF. As has been mentioned, the benefits of having an standardised toolstack are huge, especially in a growing company.
g

gildor

01/23/2019, 9:25 AM
<ctime>?
e

Ema

01/23/2019, 12:54 PM
JVM means your container images are big and require more resources though - if you got many containers running, switching to JVM roughly implies (256 MB * nr of containers) more memory needed. Right comparison would be Go vs KN.
i tend to not like VMs on containers. Seems duplicated abstraction to me.
m

Mike

01/23/2019, 4:00 PM
JVM != VM really, even though it’s in the name, but your point is completely valid. Using JVM (other than GraalVM) implies at least a 256MB increase/container.
VM is a full blown OS, and the JVM definitely isn’t that.
👍 1
g

gpeal

01/23/2019, 10:02 PM
Thanks for the information everybody 🙂
p

Paul N

01/23/2019, 10:25 PM
I'd definitely go for Spring Boot and Kotlin, an awesome stack. Dave Syer from Pivotal did a good blog entry on Spring Boot startup time, with a bit of tuning a basic serverless spring Boot app can easily start in under a second, so startup time is no big deal.

https://youtu.be/97UTDmonq7w

👏 1
k

kenkyee

01/23/2019, 10:56 PM
If you use cloud functions it does....Go and GraalVM start up in under 10msec...
n

napperley

01/24/2019, 12:01 AM
David D - Agree on the Date API being essential for back-end development. There was a discussion a while back on the possibility of JB developing a Kotlin multi-platform Date API however nothing has materialised since the discussion.
With the Kotlin 1.3.20 release Gradle Kotlin DSL can now be used to manage Kotlin multi-platform projects via the Kotlin Multiplatform Gradle plugin which will aid in providing standard Kotlin tooling (including Kotlin Native).
g

gpeal

01/24/2019, 12:33 AM
Just chatted with the team. They're excited to try Kotlin but their major concerns are around startup time (for development work) and memory usage. How have those two faired at scale for you all? Would there be a major difference for them if we went with Spring Boot vs another framework?
One engineer thinks that the overhead of managing the jvm/the extra servers required to scale it vs Go will be the difference between having an ops team and not
n

napperley

01/24/2019, 2:25 AM
One of the major differences between Kotlin JVM and Kotlin Native is that there is very little fine turning that needs to be done (if any) with a Kotlin Native program since it doesn't use a VM. Another major difference from a perception POV is that the memory usage of a Kotlin Native program is significantly lower than a equivalent Kotlin JVM one (even when GraalVM is used). If Kotlin JVM is used then it would be recommended to evaluate the GraalVM ( https://www.graalvm.org/ ) route in order to get lower resource usage (memory, CPU, program size, startup overhead etc).
g

gildor

01/24/2019, 2:43 AM
Fine tuning is not something bad, it’s a great feature of managed runtimes, especially on big projects
n

napperley

01/24/2019, 2:46 AM
With VMs (software development platforms) fine tuning is problematic when there is too much that needs to be tuned at which point fine tuning becomes a burden (too much maintenance). Gabriel Peal - This video provides a introduction to JVM performance:

https://www.youtube.com/watch?v=hjpzLXoUu1Y

g

gildor

01/24/2019, 2:47 AM
For small or medium project tuning just not required. For huge projects this may save millions of dollars to a company
👍 1
and of course not every VM supports this,. But very JVM does
d

dave

01/24/2019, 9:47 AM
A second is a comically long time to start up a server, even in a regular container environment where instances might not be moving around that much. This is triply relevant if you want to spin up servers in tests (which admittedly you should try to avoid since everything should be testable without network) to keep your build time down.
In terms of memory, we expect our http4k microservices to run at <100mb heap on a standard JVM. @kenkyee also had a link to some research about GraalVM startup times for various http libs (too lazy to look it up at the mo 🙂 ).
p

Paul N

01/24/2019, 2:10 PM
Here's the link to the blog entry on Spring Boot start up time: https://spring.io/blog/2018/12/12/how-fast-is-spring I guess it boils down to how important you consider startup time to be versus the functionality of the framework you use. For Spring Boot you can also add Spring Boot Dev Tools to your project; this allows warm restarts of the application (it throws away the application classloader when a class is recompiled) but the jvm is left running. This really speeds things up when developing.
m

mp

01/24/2019, 4:42 PM
fwiw https://bitbucket.org/marshallpierce/ktor-demo/src/master/ starts up in 500ms on my linux box, including configuring a DB connection pool, Jackson, etc.
j

Jeremy

01/24/2019, 4:53 PM
also see spring fu
if you want to use spring but concerns are startup/memory
k

kenkyee

01/24/2019, 5:22 PM
https://www.bouvet.no/bouvet-deler/comparing-java-and-node.js-on-aws-lambda https://blog.travelex.io/blazing-fast-microservice-with-go-and-lambda-d30d95290f28 Those are from my KotlinConf 2018 slides. The last one is especially relevant; TL;DR: if you use cloud functions/lambdas...use Go...or a Kotlin framework w/ GraalVM support but that's pretty bleeding edge now. Competing w/ Go on speed is probably a losing race...Go is pretty much the fastest uServices framework there is (beat the former champ Node.js a while back) and has been for years. You'll have to emphasize other things like generics, inheritance, etc. that are better ironically for larger systems (which uServices are not BTW...and Go has enough workaround and libraries/ecosystem now that being able to connect to everything isn't an issue).
t

tjb

01/24/2019, 6:55 PM
I would like to say this has been a very informative thread as I am trying to bring Kotlin into our team for backend dev right now (currently only use kotlin for tests).
d

dave

01/24/2019, 6:57 PM
@tjb if you're used to Scala, we can throw in some more insults if that would make you feel more at home 😉
😂 1
That's the problem with kotlin - everyone is too nice
t

tjb

01/24/2019, 6:59 PM
fortunately for me then i have not had to interact with the scala community or use the language yet 😛
d

dave

01/24/2019, 7:04 PM
@tjb it's quite a treat. For maximum toxicity,I suggest starting with the JSON AST in the stdlib thread: https://github.com/scala/slip/pull/28
t

tjb

01/24/2019, 7:29 PM
let me get my popcorn — back on topic though! sorry to distract
👍 1
g

gpeal

01/24/2019, 11:16 PM
In practice, how much of an issue has memory size/startup time been? I can find a lot of articles that talk about some absolute numbers. They also vary quite a lot and it's not clear to me how much we should worry about their impact on productivity and ops vs near instant build/start for dev and low memory footprint for Go
m

mp

01/24/2019, 11:24 PM
For FaaS, especially lightly utilized, startup time may be an issue. For long running services it’s typically not a problem.
It’s not like Go doesn’t have memory consumption issues — its GC is, last I checked, non compacting so it will suffer from memory fragmentation, for instance. They’re just different issues.
But if you want generics and other type system things, tooling that isn’t insane, etc, then it may well be worth provisioning somewhat more memory. Maybe. Depending on your workload.
Java has a “slow startup time” rep from terrible things done a decade ago by people who didn’t quiiiiite know what they were doing. These days, it’s pretty simple to make most things start up in a second or two, which for non-CLI or non-FaaS use is generally not a problem.
👏 2
p

psilospore

02/05/2019, 5:31 PM
@dave I've found the Scala community to be really helpful. The gitter channels are great.
p

paulex

05/17/2019, 4:42 AM
I love this thread! Learnt quite a lot.