Coworker just asked this: > I'm looking for lea...
# server
l
Coworker just asked this:
I'm looking for learning resources as an experienced PHP developer trying to understand the subtleties of working with the JVM.  For example, PHP has essentially no concept of multithreading and asynchronous programming, while it seems pretty important to JVM development.  Does anyone have suggestions?
They are just starting to use kotlin on the backend and ran into some performance issues w/their impl of coroutines. Any recommendations?
a
Spend some time learning the vertx framework and reading its documentation
Also why use coroutines when threading is misunderstood. I consider coroutines to be learned and used after understanding threading
Also https://www.swoole.co.uk php's async framework
a
I guess it depends very heavily on what you're doing, most PHP applications serve mutliple users and if you're using something like spring you'll probably be handling multiple users in the same way
a
PHP uses processes, Spring uses threads, to serve multiple users
l
Thanks for the recommendations. They are migrating from a monolith php stack to kotlin microservices. On one of the microservices they started to use coroutines instead of reactive. Lots of performance issues so they ended up removing all the coroutine code. They are trying to learn more about async programming in general before going down that route again (if they do). I'm in android land and very happy with coroutines, so it's interesting to me to see them have so many issues with it.
a
You can give them my contact if they want to chat about async - I do a lot of that stuff
m
coroutines are a tool, and like every tool it can be misused: your team need to study on the subject to become effective
n
@lutz I came from PHP land too. Rather than diving into threading and coroutine immediately I would suggest to explore the differences of language first. If individuals is using any framework in PHP, then see how same can be done in Java/Kotlin land using some framework of his or her choice. Then dive into threading and other stuff.
1
e
Maybe performance issues were caused by blocking code inside coroutines. Coroutines are not threads and blocking code degrades performance significantly. They may want to add some checker, such as https://github.com/reactor/BlockHound
👍 2
l
Yes - there was definitely
runBlocking
code that got removed. Do you have any docs I can send them about this issue:
Coroutines are not threads and blocking code degrades performance significantly.
a
Coroutines are syntactic sugar over callbacks - just remember that
c
vert.x is really not the obvious choice here. have them join the #coroutines channel here and ask for help for specific problems. maybe try to come up with small isolated samples for problems.
👍 1
j
Doesn't it depend on what kind of system you are building in a first place? For basic web applications there is no need to be reactive and use any async/coroutines bells and whistles but understand threads first
It feels that there's some kind of hype around async/reactive paradigm which makes ppl dive in to the deep end straight away even if they shouldn't need to
🙂 2