https://kotlinlang.org logo
#http4k
Title
# http4k
d

davidasync

05/17/2019, 2:42 AM
Hello sorry for noob question. I notice this post at FaQ,
Copy code
Q. Does http4k support an Async model? I need webscale!

A. Not at the moment. Adding Async support is a decision that we are thinking about carefully so that we don't end up complicating the API. When we do add it, it'll probably use co-routines and they're still marked as experimental which is another reason we are holding off. As for the scaling arguments, see the above answer relating to production usage.
But I'm seeing this library also support
Copy code
- Apache sync + async HTTP
- Jetty HTTP (supports sync and async HTTP)
- OkHttp HTTP (supports sync and async HTTP)
- Java (bundled with http4k-core)
Which mean support async model, isnt it ?
n

Nezteb

05/17/2019, 3:31 AM
I’m assuming HTTP4K doesn’t support async servers, i.e. handling requests asynchronously; it can only use pre-existing async HTTP clients.
✔️ 2
d

dave

05/17/2019, 3:50 AM
@Nezteb is 💯% correct here. The asynchronous http client support is built into the clients in case you needed it. As above, these clients are not coroutine-based. We have a migration path spiked and planned for the switch to coroutines, but at the moment it's not imminent. One of the main API niggles is that you can't extend from a suspend function in Kotlin, which means that HttpHandler would have to become an interface, in the same style as Filter. We also need to do the work to plug the coroutines into the various server backends and clients.
d

davidasync

05/17/2019, 5:42 AM
Thanks for the explanation, really appreciated ~
d

dave

05/17/2019, 9:56 AM
np 🙂
n

Nezteb

05/17/2019, 4:26 PM
In the world of microservices though, this is less of an issue. The HTTP4K service I’ve been building runs with 3 instances inside kubernetes and if the thread pools become overtaxed more instances are temporarily spun up to deal with the load.
(still an issue, but less so 😄)
d

dave

05/19/2019, 12:51 PM
WRT performance, a previous client with a top ~700 global site (according to alexa.com) which runs pretty much all on http4k runs all their traffic on between 4-6 CloudFoundry instances of various microservices. No tuning required apart from the standard GC-options. They do a few 10's of millions of hits a day last time I saw it measured.
d

davidasync

05/19/2019, 4:38 PM
That's pretty cool ~
2 Views