ktor
ktor copied to clipboard
Noticeable lag while starting and stopping Ktor
I've noticed that (even in hello world projects)
- After starting the server, it takes 4-5 seconds for it to start accepting API calls on localhost
- Upon stopping the server, the process often lingers around for another 5-6 seconds showing the below icon 👇
Now this may not sound like much, but starting and stopping every day hundreds of times, this could easily get very annoying. (This is on a 2019 i9 4.5Ghz Macbook Pro)
So I wonder, if I'm missing something or whether this is something that everyone faces? Is there a way to fix this?
I think it is very likely caused by the engine underneath. Which one are you using? Personally, I have experienced something similar with Netty and Jetty engines. CIO seems to start/stop almost instantly.
CIO seems to start/stop almost instantly.
Nope. On my different devices with macOS, windows, linux I meet this problems with CIO engine too.
So, I see INFO Application - Application started: io.ktor.application.Application
in log, but app start accept requests 4-5 seconds later.
As workaround we can make some healthcheker inside, and after success call to itself write smth at log, but want to understand the nature of this problem.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Are able to still reproduce that problem?