• zea
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    You really should be doing your IO async. Do you specifically mean callback hell?

    • ☆ Yσɠƚԋσʂ ☆@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      7 months ago

      No I meant having to do async as opposed to having threads like you would in Java for example. In vast majority of cases a thread pool will work just fine, and it makes your code far simpler. Typically, Java web servers will have a single thread that receives the request and then dispatches it to the pool of workers. The JVM is then responsible for doing the scheduling between the threads and ensuring each one gets to do work. You can do async too, but I’ve found threads scale to huge loads in practice.

      • zea
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        Green threads are functionally the same, especially in languages that can preempt.