ktor icon indicating copy to clipboard operation
ktor copied to clipboard

Noticeable lag while starting and stopping Ktor

Open Aditya94A opened this issue 5 years ago • 4 comments

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 👇

image

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?

Aditya94A avatar Nov 19 '19 17:11 Aditya94A

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.

Koriit avatar Nov 26 '19 08:11 Koriit

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.

22f avatar Dec 13 '19 09:12 22f

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

oleg-larshin avatar Aug 10 '20 15:08 oleg-larshin

Are able to still reproduce that problem?

Stexxe avatar Jul 26 '21 13:07 Stexxe