ktor
ktor copied to clipboard
Kotlin Native Support
Hello ! Does Ktor support Kotlin Native for now (using Netty)? I saw few comments in JetBrains Blog, but can't find any detailed information about it. Thank you !
Right now, only the HTTP Client supports Kotlin/Native
Right now, the HTTP client supports osx, and macos. I read Linux is being considered. But windows isn't mentioned anywhere... Is there any plans to support windows? I am building a cross-platform desktop program that targets macos and windows, and just want to know if I can expect windows to be supported in the future. I would rather not waste my time using ktor's http client if windows support is not in the plans.
Can the 'ktor-client-core' be published for other native targets? So at least, custom client engines can be made.
Any updates on it? Can we now create ktor server-side app for native ?
I found Kotlin Native server - source
@e5l Hey, just saw that this issue was added to 1.1.5 milestone that is closed. Does it mean that Ktor support Kotlin Native? (as the current version is 1.2.0)
Hi there :) I'm in love with Kotlin Multiplatform! But Ktor server support is blocking for us to use it in our company's product. Is it something that is still planned or this is something that appears impossible in the end ?
I can (try to) give an hand on this, is this possible to have an overview of what is missing or what are the problematics ? Thanks! :)
ktor server MPP is planned for 1.4.0
Still waiting on MPP websockets :crossed_fingers:
and http3 =)
Ktor Client is available for linuxX64 but not for the other Linux targets (linuxArm32Hfp, linuxArm64 etc) :( .
This would make for a very interesting serverless implementation in combination with things like openfaas or rio.io
I think this issue doesn't receive the attention it is worth. If it was really possible to decouple ktor-server and its modules from Java, it would be groundbreaking. The biggest problem with Java web frameworks is their slow startup time, because the JVM often takes seconds to start up. If K/N ktor-server would be a thing, I am pretty sure that many developers would consider porting existing Kotlin projects that depend on http4k, Spring, Vert.x or similar to ktor which would give them a dramatic performance boost. I don't believe that this issue will be easily resolved (and I am genuinely curious how you guys will tackle it!), so I was a bit surprised to see so little discussion in this thread. I couldn't find a public roadmap, so one can only hope that 1.4 will be around, soon, but until then, the next generation of Kotlin microservices will be waiting 🚀
If Ktor Server was ported to Kotlin Native (supporting the linux targets) would Ktor be suitable for Serverless via OpenFaaS? What would the performance footprint for Ktor Server look like on Kotlin Native compared to Go lang?
Currently there isn't a single cloud provider (eg AWS) that provides Kotlin Native support. Having Ktor Server ported to Kotlin Native would help change that. Many cloud providers except for GCP (Google Cloud Platform) are paying lip service to Kotlin support (aka examples/demos are presented but no official Kotlin support is provided). GCP Kotlin support is restricted to Kotlin JVM only, and doesn't extend to Kotlin Native unless Google have some future plans to extend Kotlin support.
@napperley at the moment, K/N has poor performance as the dev team primarily focused on compatibility. It will take a few iterations until it is comparable to the more mature Go let alone C. In the meantime, though, it would be great to start with the porting of ktor so that when K/N is performant, ktor is ready to be used.
I also think there's a lot of opportunity for kotlin native/ktor in the serverless space and to compete with things like graalvm.
I get that graalvm has different promises than kotlin native as it will transpile more jvm related stuff to native. But still it seems very painful, slow and complex, and also requires changes in the jvm related frameworks.
Offering the combination of native performance/memory usage, ktor and a familiar language might be able to pull over a lot of developers out of the jvm/graalvm space.
@krishofmans exactly! I am currently working with Micronaut because it's specifically made to be compiled as Graal native-image and it's extremely tedious! Documentation is terrible, I have to look up source code in order to find out how to implement simple features, IDEA needs additional configuration (which in part is nowhere documented, I had to figure it out by trial and error) and although they have some support for Kotlin it feels very clunky and requires some hacks. Compiling the Micronaut code then takes forever (especially annoying when testing) and creating Graal's native-image takes even longer (literally minutes). On top of that, it fails every second time with some unidentifiable error (I don't want to bash native-image too much though, as it's currently Early Adopter so errors are to be expected). And another reason why K/N is so valuable: Because Graal's native-image is currently Early Adopter. I suspect Oracle to make it an enterprise feature when it's released. Sorry for the rant, but I really want to stress that for serverless developers, it would be so mind-boggling to have the beauty of Kotlin and the performance of native code - all without the need of weird hacks.
I just realized that because ktor seems to rely on reflection a lot, porting it will require significant changes of the whole application pipeline. K/N currently supports reflection only to a very limited extent.
Perhaps that's just an opportunity for K/N to also further it's features. Since reflection is basically a metadatamodel of the code that can be modified at runtime.
It could be seen as an api around method/field lookup tables with some additional metadata and perhaps it will become more widely supported in K/N this way.
I know that it's a lot more complex and a lot of work will go into it to support it, but still looks like something that could be worth it if it would also enable porting over other jvm kotlin based frameworks over to the native space.
Is there another issue or PR for this? Still planned for 1.4?
WIP in e5l/cio-common
. Yep, the implementation is in progress.
Is the WIP referring to the Ktor Server implementation?
On Tue, 21 Apr 2020 at 22:38, Leonid Stashevsky [email protected] wrote:
WIP in e5l/cio-common. Yep, the implementation is in progress.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ktorio/ktor/issues/571#issuecomment-617098475, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA272Z2HMXMNJBPP5YSPB6DRNVZRHANCNFSM4FT6VNBA .
I am not in a hurry, I want to use native servers for a testing framework for iOS and Android I am working on. I have a solution working with okhttp mocks and Objective-C server, under one interface in Kotlin MP. Just interested if there is a way, or some rough ETA, where I could switch that to Ktor Server on Kotlin MP. I would be happy to help, if possible, if there are parts I could comprehend ;)
I'm looking forward to this. I'm in a state of changing my tech stack and kotlin is one of them (I want to leave from JVM, golang is another selection). But for me, still kotlin with spring boot apps is the way until a native approach arises. Trying graalvm native support with spring was a failing step. If ktor manages to be native, for sure this will be the way to go for kotlin APIs into docker from scratch.
Is there any updates ? (or news)
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
I have ktor server with cio working as a native image - I posted this YT issue https://youtrack.jetbrains.com/issue/KTOR-965
But this won't help if you want to use Ktor server on your iOS app.
According to release notes it is in 2.0.0-beta-1. I tried to test it on Android with CIO server and there is just no response from server when i try to call it. Same issue with Netty on 2.0.0-beta-1 but Netty 1.6.7 works.
With CIO i get no visible errors in output.
On Netty there seem to be some issues:
No implementation found for int io.netty.channel.kqueue.Native.sizeofKEvent() (tried Java_io_netty_channel_kqueue_Native_sizeofKEvent and Java_io_netty_channel_kqueue_Native_sizeofKEvent__)
No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData() (tried Java_io_netty_channel_epoll_Native_offsetofEpollData and Java_io_netty_channel_epoll_Native_offsetofEpollData__)
WARN io.netty.util.internal.MacAddressUtil - Failed to find a usable hardware address from the network interfaces; using random bytes:
@Nailik I think this issue has been fixed https://youtrack.jetbrains.com/issue/KTOR-3653
I think this isn't fixed until I can create native Windows server. The documentation doesn't give any hint why Windows target support is dropped. Can't we take the io.ktor:ktor-server-cio
or io.ktor:ktor-server-core
as a base. It sounds weird that it's impossible to create server on Windows nowadays. How they can achieve that on ISS or .Net Core?